Monday, May 3, 2010

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

On Tue, May 4, 2010 6:13 am, BC wrote:
> I thought the question was how to swap the line above the current line
> with the one below it, without changing the current line. I'd like to
> know how to do that, without affecting the registers.

Ok, this is cheating, since you are actually changing the current line:
:call setline(line('.')-1, reverse(getline(line('.')-1, line('.')+1)))

This will fail, if you are on the last or first line of a buffer.


regards,
Christian

--
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: