Giving these 2 substitution commands in vim:
%s/}$/\r}\r/g
%s/^\s*([a-zA-Z\#\.\:\s\(\)-\[\]'=]*)\s*\{/$1 \{/g
I have 2 questions:
- How can I join 2 substitution commands in a one line command ?
- Is there a better regex command to make this a oneliner ?
I know I could make a function with both commands, but I'm in Eclipse VRapper not in Vim itself. AFAIU I can't have functions in it.
Edit
That question suggested doesn't solve the problem, because these substitutions should be made one after the other. They convert a compiled sccs from nested to expanded output style. It's not just two occurences that can be substituted in text.
What I would like in the first question is something like this PHP code:
$w = "Hi Planet!";
echo str_replace("Hi", "Hello", str_replace("Planet", "World", $w));
// result: Hello World!
s/.../.../
command is wrong. I presume it's inspired by Perl regexps, but it would be wrong even in Perl. Either way, it has nothing to do with Vim. Read:h regexp
and:h :substitute
to learn about Vim syntax.