VIM multi-line inserts making me crazy

Steve Seremeth blu_discuss at seremeth.com
Wed Jun 15 11:01:47 EDT 2005


I'm a long time vi/vim user who is having one nagging problem that I'm 
hoping you can help me with:

multi-line inserts of characters in visual mode

Scenario:
<C-V>
Use arrows (or "j") to pick your lines
if I hit "I" at this point, it kicks me out of visual mode and has me 
inserting on the first line of the block.
In my particular case (and please no space vs. tab flame wars), I want 
to insert a couple spaces -- but the same should apply if I want to 
comment the code, too with slashes, pounds, what have you.

I can do search and replace in the block like so:
<C-V>
Use arrows (or "j") to pick your lines
:s/^/#/  (which turns into: ":'<,'>s/^/#/")
<enter>

But then vim matches the beginning of every line in the file as noted by 
the blinding yellow highlighted line I get up the side of my terminal.  
If I wanted to indent using tabs, I would highlight the block and then 
use ">" -- and I know I can define tab/space settings in my .vimrc, 
etc..  Is that my best option?  That doesn't cover me when I want to 
insert comment chars.

Am I overlooking something (as I'm guessing I am)?

TIA -

Steve



More information about the Discuss mailing list