user773013
user773013

Reputation: 31

Moving a line from one screen to other screen in vim

Suppose I have opened two different files in two vertical screens in vim. Is a there a single command to move the line under cursor to other screen?

Upvotes: 3

Views: 141

Answers (2)

Caleb
Caleb

Reputation: 5408

Not to my knowledge. Delete it, switch panes and paste it.

dd<ctrl>ww</ctrl>p

Of course if this is something you do regularly you can write a macro for it, just like for any other sequence of commands in vim. For example to map CtrlX to this function, you could run this in your buffer or set it in your ~/.vimrc file:

:map <C-x> dd<C-w><C-w>p<C-w><C-w>

Upvotes: 4

Benj
Benj

Reputation: 32398

If you want to do this on a regular basis, just map it to a keystroke. e.g.

map <C-A> dd<C-W><C-W>P<C-W><C-W>

Upvotes: 3

Related Questions