Vim Recall繁體中文

Format a paragraph to textwidth

gqap

Example

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

Wrap paragraph text with the formatting operator.

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 2, column 1

Start in Normal mode, at line 1, column 1 (one-based). Set textwidth=24 and formatoptions=tcq. gq uses the configured formatting rules and moves the cursor. Press gqap.

Details & Vim help

Example replayed in Vim

Wrap paragraph text with the formatting operator.

Set textwidth=24 and formatoptions=tcq. gq uses the configured formatting rules and moves the cursor.