Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jun 062013

Comment out multiple lines using vim


When you want to comment out multiple lines in a configuration file or a program script, it is easy with the help of vim.


1. Change to command mode
2. Enable visual block editing by pressing Ctrl + V
3. Select the line(s)
4. Press "I", enter the character you needed, e.g. "#"
5. Press "Esc", then "Enter"