Quantcast
Channel: vim command to restructure/force text to 80 columns - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Answer by JohnGH for vim command to restructure/force text to 80 columns

$
0
0

You can use gq with any movement operators. For example, if you only want to reformat to the end of the current line (i.e. to wrap the line that your cursor is on) you can use gq$

You can also reformat by selecting text in visual mode (using `v and moving) and then typing gq.

There are other options for forcing lines to wrap too.

If you want vim to wrap your lines while you're inserting text in them instead of having to wait till the end to restructure the text, you will find these options useful:

:set textwidth=80:set wrapmargin=2

(Don't get side-tracked by wrap and linebreak, which only reformat the text displayed on screen, and don't change the text in the buffer)


Viewing all articles
Browse latest Browse all 7

Trending Articles