Sunday, August 12, 2012

Re: Install matchit

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.
--
Did you know that clones never use mirrors?
-- Ambrose Bierce, "The Devil's Dictionary"

--
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: