Vim a.txt Open a file a.txt
Enter some text into vim
Enter vim or the command state must press I "" I a A or isert to enter the editing state
Save Exit Esc Enter command status input : EQ Save exit
Do not save forced exit: q!
Set Nu sets line number
/xx Find xxx, press N to find the next, press N to find the previous one.
? text find text, reverse lookup, press N to find the next, press N to find the previous one.
There are some special characters in vim that need to be escaped when searching. *[]^%/?~$
: Set ignorecase ignores case-finding
: Set noignorecase does not ignore case-finding
Look for long words, if a word is very long, type trouble, you can move the cursor to the word, press the * or the # key to be able to search the word, equivalent/search. and the # command corresponds to a search.
: Set Hlsearch Highlight search results, all results are highlighted instead of just one match.
: Set Nohlsearch Close Highlight search display
: Nohlsearch turns off the current highlight, and if you search again or press N or N, it will be highlighted again.
: Set Incsearch stepwise search mode to search for characters that are currently typed without waiting for typing to complete.
: Set Wrapscan re-search, when searching to the head or end of the file, return to continue the search, by default open.
U undo (undo)
U undo the operation of the whole row
Ctrl + R Redo (Redo), that is, undo revocation.
Delete command
X Delete Current character
3x Delete current cursor start backward three characters
X deletes the previous character of the current character. X=dh
DL Delete current character, dl=x
DH Deletes a previous character
DD Delete When moving forward
DJ Delete Previous Line
DK Delete Next Line
10d deletes 10 rows from the beginning of the current line.
D Delete the current character to the end of the line. d=d$
d$ Delete all characters after the current character (bank)
KDGG all rows before the current row is deleted (excluding the current row)
JdG (JD Shift + G) deletes all rows after the current line (excluding the current row)
: 1,10d Delete 1-10 rows
: One, $d delete 11 rows and all subsequent rows
: 1, $d delete all rows
J (Shift + J) Deletes a blank line between two rows, in effect merging two rows.
VIM Operation Daquan