How do I run a substitute command without overwriting my current search pattern?
:keeppattern %s/old/new/g
When you run a :s or :%s substitute command, Vim updates the search register (@/) with the substitution pattern.
category:
command-line
tags:
#ex-commands
#search
#editing
#registers
#substitute
How do I run normal mode commands on a range while ignoring custom mappings?
The :norm! (or :normal!) command executes normal mode keystrokes while ignoring all user-defined mappings.
category:
command-line
tags:
#ex-commands
#editing
#normal-mode
How do I force Vim to check if open files were changed externally and reload them?
The :checktime command tells Vim to check whether any open buffers have been modified outside of Vim and prompt you to reload them.
category:
buffers-windows
tags:
#buffers
#ex-commands
#editing
How do I run a command across all open buffers at once?
:bufdo %s/old/new/ge | update
The :bufdo command executes an Ex command in every loaded buffer.
category:
buffers-windows
tags:
#buffers
#ex-commands
#editing
#substitution
How do I evaluate expressions and insert results inline in Vim?
The expression register (=) is one of Vim's most powerful yet underused features.
category:
registers
tags:
#registers
#insert-mode
#ex-commands
#editing
How do I copy the current file's full path to the system clipboard?
Sometimes you need to share or use the full path of the file you're editing — for a terminal command, a config file, or a chat message.
category:
registers
tags:
#registers
#ex-commands
#editing
#clipboard
How do I run a substitution across all files in the argument list?
:argdo %s/old/new/g | update
The :argdo command runs an Ex command on every file in the argument list (the files you opened Vim with, or added via :argadd).
category:
command-line
tags:
#ex-commands
#editing
#command-line
How do I match only part of a search pattern for highlighting or substitution?
The \zs and \ze atoms let you define where the actual match starts and ends within a larger pattern.
category:
search
tags:
#search
#editing
#ex-commands
How do I run Normal mode commands in a script without triggering my custom mappings?
:normal {keys} executes keystrokes as if typed in Normal mode — but it respects your custom mappings and abbreviations.
category:
macros
tags:
#macros
#ex-commands
#normal-mode
How do I collapse multiple consecutive spaces into a single space throughout a file?
The pattern \s\+ matches one or more whitespace characters (spaces, tabs).
category:
editing
tags:
#editing
#search
#ex-commands
How do I incrementally grow or shrink a split window by a specific number of lines or columns?
:resize adjusts the height of the current window by a relative or absolute amount.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
How do I find out which file or plugin last set a particular Vim option?
:verbose set {option}? shows the current value of an option and reports exactly which file set it last — the full path and line number.
category:
command-line
tags:
#command-line
#config
#ex-commands
How do I open an existing buffer in a new split window?
The :sb (short for :sbuffer) command opens a buffer that is already loaded in Vim in a new horizontal split window.
category:
buffers-windows
tags:
#buffers
#windows
#ex-commands
How do I run a macro or command on every entry in the location list?
:ldo runs an Ex command on each entry in the location list — the buffer-local cousin of the quickfix list.
category:
macros
tags:
#macros
#ex-commands
#editing
How do I list all buffers including unlisted ones like help pages and terminal buffers?
:ls (or :buffers) shows Vim's buffer list, but it hides unlisted buffers — help files, directory listings (netrw), terminal buffers, and scratch buffers marke
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
How do I apply a recorded macro to a specific set of files using the argument list?
:argdo execute 'normal @q' | update
:argdo runs an Ex command on every file in Vim's argument list (the arglist).
category:
macros
tags:
#macros
#ex-commands
#editing
How do I speed up macro execution and bulk operations by preventing screen redraws?
When Vim runs a macro or an :argdo / :bufdo loop, it redraws the screen after every command by default.
category:
config
tags:
#config
#macros
#ex-commands
How do I load a set of files matching a glob pattern into Vim's argument list for bulk editing?
Vim's argument list (arglist) is a named list of files that you can operate on as a group.
category:
command-line
tags:
#ex-commands
#command-line
#editing
How do I rename, move, or delete the current file from inside Vim using vim-eunuch?
vim-eunuch (by Tim Pope) adds Unix shell operations as first-class Vim commands.
category:
plugins
tags:
#plugins
#ex-commands
#editing
How do I duplicate the current line and place the copy directly below it?
The :t (short for :copy) command copies lines from one location to another.
category:
editing
tags:
#editing
#ex-commands
#normal-mode