Hi J.!
On Mi, 16 Sep 2009, J. Manuel Picaza wrote:
> the perfect solution would be: function changeInCode(pattern,whatSyntax
> (es),...), but at the moment my poor map works well.
Something like this should work:
,----
| fu! <SID>Replace_Region(pattern, substitute, flags, exclude) range
| let syn_ex='(synIDattr(synID(line("."), col("."), 0), "name") !~? ' . "'"
. a:exclude . "')"
| exe ":" . a:firstline . ',' . a:lastline . "s/" . escape(a:pattern, '/')
. '/\=' . syn_ex . '?' . a:substitute . ':submatch(0)/' . a:flags
| endfu
|
| com! -nargs=* -range=% -complete=expression Replace :<line1>,<line2>call
<SID>Replace_Region(<f-args>)
`----
And then you could use:
:%Replace \<select\|from\|where\|contains\> toupper(submatch(0)) ge
sqlString\|Comment
regards,
Christian
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---