On May 4, 2:28 am, Jürgen Krämer <jottka...@googlemail.com> wrote:

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

or alternatively, you could even use a substitute command:
:.-,.+s/\v^(.*)\n(.*)\n(.*)/\3\r\2\r\1/|-


Thank you. The first one works for me; the second one works too, but
for some reason also highlights all text in red.

It's true, this is something normally one would need to do, but when I
saw the OP I thought of a few scenarios that might be fun/useful in
classes that I teach. (Nothing to do with coding; it's just that being
able to swap sentences around like that at the touch of a button can
let me play with lists of sentences to generate variations in sentence
sequences for ESOL students.) The built-in commands mentioned are also
very handy, so whichever way Peng Yu intended the question, the
responses are much appreciated.

-BC

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

Reply via email to