Vim (the Vi-IMproved Editor) is the Unix text-editor of choice. It was originally released to the public in 1991, making it more than twenty years old, and yet is still one of the most popular text editors among people who learn Linux, especially programmers and system administrators.
Vim is notable for a number of reasons:
- It is available on virtually every Linux system ever. (Run 'vim' at your terminal to use. If not, try 'vi'.)
- It is relatively light-weight: it's big competitor for the Greatest Text Editor Ever, emacs, has a vim plugin. It is often joked that emacs is a fine operating system, but sooner or later you'll need a vim-plugin to edit text on it.
- It is a modal editor: unlike most text editors, it has a number of different modes. The most important are Edit Mode (where you copy, paste, indent, delete and generally move around your text), and Insert Mode (where you actually type text.
- It is infamously cryptic.
Command Line Mode:Edit
This is the mode in which vim commands can be entered to be intpreted by vim, it can usually by entered by hitting the escape key then the : key.
- w - Save File
- q - Quit Vim
- wq - Save the File and quit vim.
- q! - Do not save the file and quit vim
- ab - make a abrevatition - SYNTAX: :ab mario Super Mario (make a abbrevation for mario, and have it be replaced with Super Mario)
In this mode text data can be entered into a file like any other text editor, you can enter insert mode by pressing the i, insert, or s key. If abbrevations were made with the :ab command, then you can press space after the abbrevation has been eneterd to repace it with the full word.
In this mode commands can be used to perform specfic text operations in vim, ex. delete 3 words from a line, It can be used during insert mode by pressing the esc key then using the command followed with the options you want to perform, commands can be combined to do diffrent kinds of things.
dw - delete a word
dd - delete a whole line
$- Move to the end of a line
v - seletect text word by word
V- select text line by line
y - "yank" into the current buffer (copying the text)
p - Paste before the cursor
P - paste after the cursor