To set line to be 100 characters for the edited text as below.
:set textwidth=100
gggqG
I found that all lines set 100 characters but all the white spaces deleted.
How to keep all white spaces at the same time to set width 100 for every line?
To set line to be 100 characters for the edited text as below.
:set textwidth=100
gggqG
I found that all lines set 100 characters but all the white spaces deleted.
How to keep all white spaces at the same time to set width 100 for every line?
Copyright © 2021 Jogjafile Inc.
Vim's built-in formatter keeps multiple spaces inside text; these only get truncated when Vim breaks the line right there.
As for indent (whitespace at the beginning of the line), the first (or with
2in'formatoptions', second) line determines the indent for the reformatted block.In general, this setting makes sense. If you have special formatting needs, you can instruct Vim to either use an external formatter that does the job (
:help 'formatprg'), or write your own in Vimscript (:help 'formatexpr').