简体   繁体   中英

How can I move line up in Vim text editor?

I have two strings in some file, eg:

string1
string2

And I want to get this:

string1string2

How can I do this most efficiently?

Shift-j ( J ) for "join" will move the line under the cursor up to the previous line. Note that this also inserts a space at the end of the line. If you type g Shift-j , no space will be appended when joining.

You can join multiple lines at once by highlighting them. For example, gg Shift-v Shift-g Shift-j ggVGJ will join all lines in the file.

You can refer to :help join in vim for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM