On 2009-08-26, [email protected] wrote:
> Hi,
> 
> I'm trying to get a few code straightening commands to fire, one after
> another:
> 
> " Cleanup Formating
> command! CleanupWhitespace %s/\s\+$//g
> command! CleanupFrontParens %s/\(if\|elseif\|foreach\|for\)(\([^ ]\)/\1
> ( \2/g
> command! CleanupRearParens %s/\([^ ]\)) {/\1 ) {/g
> command! CleanupFrontBools %s/\([^ ]\)\(&&\|||\)/\1 \2/g
> command! CleanupRearBools %s/\(&&\|||\)\([^ ]\)/\1 \2/g
> noremap <silent>
> <F5> 
> :CleanupWhitespace<Bar>CleanupFrontParens<Bar>CleanupRearParens<Bar>CleanupFrontBools<bar>CleanupRearBools<bar>:nohl<CR>
> 
> Unfortunately, execution stops after the first substitution
> (CleanWhitespace), if nothing is found.  I dug through the help docs,
> couldn't find a way to do this.
> 
> Any suggestions?

Add the e flag to your substitute commands, e.g.,

    command! CleanupWhitespace %s/\s\+$//ge

See

    :help :s
    :help :s_flags

Regards,
Gary



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

Reply via email to