Open main menu

Changes

1,005 bytes added ,  13:30, 1 December 2016
adds commenting/uncommenting in visual block mode
 
<html>
<p>This document is a <b>vi</b> cheat sheet, designed to be kept
</html>
 
== To comment out blocks in vim: ==
 
* press <kbd>Esc</kbd> (to leave editing or other mode)
* hit <kbd>ctrl</kbd>+<kbd>v</kbd> (visual block mode)
* use the up/down arrow keys to select lines you want (it won't highlight everything - it's OK!)
* <kbd>Shift</kbd>+<kbd>i</kbd> (capital I)
* insert the text you want, e.g. '# '
* press <kbd>Esc</kbd>
 
Give it a second to work.
 
== To uncomment blocks in vim: ==
 
* press <kbd>Esc</kbd> (to leave editing or other mode)
* hit <kbd>ctrl</kbd>+<kbd>v</kbd> (visual block mode)
* use the up/down arrow keys to select the lines to uncomment.
 
*If you want to select multiple characters, use one or combine these methods:
** use the left/right arrow keys to select more text
** to select chunks of text use <kbd>shift</kbd> + left/right arrow key
** you can repeatedly push the delete keys below, like a regular delete button
 
* press <kbd>d</kbd> or <kbd>x</kbd> to delete characters, repeatedly if necessary
 
* press <kbd>Esc</kbd>
 
Give it a second to work.
[[Category:Tools]]
4,558

edits