On 2009-06-04 22:05 (+0300), Teemu Likonen wrote:

> Interesting challenge. Here's my completely untested suggestion:
>
> :g/^AAAA/s/^.*$/\=split(submatch(0))[-1].'  '.join(split(submatch(0))[0:-2],' 
>  ')

Or perhaps:

:s/^AAAA.*$/\=split(submatch(0))[-1].'  '.join(split(submatch(0))[0:-2],' 

Of academic interest I did the same with Emacs too. It requires more
keystrokes. Sorry for being of topic. With Emacs it would go like this:

Replace

    ^AAAA.*$

with

    \,(let ((line (split-string \0)))
        (mapconcat 'concat
                   (append (last line) (butlast line))
                   "  "))

So it's fewer keystrokes with Vim once again. :-)

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to