Vim Recall繁體中文

Format a paragraph and keep the cursor

gwap

Example

Normal 0 / 2
one two three four five six seven eight nine ten
Cursor on line 1, column 1

Reflow paragraph text while restoring the cursor position.

Before & after
Before
one two three four five six seven eight nine ten
Cursor on line 1, column 1
After
one two three four five
six seven eight nine ten
Cursor on line 1, column 1

Start 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.