How do I uppercase a word and then jump back to my exact original cursor position?
mzgUiw`z
When you run an operator like gUiw, Vim can leave your cursor in a slightly different place than where you started.
mzgUiw`z
When you run an operator like gUiw, Vim can leave your cursor in a slightly different place than where you started.
/TODO/e
Most users know /pattern, but fewer use search offsets to control where the cursor lands after the match.
:let @q .= 'j.'
When a recorded macro is almost right but missing one repeated step, re-recording from scratch is usually slower and riskier than patching the register directly
yiww"_ciw\<C-r>0\<Esc>
When you are doing repetitive refactors, cw is fast but it overwrites the unnamed register with the replaced text.
:g/[^[:space:]]/normal! A;\<CR>
When you need to patch many lines at once, :g with :normal! is often faster and safer than recording a macro.
command-line #command-line #ex-commands #editing #normal-mode
:lfdo normal! @q | update
When you already have a curated location list, :lfdo lets you apply a change only to those files instead of touching your whole project.
macros #macros #location-list #refactoring #command-line #normal-mode
<C-o>zvzz
Jumping backward with is fast, but in folded or dense files it can land you in a collapsed section or near the edge of the screen, forcing extra cleanup keystro
:keepjumps normal! /\Vtarget\<CR>
Repeated navigational searches can pollute the jump list, especially when you are doing targeted inspections before returning to your main edit location.
navigation #navigation #search #jumplist #normal-mode #workflow
*cgn
Global substitution is fast, but sometimes you need selective control over each occurrence.
:execute "normal! gg=G"<CR>
:execute lets you build and run Ex commands dynamically, which is critical when a command depends on variables, conditionals, or string composition.
command-line #command-line #ex-commands #normal-mode #automation
:g/^/normal I// <CR>
When you need to comment a whole block quickly, :global combined with :normal is faster than recording a macro or entering Visual Block mode.
:'<,'>normal! A;
Visual selections are not just for direct operators; they also define an Ex range.
visual-mode #visual-mode #normal-mode #editing #ex-commands #automation
,
After using f, t, F, or T for single-character motion on a line, Vim lets you repeat that character search without retyping the target.
g?iw
g? is Vim’s built-in ROT13 operator.
:keepjumps normal! 500@q
Running a macro hundreds of times is efficient, but it can flood your jumplist and make normal navigation painful afterward.
:verbose nmap <lhs>
When key behavior is inconsistent, the root cause is usually mapping precedence.
command-line #command-line #mappings #debugging #config #normal-mode
qqgUiwjq2@q
Macros are strongest when the edit pattern is stable but too awkward for a one-liner substitute.
g<C-x>
Most people know decrements one number under the cursor, but g in Visual mode performs a sequential decrement across the selection.
:'a,'bnormal! @q<CR>
When you need to replay a macro on a precise region, selecting lines manually can be slow and error-prone.
nzzzv
When you are stepping through many matches, plain n often lands with poor context and can hide the match inside a closed fold.