简体   繁体   中英

How to apply new textwidth to whole buffer in Vim

I've changed the textwidth option mid-way through my file and I'd like to reformat the whole buffer to use the new width. What's the quickest way to do this?


Solution - Vim documentation topic

gq

See

:help gq

if it helps.

gq<motion>

For example, if your file consists of 100 lines, move to the first line and then press:

gq100<Down Arrow>

You can use the visual mode to select the lines and then press gq as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM