Tuesday, May 19, 2009

VIM : Comments lines with a pattern in a file

The lines in a file containing a specific pattern can be commented in VIM using the :g command.
:g command is used in following form

:g/JR/normal I //

Pattern : JR
Cmd : normal I //

"I" is used in VIM to start insert mode at the start of line and "//" is the comment character used in PHP.

Enjoy VIM. Check out the help :g if you have more questions.

No comments:

Post a Comment