Sunday, August 12, 2012

Re: Install matchit

On Sun, Aug 12, 2012 at 10:12 AM, Tony Mechelynck <antoine.mechelynck@gmail.com> wrote:
On 12/08/12 11:26, lilleskut wrote:
I have a problem installing the matchit plugin (for matching html tags) which
comes with vim on debian.

As far as I understand, all I have to do is ':so PATHTOMATCHIT/matchit.vim'
and I should be able to match html tags with pressing '%' in vim.

Is this installation procedure correct, or do I still need to do something
in addition to get html tag matching?

Also, there are two files matchit.vim in debian, one in
'/usr/share/vim/addons/plugin', the other in '/usr/share/vim/vim73/macros/'

Does it matter which one I chose? I tried with either, but without success,
i.e. '%' did not have any effect when I am on html tags.


The one in macros is probably the original one which every vim user gets, even when not on Debian, or indeed not on Linux. The one in addons/plugin could be a Debian version.

Try the following:

1. Create a file (and possibly its directories) with the name ~/.vim/plugin/matchit.vim and the following contents:

runtime macros/matchit.vim

2. Copy /usr/share/vim/vim73/macros/matchit.txt to ~/.vim/doc/ (and create the directory if necessary).

3. :helptags ~/.vim/doc

4. Make sure that your ~/.vimrc includes one of the following:

        source $VIMRUNTIME/vimrc_example.vim
or
        runtime vimrc_example.vim
or
        filetype plugin on
or
        filetype plugin indent on

5. Add the following autocommand in your vimrc:

        " make matchit work on C-like filetypes
        " c and cpp are already handled by their ftplugin
        au Filetype css,javascript
                \ let b:match_words = &matchpairs

6. Restart Vim.

Does it work now?



Best regards,
Tony.

 If you typed PATHTOMATCHIT literally, it would not work.  I usually recommend adding this to your vimrc file:

     source $VIMRUNTIME/macros/matchit.vim

If you are still having trouble, try this and post the results to the list while editing a file where you would like matchit to work:

:map %
:set ft?
:echo b:match_words

HTH     --Benji Fisher

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: