0

All the instructions I see say pretty much the same thing here

What's a quick way to comment/uncomment lines in Vim?

First, go to the first line you want to comment, press CtrlV. This will put the editor in the VISUAL BLOCK mode.
Then using the arrow key and select until the last line
Now press ShiftI, which will put the editor in INSERT mode and then press #. This will add a hash to the first line.
Then press Esc (give it a second), and it will insert a # character on all other selected lines.

When I pretty shift+I, the multiple highlighting of lines disappears, and all that happens is that it goes into regular insert mode at the first line only. When I type something, it's only typed on the first line.

I feel that there is a step missing, but I can't figure out what.

SantoshGupta7
  • 5,607
  • 14
  • 58
  • 116
  • 3
    After editing using `Shift-i`, you need to press `ESC` key! – weirdsmiley Aug 03 '20 at 19:59
  • 3
    "multiple highlighting of lines" in your comment suggests that you might be in `linewise-visual` mode by pressing `V` (`v`), as opposed to being in `blockwise-visual` mode by pressing `v`. Does the status message at the bottom of your screen say `-- VISUAL BLOCK --`? – dannyadam Aug 04 '20 at 03:00
  • @dannyadam thanks, that was my problem :) – maysara Oct 20 '22 at 19:24

0 Answers0