Vim implementation begin end pairing using Matchit plugin

Source: Internet
Author: User

Matchit This plug-in, is Vim comes with, but the default is not installed. In Vim, you can use% to achieve jumps between parentheses, but with this plugin you can set any tag that you want to jump.

Knocking VI in Linux open a blank file

: Help Matchit-install

You can see the steps to install Matchit

It's under the Cd.vim folder.

mkdir ~/.vim/plugin
CP $VIMRUNTIME/macros/matchit.vim ~/.vim/plugin

mkdir ~/.vim/doc
CP $VIMRUNTIME/macros/matchit.txt ~/.vim/plugin


Then let b:match_words= ' \<begin\>:\<end\> ' Add to the. vimrc file

You can also add module,primitive and other strings that need to be matched to your needs.

This will be OK, open any file with% you can see the match between Begin end.

When the above two files are not vimruntime this environment variable, in Linux echo is also blank, and then echo in Vim came out, this variable is the installation path of VIM. If it is not available in Linux, it is OK to replace the variable directly with the path.

There is also a way to replace the above copy of the two files, in the. VIMRC Add the following words

SOURCE $VIMRUNTIME/macros/matchit.vim

Or

Runtime Macros/matchit.vim

You can also set this to ignore case sensitivity when matching, for example if you have this sentence in. vimrc

Let B:match_ignorecase = 1

is to ignore case, so begin and end can also match, if you want to turn off case sensitivity

Let B:match_ignorecase = 0

Really easy to use!!!

Vim implementation begin end pairing using Matchit plugin

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.