How do I join two lines in vi?

后端 未结 9 1538
后悔当初
后悔当初 2020-12-07 08:41

I have two lines in a text file like below:

S_F
_ID_T_O.DAT
         


        
9条回答
  •  孤城傲影
    2020-12-07 09:25

    In vi, J (that's Shift + J) or :join should do what you want, for the most part. Note that they adjust whitespace. In particular, you'll end up with a space between the two joined lines in many cases, and if the second line is indented that indentation will be removed prior to joining.

    In Vim you can also use gJ (G, then Shift + J) or :join!. These will join lines without doing any whitespace adjustments.

    In Vim, see :help J for more information.

提交回复
热议问题