<p dir="ltr">If you haven't already, try out a commenting plugin like nerdcommenter or tcomment. They both install with pathogen/vundle and work on lots of different file types, not just Perl.</p>
<p dir="ltr"><a href="https://github.com/scrooloose/nerdcommenter">https://github.com/scrooloose/nerdcommenter</a><br>
<a href="https://github.com/tomtom/tcomment_vim">https://github.com/tomtom/tcomment_vim</a></p>
<div class="gmail_quot<blockquote class=" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><table cellspacing="0" cellpadding="0" border="0"><tr><td valign="top" style="font:inherit">I think the user is looking for shift-v.  In UNIX vim, ctrl-v is literally block mode where a rectangular select area can be selected and worked upon.  shift-v selects entire lines.  In Windows vim I type ctrl-q for block selection, instead of ctrl-v, but I think this is an optional mapping I had to add to the config.  I believe the user is referring to the shift-v mode to select lines.  Also, just v works as well for selecting from a point in a line to another point, regardless of square blocking or line blocking.<br>
<br>During a selection, just enter : to start editing a command.  Any operations can then be performed on the selected area using replace, but the markers for the start and end of the selected area are '< and '> ,  So, search and replace like the following works to put a comment at the start of the
 line:<br><br>:'<,'>s/^/# /<br><br>More advance things work like '<,'>s/foo/bar/g and multiple changes can be stitched with pipes like:<br><br>:'<,'>s/^/# / | '<,'>s/foo/bar/g <br>
<br>However, if a piped regex fails to match anything, the regexes in the list after the non-matching select are not executed.<br><br>Also, as far as 'two book marks', that works too, just like line numbers:<br><br>
:'a,'bs/^/# /<br><br>Where, a user wants all lines from mark a to mark b prepended with an octothorpe and a lacuna.<br><br>All these work in normal Vim.  Vim also supports variables in regexes, like perl.  But, instead of parens in order to block a save for reuse, backslashes are necessary before the open parens and the close parens.  Regular VI also normally supports the mark changes, eg 'a,'b, but not visual selections.<br>
<br>Or, did I lose track, and this is a syntax discussion for Perl-vim which I've never
 used?<br><br>      Andy<br><br>--- On <b>Fri, 2/22/13, Matthew Musgrove <i><<a href="mailto:mr.muskrat@gmail.com" target="_blank">mr.muskrat@gmail.com</a>></i></b> wrote:<br><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px">
<br>From: Matthew Musgrove <<a href="mailto:mr.muskrat@gmail.com" target="_blank">mr.muskrat@gmail.com</a>><br>Subject: Re: [DFW.pm] Not only was Patrick right, but Vim backs him up...<br>To: <a href="mailto:dfw-pm@pm.org" target="_blank">dfw-pm@pm.org</a><br>
Date: Friday, February 22, 2013, 11:27 PM<br><br><div><div dir="ltr">My mistake. Ctrl-v.<br></div><div><br clear="all"><div>Matt</div>
<br><br><div>On Fri, Feb 22, 2013 at 10:59 PM, Matthew Musgrove <span dir="ltr"><<a rel="nofollow" href="http://mc/compose?to=mr.muskrat@gmail.com" target="_blank">mr.muskrat@gmail.com</a>></span> wrote:<br><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div dir="ltr"><div>Going from memory but sounds right...<br><br>Position your cursor on the first character of the first line to comment out. Press 'v' to go into visual character mode. Position your cursor on the first character of the last line to comment out. Press 'I' to enter insert mode. Press '#' followed by 'ESC'. Done.<br>



</div></div><div><br clear="all"><div>Matt</div>
<br><br><div><div><div>On Fri, Feb 22, 2013 at 10:29 PM, Tommy Butler <span dir="ltr"><<a rel="nofollow" href="http://mc/compose?to=masterbucket@internetalias.net" target="_blank">masterbucket@internetalias.net</a>></span> wrote:<br>



</div></div><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div><div>Yes, that is definitely handy.<br>
<br>
But is there some easier way to do block commenting that doesn't consume two bookmarks? I find myself doing it based on line numbers, but it hasn't irritated me enough to look up a better way yet...<br>
<br>
-- <br>
Tommy Butler<br><br><div>kevin <<a rel="nofollow" href="http://mc/compose?to=kbrannen@pwhome.com" target="_blank">kbrannen@pwhome.com</a>> wrote:<blockquote style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<pre style="white-space:pre-wrap;word-wrap:break-word;font-family:sans-serif;margin-top:0px"><div>On 02/21/2013 05:30 PM, Tommy Butler wrote:<br><blockquote style="margin:0pt 0pt 1ex 0.8ex;border-left:1px solid #729fcf;padding-left:1ex">



What does your .vimrc look like?  I always like to see what goodies<br>there are to be found in the .vimrc files of fellow Perl hackers :-D</blockquote><br>Something I've done for a long time in my .vimrc and find useful is:<br>



<br>map ,c :'a,'bs/^/#/<br>map ,u :'a,'bs/^#//<br><br>Then I can mark a range of lines with 'a and 'b, then hit ,c and the <br>range is commented out. Similarly, ,u uncomments a range of lines.<br>



<br>Kevin<br><hr><br></div><div>Dfw-pm mailing list<br><a rel="nofollow" href="http://mc/compose?to=Dfw-pm@pm.org" target="_blank">Dfw-pm@pm.org</a><br><a rel="nofollow" href="http://mail.pm.org/mailman/listinfo/dfw-pm" target="_blank">http://mail.pm.org/mailman/listinfo/dfw-pm</a><br>



</div></pre></blockquote></div><span><font color="#888888"><br>
-- <br>
Sent from my Android phone with K-9 Mail. Please excuse my brevity.</font></span></div></div><br></div></div>_______________________________________________<div><br>
Dfw-pm mailing list<br>
<a rel="nofollow" href="http://mc/compose?to=Dfw-pm@pm.org" target="_blank">Dfw-pm@pm.org</a><br>
<a rel="nofollow" href="http://mail.pm.org/mailman/listinfo/dfw-pm" target="_blank">http://mail.pm.org/mailman/listinfo/dfw-pm</a><br>
<br></div></blockquote></div><br></div>
</blockquote></div><br></div>
</div><br>-----Inline Attachment Follows-----<br><br><div>_______________________________________________<br>Dfw-pm mailing list<br><a href="http://mc/compose?to=Dfw-pm@pm.org" target="_blank">Dfw-pm@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/dfw-pm" target="_blank">http://mail.pm.org/mailman/listinfo/dfw-pm</a><br>
</div></blockquote></td></tr></table><br>_______________________________________________<br>
Dfw-pm mailing list<br>
<a href="mailto:Dfw-pm@pm.org">Dfw-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/dfw-pm" target="_blank">http://mail.pm.org/mailman/listinfo/dfw-pm</a><br>
<br></div>