Friday, 12 April 2013

Comment specific lines in VI editor

To Comment specific lines in VI Editor:

syntax:

:x,y s/^/#/g

x,y -> starting and ending line numbers.

^ -> points to line's begning

# -> usual way to comment in vim

Example:

:450,500 s/^/#/g

(or)


:.,+10 s/^/#/g

. is current line

+10 is ten lines from the current.

No comments:

Post a Comment