sponsor Vim development Vim logo Vim Book Ad

matchit.zip : extended % matching for HTML, LaTeX, and many other languages

 script karma  Rating 2231/737, Downloaded by 51085    Comments, bugs, improvements  Vim wiki

created by
Benji Fisher
 
script type
utility
 
description
The matchit.vim script allows you to configure % to match more than just
single characters.  You can match words and even regular expressions.
Also, matching treats strings and comments (as recognized by the
syntax highlighting mechanism) intelligently.
The default ftplugins include settings for several languages:
Ada, ASP with VBS, Csh, DTD, Essbase, Fortran, HTML, JSP
(same as HTML), LaTeX, Lua, Pascal, SGML, Shell, Tcsh, Vim, XML.
(I no longer keep track, so there may be others.)
The documentation (included in the zip file) explains how to configure
the script for a new language and how to modify the defaults.

Since vim 6.0, matchit.vim has been included in the standard vim distribution,
under the macros/ directory; the version here may be more recent.
 
install details
Vim 5.x:  Make sure to download the correct version (1.0).  Add a line like

:source path/to/matchit.vim

to your vimrc file.  More details are in matchit.html (included).

Vim 6.x, 7.x:  Download the most recent version.
Unpack the zip file in your personal vim directory (e.g. ~/.vim on *NIX):
this will put matchit.vim in your plugin/ directory and put matchit.txt into
your doc/ directory.  Then do

:helptags ~/.vim/doc

to rebuild the tags file.  For details, read

:help add-local-help

Make sure you have a line like

:filetype plugin on

in your vimrc file.  This enables filetype plugins, many of which tell
matchit.vim which matching pairs to use.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
matchit.zip 1.13.2 2008-01-29 6.0 Benji Fisher Another bug fix:  either 1.13 or 1.13.1 broke the behavior of finding a matching construct that starts after the cursor.
matchit.zip 1.13.1 2007-09-09 6.0 Benji Fisher bug fix
matchit.zip 1.13 2007-08-29 6.0 Benji Fisher The script uses its own logic, instead of the default % behavior, if the match comes from the 'matchpairs' option rather than from the b:match_words variable.  This implies that you can get the matchit behavior for strings and comments just by loading the script; you need not define b:match_words at all.
matchit.zip 1.12 2006-10-24 6.0 Benji Fisher I fixed a bug in the [% and ]% motions:  if b:match_words contained escaped colons or commas ('\:' or '\,') then they would be treated incorrectly.
matchit.zip 1.11 2006-05-15 6.0 Benji Fisher improved support for multi-byte characters (thanks to Yuheng Xie)
matchit.zip 1.10 2006-02-26 6.0 Benji Fisher Allow escaped commas and colons to be included in matching patterns.
Example:  to match "foo:" with "foo," and "bar," with "bar:", try
:let b:match_words = 'foo\::foo\,,bar\,:bar\:'
matchit.zip 1.9 2004-05-15 6.0 Benji Fisher improved fix for the [% bug (see previous version comment)
Avoid screen jumps when 'nowrap' is set (reported by Charles Campbell).
matchit.zip 1.8 2004-05-12 6.0 Benji Fisher Bug fix for [% and ]% (Dany St-Amant)
Minor change in :vmap for a%
Updated documentation

This version should be included with the standard distribution of vim 6.3 (in $VIMRUNTIME/macros)
matchit.zip 1.7 2002-09-08 6.0 Benji Fisher This version of matchit.vim requires vim 6.x (maybe 6.1 or later).
This may be more recent than the version in the standard vim
distribution, under $VIMRUNTIME/macros/matchit.vim .
The zip file contains matchit.vim (the script) and matchit.txt
(the documentation).
matchit.zip 1.0 2001-07-23 5.7 Benji Fisher Initial upload
ip used for rating: 54.166.122.65

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo