Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to concatenate two lines quickly in Vim?

Tags:

vim

vi

The basic operation is, imagine I have two lines of python codes in the opening buffer

    datacontour(set_color=set_color, figout="test",
            figext="pdf")

the second line is indented by 8 spaces because it is a continuation of the first line, now I want to combine both lines together, eliminating the spaces between the two

    datacontour(set_color=set_color, figout="test", figext="pdf")

What is the easiest way to do this? or what kind of shortcut I should define in the vimrc file? Thanks.

like image 218
nye17 Avatar asked Jan 07 '12 06:01

nye17


People also ask

How do I navigate faster in vim?

TL;DR: Use for small navigation. Use with relative line numbers. h , j , k and l are the basic movement keys in Vim. They should be used instead of the usual arrow keys on the keyboard to, as discussed above, keep your fingers on the home row as much as possible.

How can you yank 3 lines in vim?

Copying (Yanking) 3yy: To yank multiple lines in vim, type in the number of lines followed by yy. This command will copy (yank) 3 lines starting from your cursor position. y^: Copy everything from the start of the line to the cursor. yiw: Copy the current word.


1 Answers

Press J from the line 'dataContour...'

The next line will be merged to the current line.

like image 125
Rajendran T Avatar answered Sep 22 '22 17:09

Rajendran T