How do I select to the end of each line in visual block mode?
<C-v>$
In visual block mode, pressing $ extends the selection to the end of every line, even when lines have different lengths.
<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.
:set iskeyword+={char}
iskeyword defines which characters are considered word characters in Vim.
<C-r><C-o>{register}
The standard {reg} pastes register contents in Insert mode, but Vim may auto-indent multi-line text to match the current indentation level — sometimes manglin
:%s/\s\+/ /g
The pattern \s\+ matches one or more whitespace characters (spaces, tabs).
gl{motion}{char}
vim-lion (by Tom McDonald) adds gl and gL as alignment operators.
:'<,'>s/pattern/replacement/g
When you make a visual selection and then type :, Vim automatically inserts ' as the range — the marks for the start and end of the last visual selection.
When recording a macro, you can execute another macro inside it by pressing @b (or any register) during the recording.
<C-r><C-f>
While typing a command, inserts the filename under the cursor in the buffer at the command-line prompt.
:ldo execute 'normal @q'
:ldo runs an Ex command on each entry in the location list — the buffer-local cousin of the quickfix list.
guu / gUU
Vim's case operators gu (lowercase) and gU (uppercase) follow the same doubling convention as dd and yy: repeating the operator letter applies it to the whole c
"/p
Vim stores the last search pattern in the search register "/.
<C-a> / <C-x> (vim-speeddating)
vim-speeddating (by Tim Pope) extends Vim's built-in and increment/decrement operators to understand dates, times, roman numerals, and other ordered sequences.
vaB
The aB text object (around Block) selects everything from the matching { to the closing } — including the braces themselves.
:argdo execute 'normal @q' | update
:argdo runs an Ex command on every file in Vim's argument list (the arglist).
<C-r>0
In Insert mode, {reg} pastes the contents of any register inline at the cursor.
<C-g>u
By default, Vim treats an entire Insert mode session (from entering Insert mode to pressing ) as a single undo unit.