General mode: Delete, copy and paste the class command x,x x to remove a character backwards, X for a character that was previously deleted, NX (n represents a number) to remove the N characters back to the DD delete when Move forward D Delete all the characters in the current line, try to be empty row NDD (n for number) Delete the row of the cursor in the Down n column d1g Delete all data from the row to the first row of the cursor DG Delete all data from the row to the last line of the cursor YY copy cursor line y1g copy cursor row to first row all data YG Copy all data Ynj (n for number) on the line to the last row of the cursor, n+1 line down DNJ (n for number) Delete cursor row down n+1 row p,p P Pastes the copied data on the next line of the cursor, and p pastes the copied data on the top line of the cursor J combines the data from the row of the cursor with the next row to a single line U redo the previous action (undo)
Second, edit mode command i,i I to insert the input text at the current cursor, I for the first non-null character in the line of the cursor insert the input text a,a A for the next character at the current cursor insert the input text, a Inserts the input text for the next word prompt the last character of the line in which the cursor is located o,o o to insert the character at the beginning of the line at the start of the row where the cursor is, o to insert the character at the beginning of the line at the beginning of the row of the cursor r,r R to replace The character where the cursor is located, R is the text that is always replaced by the cursor until exit ESC exits, back to normal mode
Three, Command mode h cursor moves left one character J Cursor moves down one character K cursor up one character l The cursor shifts one character to the right ctrl+f screen down one page ctrl+b screen up one page ctrl+d screen down half page ctrl+u Screen up half page + cursor moves to the first non-null character of the next line-the cursor moves to the first non-empty character of the current line n space (n = number) The cursor moves right to the current line N characters 0 (number 0) the cursor moves to the first character of the current line (can be a null character, note and-differentiate) $ the cursor moves to the last character of the current line (can be a null character, Note with-differentiate) H the first non-null character of the line that the cursor moves to the top of the current screen m cursor moves to the first non-empty character of the line in the middle of the current screen The first non-null character of the line that the cursor moves to the bottom of the current screen the G cursor moves to the first non-empty character of the last line of the article Ng (n represents a number) the cursor moves to the first non-null character of the nth line of the article n The cursor moves down from the current line to the first non-empty character of the n row/word the word string after the cursor? Word looks for word strings before the cursor: s/w Ord1/word2/g the current line of the cursor to find word1, and replace the word2:n1,n2s/word1/word2/g between the line N1 and the N2 line to find Word1, and replace word2:%s/word1/word2/g The entire article looks for word1 and replaces it with WORD2:W Save the edited data to a hard disk file: w [filename] saves the edited data to another file on the hard disk: R [FileName] when you edit the data, it is read into another file. Data, add the contents of the filename file to the line next to the cursor: WQ or: X Save and exit: Q Exit, applies to unmodified files: q! Force quit, apply to modify file after not save exit: Set Nu Display line number: Set Nonu cancel line number: n1,n2 w [filename] save N1 to N2 row to the name Filena Files in me
Linux VI, vim command Daquan