In Vim, what is the simplest way to join all lines in a file into a single line?

后端 未结 6 1451
庸人自扰
庸人自扰 2020-12-07 16:32

I want to join all lines in a file into a single line. What is the simplest way of doing this? I\'ve had poor luck trying to use substitution (\\r\\n or

6条回答
  •  渐次进展
    2020-12-07 17:06

    Ah, I found the answer.

    :1,$join
    

    Works like a charm.

    EDIT: As pointed out in the comment:

    :%join   -or-    :%j
    

    ...removes the range.

提交回复
热议问题