Summary of common vim usage
Vim is basically the same as vi in usage. vim is more powerful and has color labels. Vim has three modes: general mode, edit mode, and command mode. Normal Mode: delete, copy, and paste x: delete backward X: delete forward nx: delete n characters dd: delete when Row D: delete when row ndd: delete n rows down the current row yy: copy the row where the cursor is located p: paste the copied data to the next row P of the cursor: paste the copied data to the top row of the cursor editing mode: I: insert character I at the position of the cursor: insert the input character a at the first non-empty position of the row where the cursor is located: enter character A at the next position of the current cursor: Enter character o at the last position of the cursor row: Enter character O at the first position of the next line of the cursor row: enter the character r: Replace the character esc: Exit edit mode command mode h: move the cursor to the left one character j: move the cursor down one character k: move the cursor up one character l: move the cursor right one character ctrl + f: Turn the screen down one page ctrl + B: Turn the screen up one page gg: the first line of the document G: the last line of the document nG: move the cursor to n rows/word: Search for word after the cursor? Word: Search for word s/word1/word2/g before the cursor: the row where the current cursor is located. Replace word1 with word2 n1, n2s/word1/word2/g: replace all word1 from line n1 to line n2 with word2 u: Roll Back q: Quit q!: Force exit wq: Save and exit set nu: Display row number