On 09/03/2012 12:43 p.m., Tim Chase wrote:
> On 03/09/12 11:40, Tim Chase wrote:
>> On 03/09/12 10:45, Cesar Romani wrote:
>>> How can I convert this:
>>>
>>> Vaya con Dios
>>>
>>> to:
>>>
>>> [VAYA CON DIOS](#vaya-con-dios)
>>
>> Just this particular case, or do you have other text that needs
>> to be found?
>>
>> :%s/.*/\='['.toupper(submatch(0)).']#'.substitute(tolower(submatch(0)),
>> ' ', '-', 'g')
>
> And of course I missed the parens, making that
>
> %s/.*/\='['.toupper(submatch(0)).'](#'.substitute(tolower(submatch(0)), ' ', '-', 'g').')'
>
> -tim

Thanks a lot, it works fine, but if I use it under :execute and try to
convert:

Véase Vaya con Dios

to:

[VAYA CON DIOS](#vaya-con-dios)

there are some problems with quotes, as in:

execute '%s/Véase \(.*\)/\='['.toupper(submatch(1)).'](#'.substitute(tolower(submatch(1)), ' ', '-', 'g').')'."'"

Best regards,

--
Cesar

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to