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?
Asked
Active
Viewed 135 times
3
-
This probably belongs on SuperUser or U&L since it's not really a programming question. Perhaps you should flag it for a moderator to migrate to the appropriate site. – Caleb Jul 20 '11 at 12:20
2 Answers
4
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>

Caleb
- 5,084
- 1
- 46
- 65
-
1@Benj: I didn't see your version until I had posted my edit. I was off in another window working it up so I had the edit window open for a while and didn't see your post. – Caleb Jul 20 '11 at 12:46
-
-
1You don't need `:map` here (it defines mapping for too much modes and also depends on other mappings). Use `:nnoremap`. – ZyX Jul 20 '11 at 17:02
3
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>

Benj
- 31,668
- 17
- 78
- 127