Vim commands
Vim text editor.
vim
vim is a popular command-line text editor
why vim?
-edit files on a remote server over ssh
-works without a graphical desktop environment
-many programming-specific features
-really fast editing
type vim
If that doesn’t work, install vim. sudo apt-get install vim vim-common to get vim plus extras like syntax highlighting.
In vim!
Type i to go into insert mode.
Now you can type normally.
Saving and quitting
Hit esc to get out of insert mode. Now type:
:w foo.txt
to save your file as foo.txt. You can go back into insert mode by typing i again or you can quit by typing:
:q
More commands.
Try :wq to save and then quit.
Try :q! to quit without saving.
Try :q quit (short for :quit)
Try :w save changes to file
Try :wq or :x write and quit (think write and quit)
Try :qa quit all (short for :quitall)
Try u undo
Try x delete character at cursor
Try I insert at beginning of file
Try a append at cursor
Try A append at end of line
Try excape exit insert mode
Moving around - hjkl
In insert mode, the arrow keys do work, but you should practice not using them! Instead, in command mode: h - moves left one character j - moves down one line k - moves up one line l - moves right one character
:help Show help about . You can use :help without a to get general help.
Source http://www.fprintf.net/vimCheatSheet.html
http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/