The following conventions are used in this reference. A single character, such as 'a' or '1'. ,  Indicates that the Escape (Esc) key on your keyboard should be pressed, which is identical to Control and '['. Indicates that the Carrier Return (Enter) key should be pressed. Indicates that the Tabulator key should be pressed ,  Indicates that the Control key and the 'x' key should be pressed simultaneously. 'x' can be almost any other key on your keyboard. , ,  Indicates that the Shift key and the 'x' key should be pressed simultaneously ,  Indicates that the Meta or Alt key and the 'x' key should be pressed simultaneously. :quit, :q An Ex command. started with <:>, followed by the command and ends with . For many Ex commands there is a long form (:quit) and a short form (:q). :set nocompatible represents a setting. strlen () represents a function. /pattern/, ?pattern? A Search pattern. Search pattern in vi are regular expressions. :ranges/search/replace/options, :global /pattern/ delete A Search pattern combined with an Ex command. All commands in vi are case sensitive. vi can be set up on most systems to use the keyboard movement buttons, such as cursor left, page up, home, delete, etc. All insert commands put vi into insert mode. Insert mode is terminated by the ESC key. Each time a delete command is used, the deleted text is placed into the buffer, replacing any text already in the buffer. Buffered text can be retrieved by p or P. The change commands all select text to be removed, the end of which is indicated by a $. Insert mode is entered and new text overwrites or extends the text. When the  key is pressed to terminate the insert, any remaining original text is deleted. Text deleted during a change is placed into the buffer, replacing any text already there. Buffered text can be retrieved by p or P. The yank commands copy text into the vi buffer. Text is also copied into the buffer by delete and change commands. The put or place commands retrieve text from the buffer. Searching uses regular expressions. Search and replace uses regular expressions and the Ex command :substitute (short :s) which has syntax similar to the sed utility - which is not surprising sed, Ex and w:Vi have common roots - the Ed editor. The following meta-characters have special meaning in the replacement pattern: For example . :s/\(foo\) \(bar\) \(baz\)/\u\1 \U\2\E \3/ could match the string foo bar baz and substitute Foo BAR baz for it. Marked lines can be used when changing or deleting text. All options are ex options, and so require an initial colon. Default options may be placed into a file in the user's home directory called .exrc. Options in this file do not have the initial colon, e.g. set ic ex commands start with :, which puts vi into last line mode, entered on the last line of the screen. Spaces within the command are ignored. These commands edit lines and have the following syntax: No line number, meaning work on the current line. With %, meaning work on all lines. A pair of line numbers, such as '3,5' meaning work on lines 3 to 5 inclusive. Either number can be replaced with ., standing for the current line or $ standing for the last line. So .,$ means from the current line to the end of the file and 1,$ means the same as %. Additionally simple arithmetic may be used, so .+1 means the line after the current line, or $-5 means 5 lines before the last line. vim Official Reference Manual An introduction to the vi editor Learning Unix in 10min
{'wiki_source': 'wikibooks', 'other_info': "{'content_model': 'wikitext', 'language': 'en', 'title': 'Learning the vi Editor/vi Reference', 'type': 'text'}"}