Vim shortcuts and plug-ins

Source: Internet
Author: User
Complete Vim shortcuts and plug-in code
  1. Use Vim built-in completion and shortcut keysCtrl-nOrCtrl-p.

  2. Automatic completion plug-inAutoComplPop.

    Note
  3. 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
  4. Insert modeCtrl-TIncrease indentation,Ctrl-DReduce indentation.

  5. Command mode>>Right indent,<<Left indent, noten<<Orn>>Is indent multiple lines, such4>>.

  6. Visual Mode<,>Used for Left and Right indentation,n<,n>Multiple indentation, such2>. In addition,=The selected parts can be automatically indented.

    Code jump
  7. 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 historyCtrl-OIn the background of historical records,Ctrl-IForward.
  8. Ctags code jump

    • After ctags is installed, Setset 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.