Monday, January 23, 2012

Add comments using VIM editor

Very Useful VIM editor trick ,,,,,,,,,,,,,,,,

To add comments easily to any code

First Press Ctrl+v to start the visual mode from a particular location then select the needed characters using arrow button

Second Press I to enter into a special insert mode to input characters like '//' and Press Esc.

Now the inserted character will appear in all the selected lines.

To remove this first character again select the needed characters and Press 'd' to remove it.

Another form to add words at the end of each selected lines Press 'A' append, then add words and press Esc

If we press $ the whole line will be selected.

Some more short-cut keys in command mode(Press Esc).
yy - copy
p - paste
d - to cut

No comments:

Post a Comment