To sort words within double quoted texts, try:

:%s/"\zs[^"]*\ze"/\=join(sort(split(submatch(0))))/g


On Thu, 20 Nov 2008, A. S. Budden wrote:
>
> How about:
>
> :g/str_list/let items = sort(copy(split(matchlist(getline('.'),
> '"\([^"]*\)"')[1], ' \+'))) | s/"\zs[^"]*\ze"/\=join(items, ' ')
>
> ...
>
>
> 2008/11/20 MZ <[EMAIL PROTECTED]>:
>>
>> suppose I have a few line that goes like this:
>> str_list="foo bar   man act"
>>
>> how can I sort all the words within the quote " ... " so that it
>> becomes "act bar foo man"? It is okay to eliminate extra whitespace so
>> that it ends up with only one space behind each word.
>>
>> --MZ
>>>
>>
>
> >
>
>

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

Reply via email to