But this won't work with "Vaya con Dios: some extra texts...".

On Thursday, March 15, 2012 2:55:24 AM UTC+9, Tim Chase wrote:
> On 03/14/12 06:23, Dominique Pell� wrote:
> > Yasuhiro MATSUMOTO<[email protected]>  wrote:
> >> %g/Vaya con Dios/s//[\U&](#\L&)/|s/#[^)]\+/\=substitute(submatch(0),' 
> >> ','-','g')/
> >
> > This is a bit shorter:
> >
> > :%s/\v(Vaya) (con) (Dios)/[\U&](#\L\1-\2-\3)/g
> 
> But it only works with that particular text verbatim.  I assumed 
> the OP wanted something to convert arbitrary lines of text into a 
> capitalized version of that text, followed by a lowercase version 
> of the text wherein the spaces were replaced with dashes.  Thus 
> my initial suggestion of
> 
> %s/.*/\='['.toupper(submatch(0)).'](#'.substitute(tolower(submatch(0)), 
> ' ', '-', 'g').')'
> 
> -tim

-- 
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