Sunday, May 2, 2010

Re: switch the line above the cursor and the line below the cursor

On 05/02/2010 06:55 PM, Peng Yu wrote:
> I want to define a key shortcut switch the line above the cursor and
> the line below the cursor without affecting what is in the buffer (I
> mean the things copied by say 'yy'). Could you show me how to do it?

I usually use the following Ex ":move" commands:

:m+ " swap this line and the next
:m-2 " swap this line and the prev

to move a line up/down without touching my registers. I usually
use only the former because (1) it's easier for me to remember,
(2) it's shorter for me to type, and (3) for the cost of the
character, I can press "k" to move up a line, reducing the
problem to "swap this line and the next".

Either or both of these can be mapped.

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: