Complete Vim shortcuts and plug-in code
-
Use Vim built-in completion and shortcut keysCtrl-nOrCtrl-p.
-
Automatic completion plug-inAutoComplPop.
Note
-
NERDCommentPlug-ins
Common commands:
<Leader>ccIn visual mode, comment on the selected items,<Leader>Configurable. The default value is the backslash (\).
<Leader>c<space>Uncomment the selected region.
:help nerdcommentView help indent
-
Insert modeCtrl-TIncrease indentation,Ctrl-DReduce indentation.
-
Command mode>>Right indent,<<Left indent, noten<<Orn>>Is indent multiple lines, such4>>.
-
Visual Mode<,>Used for Left and Right indentation,n<,n>Multiple indentation, such2>. In addition,=The selected parts can be automatically indented.
Code jump
-
In command mode, you can directly use the following commands:
- Jump to the definition of GD to local variables and Gd to global variables.
- Search
*,#You can perform full word search on the word forward/backward at the cursor,g*,g#Perform the corresponding non-full-word match search.
- Beginning and end of brackets
%You can jump between the matching brackets and the beginning and end of the block.
- Location history
Ctrl-OIn the background of historical records,Ctrl-IForward.
-
Ctags code jump
- After ctags is installed, Set
set tags=tags;/To automatically find the Tag file.
Ctrl-]Go to the corresponding tag of the best match,Ctrl-TReturns the previous match. Code folding can be enabled when code folding is long, for example, highlighting elements by syntax:
Set foldmethod = syntax
"It is not collapsed by default.
Set foldlevel = 99
Za will flip the folding status of the current position, and Za will recursively flip the folding status of all the code on the current layer.
Browse tag
The plug-in tagbar depends on ctags, and VIM requires more than 7.0.
Set F9 to open the tag window nnoremap: tagbartoggle
Original window command
: Help tagbar view help
: Tagbaropen J jump to the tag window
: Tagbartoggle open or close the tag window
Tag window command
Select the tag and jump to the original window
P The tag is located in the original window and does not jump
Zo/ZC/za Zo open the collapsed tag, ZC off, Za flip fold status
Q: exit the tag window.
You can find the corresponding content at http://linux-wiki.cn/wiki/with vimprogramming. To make Vim an IDE, some functions are required, such as file browsing and compilation and integration. My Vim configurations need to be improved.
Vim shortcuts and plug-ins