Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > map not working

Reply
Thread Tools

map not working

 
 
googler
Guest
Posts: n/a
 
      08-14-2007
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
( 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.

 
Reply With Quote
 
 
 
 
googler
Guest
Posts: n/a
 
      08-14-2007
On Aug 13, 7:21 pm, googler <(E-Mail Removed)> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
std::map::find() throws exception when map is empty? Matthias Hildebrand C++ 5 03-20-2012 06:09 AM
Re: hashtable or map? (map inserts not behaving as I expect - and I cant find a decent simple example for hashtable) Kai-Uwe Bux C++ 1 12-21-2008 09:25 PM
suprised by destructive map (not map!) Boris Schmid Ruby 8 12-14-2007 11:41 AM
I can map all files (.*) to asp.net worker.How do I map NO FILE to asp.net worker? alex ASP .Net 1 02-04-2005 03:18 AM
map that maps to iterators in the same map ? Vlad C++ 0 12-15-2003 08:29 PM



Advertisments