Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Trying to prepend a # to all lines in a visual block by highlighting, I (shift - i) but only the first line changes (even after hitting esc)

This is the method I've found in a number of places including Vim: Seeing *all* lines change when inserting to a visual block

but it doesnt work for me. Do I need to change a setting or could I be doing something incorrectly?

edit: if it matters, GVIM on windows.

share|improve this question
I experience the same behaviour on linux ubuntu, since the last upgrade to 14.10. I dont have any weird windows like settings but the behaviour is the same, also if I prepend somethign else than # it works, but slow, i have to wait liek 3 seconds and if in this time i use arrows - the operation fails, only first line is prepended. Any ideas? – dimovnike Nov 19 '14 at 10:00
up vote 6 down vote accepted
  1. Enter VISUAL-BLOCK mode with <C-v>.
  2. Select all the lines you want to comment.
  3. Type I# to prepend the first line with # then hit <Esc> to exit VISUAL-BLOCK mode and apply your change to all the lines.

I think some people use GVim on Windows with a weird setting that makes its keyboard shortcuts more "Windows-like". If that's your case <C-v> might not work, try <C-q> instead.

  • :help visual-block
  • :help ctrl-v-alternative
  • :help v-b-i

You can obtain the same result without the benefit of a "preview" using the :normal command (:help normal):

  1. Enter VISUAL-LINE mode with <S-v>
  2. Select all the lines you want to comment.
  3. Type :normal I# then hit <CR> to apply your change to all the lines.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.