On Fri, Mar 05, 2010 at 11:23:36PM -0800, Davaris wrote:
The only problem is I can't get the patterns to work. :-/

I was given this to use,

%s/var \(.*\) : \(.*\) = \(.*\);/\2 \1 = \3;/g
%s/var \(.*\) : \(.*\);/\2 \1;/g
%s/function \(.*\)() : \(.*\)/public \2 \1()/g
%s/function \(.*\)/public void \1
%s/boolean/bool

but when I paste in the first line in command mode, it says

E486: Pattern not found: var \(.*\) : \(.*\) = \(.*\);

As Karthick says, try an incremental search first. Make sure hls is set first, 
though, or you won't be able to see the matched text as you compose the regex.

My other question, is it possible in Vim to enter all of these commands at
once, rather than 1 at a time for each file I want to convert?

Separate them with a bar, eg.:

%s/var \(.*\) : \(.*\) = \(.*\);/\2 \1 = \3;/g | %s/var \(.*\) : \(.*\);/\2 
\1;/g | etc...

If you want to do it across multiple files, have a look at :help bufdo and 
tabdo.

--

.

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