I have been working with vim for 4 weeks and I am wondering how to do this:
I wanted to comment a code in ruby adding a ‘#’. I could do a ‘.’ for all lines. But what if I have a lot of lines to comment?
Is there some command I can do to do it on a block?
Not: This doesn’t mean only for putting a ‘#’.
You can do visual block mode. ctrl+v at the beginning of the line then move the cursor down as many lines as you want to comment out, hit shift+i then # then escape and it will put a # in front of all those lines. Personally I use tComment. There’s lots of plugins available for comment handling.
http://www.vim.org/scripts/script.php?script_id=1173