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

后端 未结 6 1446
庸人自扰
庸人自扰 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:12

    Cryptic way:

    qqqqqJ@qq@q
    

    (the first three q's clear the q register, the qqJ@qq records a macro to the q register that performs a Join, then calls q, and the last @q runs it.

提交回复
热议问题