vi instruction Command mode: yy: copy the line where the cursor is located 4yy: Copy the 4 lines down from the line where the cursor is located p: paste dd: cut the line where the cursor is located 2dd: Cut the line where the cursor is located 2 lines down D: Cut from the current cursor to the end of the line d0: cut from the current cursor to the beginning of the line x: delete the current cursor, only one at a time X: delete the one in front of the current cursor, only one at a time h left j down k up l right H: the top of the current screen M: the middle of the current screen L: the bottom of the current screen ctrl+f---> page down one page of code ctrl+b---> turn up a page of code ctrl+d--->page down half a page of code ctrl+u---> turn up half a page of code 20G: Quickly locate the second line of code G: Quickly return to the last line of the entire code gg: quickly go back to line 1 of the entire code w: skip backward by the length of a word, that is, adjust to the beginning of the next word b: skip forward the length of a word, that is, adjust to the beginning of the previous word u: undo the operation just now ctrl+r: reverse undo select a piece of code v: V: >>: move code to the right <<: move code to the left .: Repeat the last command r: replace a character R: replace the cursor and the following characters shift+zz: equivalent to wq Last line mode: w: save q: quit wq: save and exit