How do I join two lines in vi?

后端 未结 9 1537
后悔当初
后悔当初 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:39

    Vi or Vim?

    Anyway, the following command works for Vim in 'nocompatible' mode. That is, I suppose, almost pure vi.

    :join!
    

    If you want to do it from normal command use

    gJ
    

    With 'gJ' you join lines as is -- without adding or removing whitespaces:

    S_F
    _ID_T_O.DAT
    

    Result:

    S_F_ID_T_O.DAT
    

    With 'J' command you will have:

    S_F _ID_T_O.DAT
    

    Note space between type> and _ID.

提交回复
热议问题