Ctags
Built-in CTAG plug-in VIM
Run $ ctags-R in the current project directory shell to recursively generate a tags file in the current directory
Run: Set tags = tags // in VIM to specify the current directory as the file to be read
Run: version in VIM to view a lot of information about Vim itself.
The sequence in which Vim reads the vimrc configuration file. When Vim is opened, the user vimrc is searched in the above sequence, and the commands in the first user vimrc are executed, ignoring other users vimrc. In vimrc, it is actually executed in sequence.
If you use the "vim-U filename" command to start vim, the specified filename will be used as the vim configuration file (useful when debugging your vimrc );
If you use the "vim-u NORC" command to start vim, you will not read any vimrc file: If you suspect that your vimrc configuration is incorrect, you can skip vimrc execution in this way.
View the tags file. You can see that the file locates functions and variables in each file. If no, it cannot be found.
Use ctags:
CTRL +] Jump to the specified function
CTRL + T and CTRL +] commands are opposite
: Tags can display jump depth details such:
2. Vim shortcut
": Tag func_name" jumps to function func_name. When using the tag command, you can use the tab key to perform matching search and continue to switch down by pressing the tab key.
Vim shortcut:
% Jump to the matching brackets ("{}" "[]" "()"). It can also match if Else.
CTRL + I, Tab jump to the next hop
CTRL + O jump to the previous hop point
# Search for the entire keyword from the cursor (exact match search)
G # You can find the words that contain it.
* Only search for words exactly matching the current word
G * search for all words that contain the current word
W jump to the start of the next word
E. Jump to the end of a word.
B Jump backward
R: Replace the character at which the cursor is located.
R: Replace the character wherever the cursor goes until you press the ESC key.
CTRL + G lists the positions and columns of the cursor
"." Repeat the previous Modification
CTRL + R opposite to u
Y Replication
YY copy a row
GF jumps to a file (GF uses a string as a file and recursively searches for it in the current folder)
Visual mode operation:
CTRL + V enter block-Based Visual Mode
V enters the character-based Visual Mode
V enters the line-Based Visual Mode
C. Delete the selected block
CTRL + z sleep Vim
FG num returns Vim
FX: Search backward and move the cursor to the next X of the current row. Obviously, X can be any letter and can be repeated ";".
One F command
TX: similar to the preceding command, but it is moved to the left of X.
FX: it is similar to Fx, but you can look back.
TX: Same as above
(Lowercase to backward, uppercase to forward)
0: move the cursor to the beginning of the current row.
^: Move the cursor to the first letter of the current row.
$: Move the cursor to the end of the row.
): Move the cursor to the next sentence.
(: Move the cursor to the previous sentence.
MA: Mark a bookmark at the position of the current cursor. Its name is. Only lowercase letters are allowed. You can't see the existence of bookmarks, but it does
It's already there.
'A: To bookmarks. Note that this is not a single quotation mark. It is generally located on the left of 1 of most keyboards.
'.: The last time you edited the file. This command is useful, and you do not need to mark it yourself.
I: insert it to the left of the Current Character
I: insert at the beginning of the current row
A: insert it to the right of the Current Character
A: insert at the end of the current row
O: Insert a new row under the current row.
O: Insert a new row on the current row.
C {motion}: Delete the characters crossed by the motion command and enter the insert mode. For example: C $, this will delete
And enter the insert mode. CT !, This removes the exclamation point from the cursor position to the next one (but not included), and then enters the insert mode. Quilt
The deleted characters are stored in the clipboard and can be pasted out.
D {motion}: similar to the above, but does not enter the insert mode.
(C and D are used in a similar way, but they are inserted in or out of the insert mode)
Vim is an excellent editor for writing code, because it has some features dedicated to programmers.
Here are some common examples:
] P: similar to P, but it automatically adjusts the indent of the pasted text to adapt to the position of the current Code.
Try it! %: Matching curly braces, square brackets, and brackets. On the top of a bracket and press %, the mouse will appear in another matching
Semi-parentheses.
>>: Indent all selected codes.
<: Similar to the preceding but not indented
GD: arrives at the position where the cursor is located, where the function or variable is defined. Will find many but jump to the definition of the local variable
K: Search for the word at the current position of the cursor in man.
Function jump without ctags (also string SEARCH)
[+ Ctrl + I jump to function, variable, and # define
[+ Ctrl + D jump to # define
CTRL + I jump forward to the previous cursor position
CTRL + O jump back to the last few cursor positions
[[Jump to the start of a function before the cursor. If the cursor is in the function body, it is the start of the function.
] [Used to jump to the end of a function after the cursor. If the cursor is in the function body, it is at the end of the function.
] To jump to the start of a function behind the cursor. If the cursor is in the body of the function, it is the start of the next function.
[] Is used to jump to the end of a function before the cursor. If the cursor is in the function body, it is the end of the previous function.
1. First, do you want to jump forward or backward?
If you want to move forward, click [. If you want to move backward, click], and then don't let your fingers go.
2. Do you want to start or end?
If it is the start point, click it again. If it is the end, press another key.