VI Cheetsheet: Difference between revisions
m added Category:Tools using HotCat |
adds commenting/uncommenting in visual block mode |
||
Line 1: | Line 1: | ||
<html> | <html> | ||
<p>This document is a <b>vi</b> cheat sheet, designed to be kept | <p>This document is a <b>vi</b> cheat sheet, designed to be kept | ||
Line 644: | Line 643: | ||
</html> | </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]] | [[Category:Tools]] |