In VIM, how do I break one really long line into multiple lines?

前端 未结 11 560
刺人心
刺人心 2021-01-29 17:53

Say I have a super long line in the VIM editor (say around 300+ characters). How would I break that up into multiple lines so that the word boundaries roughly break at 80 chara

11条回答
  •  一向
    一向 (楼主)
    2021-01-29 18:21

    I needed to reformat an entire file rather than one line. As Wernsey points out, I could have used 'fmt', but the following sequence in vim did the trick also (borrowing from the various answers here):

    
    :setl tw=80 fo=t
    1GVGgq
    

提交回复
热议问题