Hello -

I want to change lines of the form

able|baker|charlie|dog|easy

to

baker|able|charlie|dog|easy

With the cursor on the line I can do this with the command

:.s/\(\[^\|\]*\)\(|\)\(\[^\|\]*\)\(|\)\(.*\)/\3\2\1\4\5/

which looks like a diagram for the cutting edge of
a tunnelling machine.

In order to do this more than once I would like to be able to represent
this with a typable
command such as "swap12", preferably in the .vimrc file assuming that
this initialises Vim when
Vim is started up. Is there a way of doing this in Vim? I might have
expected to be able to use
'map' or 'ab' or 'command' but these all fail. I tend to get a 'trailing
characters' error message
but it does not tell me which characters are trailing or what the
objection is to having
trailing characters. I am working in Windows XP so line-end character
incompatibilities may
be complicating this matter.
 
It may be that I have over- or under-escaped some characters - is there
a clear account
of the subject of escaping in the Vim literature?

Regards

_John Sampson_


__________ Information from ESET NOD32 Antivirus, version of virus signature 
database 4262 (20090720) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



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

Reply via email to