Swap current line with line in register.

2 Points

Chris Penner Chris Penner

4 years ago

Use Ctrl+p to swap the current line with the line you have in the register, this allows you to swap lines around very quickly without worrying about deleting lines that mess up what you had in your register.

Works best after a yy or dd, gets weird results otherwise.

" Substitute current line out with copy/paste register and leave that line in the register
nnoremap <C-P> pkdd

Martin Kopischke

Martin Kopischke 4 years ago

Vp will achieve the exact same result without forcing you to use a chord.

Chris Penner

Chris Penner 4 years ago

Oh! Very nice, didn't think of that!