Vi:visual Interface---------------------- full screen editor, modal editor
Vim:vi IMprove
Vim mode: |
Edit mode (Command mode) Input mode Last-line mode |
Mode conversion:
Edit → Input |
Input → edit ← last line |
Edit → last line |
i: input before the cursor a: input after cursor o/o: New Line input I: Input at the beginning of line A: End of line input |
Esc
|
:
|
Vim shortcut key:
Open file: default to edit mode |
Close file in the last row mode |
# Vim Filenwme +N: Open file and position on nth row +: Open file, navigate to last line +/pattern: Open the file and navigate to the beginning of the line that was first matched to the pattern |
:q: Exit :w: Save :wq! : Forced exit |
Move cursor (in edit mode) |
H : Left L : Right J : Under # h/l/j/k: Move the # characters |
W : Move to the beginning of the next word e : Jumps to the ending of the current or next word B : Jumps to the beginning of the current or previous word # w/e/b: Moving # words |
in-line jump: 0 : Absolute beginning of line (including whitespace characters) ^ : The first non-whitespace character of the beginning of the line $ : Absolute end of row |
interbank jump: #G : Goto # line G : Last line Last line mode, directly to the travel number can jump |
Flip Screen: CTRL +F: Turn down one screen Ctrl +B: Turn up one screen CTRL +D: Flip down half Screen Ctrl +u: flip up half screen |
Delete a single character x: Delete a single character at the cursor location #x: Delete the cursor and the backward # characters |
Delete command: d (Copy command: y ------------------usage with D ) |
d command combined with jump command # D Jump character: #dw, #db DD : Deletes the row (clipping) of the current cursor # DD : Delete the # line (cut) that includes the line where the current cursor is located |
in the last row mode: : startadd,endadd D . : Represents the current row $ : last line + #: Down # line |
Paste command: P P: If the deleted or copied content is a whole row, paste it above the line where the cursor is located, or paste it in front of the character that the cursor is in. P: If the deleted or copied content is a whole row, paste to the bottom of the line where the cursor is located, or paste to the back of the character where the cursor is located |
Modify: Delete content first, then convert to input mode C: Use same as D command |
Replace:
R: cursor specifies character, #r + character to be substituted (#代表将其及后 # word nonalphanumeric replace) R: Enter replacement mode |
Undo U Edit Operation: Undo u: Undo the previous edit operation, continuous u can be continuously revoked (upper 50) #u: Undo Recent # edits directly Undo the most recent undo operation: Ctrl +R |
Repeat the previous edit operation: . |
Visualization mode: (select target, perform action) v: Select by character V: Select by rectangle |
Find:/pattern,? PATTERN, N, N |
Find and Replace: Use the S command in the last-line mode : addr1,addr2s/pattern1/pattern2/g |
Vim Editor Detailed