map not working

map not working

am 14.08.2007 02:21:42 von googler

I am trying to create map for the operation I am going to explain. I
have some code like this:

`ifdef FUNCTIONAL
blah1
blah2
blah3
`else
blah4
blah5
blah6
`endif

I want to change it to:

//`ifdef FUNCTIONAL
// blah1
// blah2
// blah3
//`else
blah4
blah5
blah6
//`endif

I define my map as follows:
:map v /`ifdef[CTRL-V][ENTER]ma/`else[CTRL-V][ENTER]mb'a:.,'bs/^/\/ \//
[CTRL-V][ENTER]/`endif[CTRL-V][ENTER]I//[CTRL-V][ESC][ENTER]

the above can be broken down into the following steps:
(1) /`ifdef[CTRL-V][ENTER] => search for `ifdef
(2) ma => mark the line as a
(3) /`else[CTRL-V][ENTER] => search for `else
(4) mb => mark the line as b
(5) 'a => go back to line marked as a
(6) :.,'bs/^/\/\//[CTRL-V][ENTER] => add // at the start of lines
from a to b
(7) /`endif[CTRL-V][ENTER] => search for `endif
(8) I//[CTRL-V][ESC] => add // to the start of this line

When I try to execute this sequence by placing the cursor just above
from where the block starts and pressing v, I do not get the desired
change. Instead it shows the message:
E488: Trailing characters

However, if I execute the commands manually one after the other, it
works fine. Please point out if you can see the error. Thank you.

Re: map not working

am 14.08.2007 02:24:52 von googler

On Aug 13, 7:21 pm, googler wrote:
> I am trying to create map for the operation I am going to explain. I
> have some code like this:
>

Extermely sorry.. I posted in the wrong group. My apologies.