Several editing modes of Vim
- Normal mode: You can use the shortcut key command, or press: To enter the command line.
- Insert mode: You can enter text, in normal mode, press I, A, O and so on can enter the insertion mode.
- Visual mode: Press V in normal mode to enter the visual mode, in the visual mode, move the cursor to select text. Press V to enter the visual row mode, which is always selected for the entire row. CTRL + V enters the visual block mode.
- Replace mode: In normal mode, press R to enter.
Movingh or BACKSPACE: Move left one character;L or space: move one character to the right;J: Move down one line;K: Move up one line;e move back one word to stay at the endb move forward a word to stay at the end^: Move to the first non-whitespace character of the bank. $: Move to end of lineGG: To the head of the file. G: To the tail of the file. Flip Screenctrl+f: Turn down one screen. ctrl+b: Turn up one screen. n%: The location of the file n%. Insert CharacterI: Inserting before the cursorI: The first non-empty word match either inserted in the current line;A: Insert after the cursor;A: Insert at the end of the current line;o: Insert a new line below;O: Insert a new row above; Overwrite charactersc[n]w: Overwrites 1 (n) words after the cursor. C[n]l: Overwrites n letters after the cursor. C[n]h: Overwrites the first n letters of the cursor. Paste Copyyy or Y: Copies the entire line of text. y[n]w: Copy one (n) word. p: Copy Find/something: Find something in the text that follows. something: Look for something in the previous text. N: Look backwards for the next. N: Look forward to the next. block operations are divided into Word, row, and column 3 ways1. Word: Instruction V, then add the arrow keys (H, J, K, L) or the other four direction keys2. Line: Instruction V, then add the arrow keys (H, J, K, L) or the other four direction keys3. Column: Instruction Ctr+v, then add the arrow keys (H, J, K, L) or the other four direction keys column mode uses1. Enter the column mode: Ctrl + V,2. Select the area block: The move operation can be used to select. 3. Column operations: Delete d (delete operations such as x), replace C, insert Shift+i (i). 4. Operation function column: Press two times ESE screen segmentation, Comparison1.vim-o file1 file2: Split the window horizontally while opening file1 and File22.vim-o file1 file2: Split the window vertically while opening file1 and File23.vimdiff file1 file2 Typesetting<< Indent One shiftwidth to the left>> Indent One shiftwidth to the rightIf you press N first, then double-click, the n line below the cursor is indented. corresponding, press two <;, the line where the cursor is indented.
Common operations for VIM