How do I reformat text to fit textwidth without moving the cursor from its current position?
gw{motion}
The gw operator reformats text just like gq, but leaves the cursor exactly where it started.
216 results for "= motion"
gw{motion}
The gw operator reformats text just like gq, but leaves the cursor exactly where it started.
zf{motion}
Vim supports several fold methods, but manual folding with zf gives you precise control over exactly which lines to collapse.
!{motion}command
The ! operator in normal mode pipes text through an external shell command and replaces it with the output.
v{motion}<C-g>
Vim has a lesser-known select mode that behaves like selection in typical GUI editors: any typed character replaces the selection.
<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
<C-g>U{motion}
By default, moving the cursor with arrow keys while in insert mode creates an undo break — meaning a subsequent u will undo only back to when you last moved,
g??
Vim has a built-in ROT13 operator g? that encodes text by rotating each letter 13 positions in the alphabet.
"Ay{motion}
Using an uppercase register letter with any operator appends to the register instead of replacing it.
<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.
<C-v>{motion}I{text}<Esc>
Visual block mode () lets you select a rectangular region across multiple lines.
*NgUgn
gn is often treated as a visual selection command, but it is more powerful when used as a motion target for operators.
cx{motion}
The vim-exchange plugin by Tom McDonald provides the cx operator to swap two arbitrary text regions.
plugins #plugins #exchange #editing #text-objects #refactoring
:set opfunc and g@
Vim's operatorfunc option lets you define your own operators — just like the built-in d, y, or c — that accept any motion or text object.
"{register}y{motion}
Vim has 26 named registers (a-z) that act as independent clipboards.
registers #registers #editing #normal-mode #yank #productivity
,
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.
:keepjumps {command}
The :keepjumps modifier lets you run any movement or command without recording a new entry in the jump list.
navigation #navigation #ex-commands #jump-list #normal-mode #vimscript
d'a
Named marks are not just jump destinations — they serve as motion targets for any operator.
navigation #navigation #marks #editing #motions #normal-mode
gcip
The vim-commentary plugin exposes gc as a comment operator, which means it composes with any Vim motion or text object.
plugins #plugins #editing #commenting #text-objects #normal-mode
gw
The gw operator reformats text to fit within textwidth, just like gq — but with one key difference: gw leaves the cursor in its original position after format
+ and -
The + and - motions jump to the first non-blank character of the next or previous line respectively — combining vertical movement and ^ into a single, count-a