On 05/07/09 16:15, Jeri Raye wrote:
>
> Hi,
>
> If a line contains a , this , should have only one space character and
> also only one space character
> after it. How do you do that?
>
> So the following:
> sX,sY
> sX ,sY
> sX, sY
> sX , sY
>
> Must all be come (the last one should be trimmed to one space before
> and after the ,)
> sX , sY
>
> Rgds,
> Jeri
Are you sure?
It is possible, but the usual typographical (and programming) convention
is to have no space before a comma, and one space after it except at the
end of a line or before another comma, closing quote etc.
To do what you ask (untested)
:%s/\s*,\s*/ , /g
This ought to replace any comma preceded and followed by zero or more
spaces and tabs by space-comma-space. I think that consecutive commas
will get two intervening spaces instead of one though.
Best regards,
Tony.
--
Anything worth doing is worth overdoing
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---