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

前端 未结 11 557
刺人心
刺人心 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:10

    As a quick and nasty, maybe try the following map:

    map q 080lwbels
    

    which says:

    • start a 0th position of line,
    • move to 80th char to the right,
    • go to beginning of next word,
    • go back to previous word,
    • go to end of current word,
    • go one char right, and
    • substitute a CR for that char.

    Then hitting q and CR will break the line up into chunks on the word boundary.

提交回复
热议问题