2009/9/14 lejeczek <[email protected]>:
>
> hi Tim, thanks for your reply, cannot get it to work for me though,
> here is a line, and there is many like it, where the part between
> /* here is a part */
> differs, now how to move it to the end of line
>
> li.cat-item-9{ /* fedorka */ background: #C7DE8E; }
> li.cat-item-7{ /* us */ background: #8EBEDE; }
How about something like:
:%...@\(/\*.\{-}\*/\s*\)\(.*\)@\2\1
:%s - Substitute over the whole file
@ - Delimiter
\(...\) - First group, containing:
/\* - Literal slash followed by literal *
.\{-} - Any characters, as few as possible
\*/ - Literal * followed by literal slash
\s* - Soak up any white space into this group (optional)
\(.*\) - Group containing the rest of the line
@ - Delimiter, replace with...
\2\1 - Second group followed by first group (rest of line followed by
comment block)
Untested, less backslashy version (see :help \v ):
:%...@\v(/\*.{-}\*/\s*)(.*)@\2\1
Hope that helps,
Al
>
> cheers
>
> On 14 Sep, 14:14, Tim Chase <[email protected]> wrote:
>> > dear all, this works(as you well know)
>>
>> > :.,+8 g/\/* .\+ *\/// m$ it does move, searching the range, whole
>> > lines that match the patter to the end of file
>>
>> > how can I move what's matched in a line to the line end?
>> > this that whole - find that and move it to the end - this whole that
>> > cheers
>>
>> You can use something like
>>
>> :%s/\(pattern\)\(.*\)/\2\1
>>
>> The catch is that it will only do the first match in the line.
>> It takes a little more work to get multiple instances in the same
>> line -- especially if the transposed order must remain the same
>> (rather than inverted).
>>
>> -tim
> >
>
--
http://sites.google.com/site/abudden
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---