I'm familiar with solutions that will automatically wrap to 80 characters, etc. But fill-paragraph
lets me wrap things to 80 characters (or whatever) when I want to, which is convenient.
I'm not familiar with emacs or its fill-paragraph, but it sounds like you're looking for gq
. It takes a movement, so either highlight what you want to wrap or use a movement command. E.g. gggqG
will wrap the entire buffer.
If you care about your cursor staying put, then use gwip
.
The gw
command has the form gw{motion}
. The gw
command formats the lines that {motion}
moves over and puts the cursor back at the same position in the text. The motion ip
stands for 'inner paragraph'. You can think of the command as saying "format the paragraph I am in".
To define the fill width to 80 characters, you would want to do either
:set textwidth=80
or
:set tw=80
The textwidth
variable defines the maximum width of text that is being inserted. Lines longer than this width are broken after the white space. Note that textwidth
is not available in vi
.
Note, it's likely that Vim and Emacs have different definitions for what constitutes a paragraph. If you care about that level of detail, you can always read more about the various commands using :help gw
, :help ip
, :help tw
, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With