How do I open the command-line window while typing a command on the : prompt?
<C-f> (from command-line mode)
When you are partway through typing a long or complex Ex command on the : prompt, you can press to open the command-line window.
<C-f> (from command-line mode)
When you are partway through typing a long or complex Ex command on the : prompt, you can press to open the command-line window.
:keeppattern %s/old/new/g
When you run a :s or :%s substitute command, Vim updates the search register (@/) with the substitution pattern.
command-line #ex-commands #search #editing #registers #substitute
:%norm! A;
The :norm! (or :normal!) command executes normal mode keystrokes while ignoring all user-defined mappings.
:checktime
The :checktime command tells Vim to check whether any open buffers have been modified outside of Vim and prompt you to reload them.
:bufdo %s/old/new/ge | update
The :bufdo command executes an Ex command in every loaded buffer.
buffers-windows #buffers #ex-commands #editing #substitution
<C-r>=system("date")<CR>
The expression register (=) is one of Vim's most powerful yet underused features.
/\(function\s\+\)\zs\w\+
Vim's \zs and \ze atoms let you control which part of a matched pattern gets highlighted and operated on.
<C-w>_ and <C-w>=
When working with multiple splits, you often want to focus on one window by making it as large as possible, then restore equal sizing when you're done.
g; and g,
Vim tracks every position where you made a change in the changelist.
qqq qq{commands}@qq @q
A recursive macro calls itself at the end of its recording, causing it to repeat automatically until a motion fails (like j at the last line).
:let @+ = expand('%:p')
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.
) and (
The ) and ( motions move by sentence boundaries.
: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).
<C-v>$
In visual block mode, pressing $ extends the selection to the end of every line, even when lines have different lengths.
g<C-a> in visual mode
When you have multiple lines with the same number and want to turn them into a sequence (1, 2, 3.
/\zs and \ze
The \zs and \ze atoms let you define where the actual match starts and ends within a larger pattern.
gcc / gc{motion}
The vim-commentary plugin by Tim Pope provides a simple, operator-based way to comment and uncomment code.
qa Yp <C-a> q
By combining a macro with (increment number), you can quickly generate numbered sequences.
/pattern1/;/pattern2/
Vim's search offsets allow chaining two patterns together with a semicolon.
:set iskeyword+={char}
iskeyword defines which characters are considered word characters in Vim.