4

I noticed that vi's auto format adds two spaces after a full stop. I wonder how this can be changed, i.e., insert just one space after a full stop, or even a line break.

The application is in using a line based version control system such as git for editing text documents (LaTeX in particular). With the convetion of breaking lines at full stops, changes to an autoformatted paragraph would be confined to modified sentences.

2
+50

When Vim joins a line that ends with a period to another line, it inserts two spaces between them. This is because joinspaces is on by default. To make gq only insert one space between lines, use:

:set nojs

Vim is also set to collapse lines shorter than textwidth with gq. To make gq not join lines together, you can use the format option w:

:set fo+=w

This option makes vim only collapses lines that end with a space.

I hope this helps! For more information see :help js and :help fo-table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.