why can't I comment lines in visual mode

Posted by Haiyuan Zhang on Stack Overflow See other posts from Stack Overflow or by Haiyuan Zhang
Published on 2010-03-12T09:05:31Z Indexed on 2010/03/12 9:07 UTC
Read the original article Hit count: 353

Filed under:

I want to comment several lines in my .vimrc, the usual way I do it is :x,ys/^/"/ and x stands for the start line number and y stands for the line number of the last line. I read some post which said in visual mode this task can be done by the following step:

1 Select your lines with VISUAL BLOCK

2 press I to insert before all highlighted lines.

3 type your comment charact , in this case should be "

4 then ESC

I fllowed the above steps and met met problems in step 2 . the thing is when I select the lines in Visual mode and press I , vim ( I use version7.2) go back to insert mode and the cursor back to the start of the first line. so if you continue to do the step 3 and step 4, you end up in just inserting " at the start the first line , far from what I want to achieve.

so could you point out what's wrong with the recipe ? thanks in advance

© Stack Overflow or respective owner

Related posts about vim