How do I rename a variable across all its case variants (camelCase, snake_case, SCREAMING_CASE) in one command?
:Subvert/{src}/{tgt}/g
vim-abolish provides :Subvert, a smarter substitute that detects and preserves the case style of each match.
:Subvert/{src}/{tgt}/g
vim-abolish provides :Subvert, a smarter substitute that detects and preserves the case style of each match.
:let @+=@%
The % register always holds the name of the current file (as a relative path).
<C-v>{motion}$A
In visual block mode, pressing $ makes the right edge of the selection "ragged" — it extends to the real end of each line regardless of length.
:keepjumps {cmd}
:keepjumps is a command modifier that suppresses any jump list updates caused by the command that follows it.
:bufdo {cmd}
:bufdo executes an Ex command in each open buffer in sequence, cycling through every buffer in the buffer list.
:cdo {cmd}
:cdo executes an Ex command on every entry in the quickfix list in sequence, visiting each match in turn.
qa{actions}@aq
A recursive macro is one that calls itself as its final action, causing it to repeat indefinitely until any command in the body fails (e.
<C-y> (above) / <C-e> (below)
In insert mode, inserts the character from the same column one line above, and inserts the character from the same column one line below.
cx{motion} … cx{motion} (vim-exchange)
The vim-exchange plugin provides cx{motion} to mark a region, then cx{motion} again on a second region to swap them in place.
!{motion}{cmd}
The ! operator in normal mode lets you pipe any motion's text through a shell command and replace it with the output.
editing #editing #shell #external-command #normal-mode #filtering
<C-r><C-l>
Pressing on the command line inserts the full text of the current buffer line (the line the cursor is on when you pressed :) directly at the command-line cursor
:normal!
The :normal! command (with !) executes normal mode keystrokes exactly as Vim defines them, ignoring any user-defined mappings.
O (visual-block)
In Visual-Block mode (), pressing O moves the cursor to the diagonally opposite corner of the rectangular selection.
<C-r><C-r>{reg}
When you insert a register with {reg} in insert mode, Vim processes the content as if you had typed it — this means autoindent, autoformat, and insert-mode ma
:m.+1 and :m.-2
The :move (:m) command relocates a line to a new position without cutting and pasting.
[{ and ]}
The [{ motion jumps to the previous unmatched { — the opening brace of the block enclosing your cursor.
<C-v>{motion}~
Visual block mode () selects a rectangular column region, and pressing ~ at the end toggles the case of every character in that exact column range across all se
:%s/\w\+/(&)/g
In a Vim substitution, & in the replacement string expands to the entire matched text.
!{motion} {cmd}
The ! operator passes text selected by a motion through an external shell command, replacing it with the command's output.
:%s/\(\w\+\)/\u\L\1/g
Vim's substitute command supports case-conversion escape sequences in the replacement string.