The most commonly used vim linux command record

First to a map to know three modes:

First, enter the vim command, enter the command mode

At this executable:

1, the display line number

(1): set nu number display line of text;: nonu cancel the display line number

2, the cursor

(1) n <Enter>: n rows moved downwardly

(2) n <space>: right by n characters of the current row

3, search and replace

(1) Input / word: find the location under the cursor word string
(2) Enter the word:? Find the cursor on the word string position
(3) / word with n (backward) and N (forward) command Find keywords

4, delete, copy and paste

(1) dd: delete an entire cursor line; ndd, delete n rows down cursor line

(2) yy: a line where the cursor is copied; nyy: Copy n lines down cursor line

(3) p: paste from the start of the next line cursor. Example: starting from the current row 21 on line 20 the contents, paste

(4) P: Paste starts from the row where the cursor is. Example: The current line 20, the next line after the paste had finished line content

(5) No .: point, repeat action

Second, the input mode is switched to the command mode

At this executable:

i: from the current cursor at the start input, the following prompt appears --INSERT--

[Esc]: to exit back to the command mode

Special Note: General editing commands to edit the configuration file, in order to prevent errors, try to use the i command to enter the edit

Third, in the end line command mode switching command mode

At this executable:

(1): w: save the edited data;: w: Save system!

(2): q: quit;:! Q: forced to quit without saving the document

(3): wq: Save and exit;: wq: Save the forced exit!

(4) ZZ: If the file does not change, leave not saved, if the file has been modified, save to leave!

Guess you like

Origin www.cnblogs.com/yb38156/p/11220774.html