Vi: Difference between revisions
Development;Tools |
No edit summary |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
=== Learning VI === | === Learning VI === | ||
It's known for a relatively steep learning curve - because there are an unbelievable number of options for VI, but you can get by with a few basic commands (see below for the cheatsheet). | It's known for a relatively steep learning curve - because there are an unbelievable number of options for VI, but you can get by with a few basic commands (see below for the cheatsheet). | ||
| Line 19: | Line 18: | ||
=== Resources === | === Resources === | ||
* Vim wiki http://vim.wikia.com/wiki/Main_Page | * Vim wiki http://vim.wikia.com/wiki/Main_Page | ||
* https://vimhelp.appspot.com/quickref.txt.html An HTML collection of the vim help, quickref and other info. | |||
=== Configuration === | === Configuration === | ||
| Line 28: | Line 28: | ||
For an example of setting up additional syntax highlighting, see [[Syntax Highlighting]] | For an example of setting up additional syntax highlighting, see [[Syntax Highlighting]] | ||
=== [ | === [[VI Cheetsheet]] === | ||
* Esc - Escape to view-only mode. Press ''Esc'' before using the following commands to get out of whatever mode you're already in. | * <kbd>Esc</kbd> - Escape to view-only mode. Press ''Esc'' before using the following commands to get out of whatever mode you're already in. | ||
* i - Enter insert mode. Place the cursor where you want to type and press ''i'' before typing. | * <code>:w !sudo tee %</code> force write file using sudo to 'tee' the standard output to the file descriptor | ||
* x - Delete the character under the cursor. | * <kbd>i</kbd> - Enter insert mode. Place the cursor where you want to type and press ''i'' before typing. | ||
* dd - Delete the current line. | * <kbd>x</kbd> - Delete the character under the cursor. | ||
* :q! - Quit | * <code>dd</code> - Delete the current line. | ||
* :wq - Save and Quit | * <code>:q!</code> - Quit | ||
See | * <code>:wq</code> - Save and Quit | ||
See our [[VI Cheetsheet]] or http://www.eec.com/business/vi.html for more | |||
=== VI Improved === | === VI Improved === | ||
On modern systems vim is actually the package that is installed because it succeeds the predecessor 'vi' There are many other vim-related packages. Check if vi is a symbolic link to vim (<code>file `which vi`</code>), and if not then <code>sudo apt-get install vim</code>. | On modern systems vim is actually the package that is installed because it succeeds the predecessor 'vi' There are many other vim-related packages. Check if vi is a symbolic link to vim (<code>file `which vi`</code>), and if not then <code>sudo apt-get install vim</code>. | ||
[[Category:Development]] | |||
[[Category:Tools]] | |||