Format a paragraph and keep the cursor
gwap
Example
Normal 0 / 2Operator pending 1 / 2Normal 2 / 2one two three four five six seven eight nine tenCursor on line 1, column 1one two three four five six seven eight nine tenCursor on line 1, column 1one two three four five
six seven eight nine tenCursor on line 1, column 1Reflow paragraph text while restoring the cursor position.
Waiting for motion or text object
Reflow paragraph text while restoring the cursor position
Before & after
one two three four five six seven eight nine tenCursor on line 1, column 1one two three four five
six seven eight nine tenCursor on line 1, column 1Start in Normal mode, at line 1, column 1 (one-based). Set textwidth=24 and formatoptions=tcq. gw uses internal formatting and restores the cursor location as documented. Press gwap.
Details & Vim help
Example replayed in Vim
Reflow paragraph text while restoring the cursor position.
Set textwidth=24 and formatoptions=tcq. gw uses internal formatting and restores the cursor location as documented.