annotate runtime/macros/matchit.txt @ 3896:be8ad9c9b973 v7.3.704

updated for version 7.3.704 Problem: Repeating "cgn" does not always work correctly. Solution: Also fetch the operator character. (Christian Brabandt)
author Bram Moolenaar <bram@vim.org>
date Sun, 21 Oct 2012 03:54:33 +0200
parents 82b5078be2dd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 *matchit.txt* Extended "%" matching
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 For instructions on installing this file, type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 :help matchit-install
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 inside Vim.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
7 For Vim version 6.3. Last change: 2007 Aug 29
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 VIM REFERENCE MANUAL by Benji Fisher
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 *matchit* *matchit.vim*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 1. Extended matching with "%" |matchit-intro|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 2. Activation |matchit-activate|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 3. Configuration |matchit-configure|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 4. Supporting a New Language |matchit-newlang|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 5. Known Bugs and Limitations |matchit-bugs|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 The functionality mentioned here is a plugin, see |add-plugin|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 This plugin is only available if 'compatible' is not set.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 You can avoid loading this plugin by setting the "loaded_matchit" variable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 in your |vimrc| file: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 :let loaded_matchit = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 {Vi does not have any of this}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 1. Extended matching with "%" *matchit-intro*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 *matchit-%*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 % Cycle forward through matching groups, such as "if", "else", "endif",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 as specified by |b:match_words|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 *g%* *v_g%* *o_g%*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 g% Cycle backwards through matching groups, as specified by
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
37 |b:match_words|. For example, go from "if" to "endif" to "else".
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 *[%* *v_[%* *o_[%*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 [% Go to [count] previous unmatched group, as specified by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 |b:match_words|. Similar to |[{|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 *]%* *v_]%* *o_]%*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 ]% Go to [count] next unmatched group, as specified by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 |b:match_words|. Similar to |]}|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 *v_a%*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 a% In Visual mode, select the matching group, as specified by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 |b:match_words|, containing the cursor. Similar to |v_a[|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 A [count] is ignored, and only the first character of the closing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 pattern is selected.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 In Vim, as in plain vi, the percent key, |%|, jumps the cursor from a brace,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 bracket, or paren to its match. This can be configured with the 'matchpairs'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 option. The matchit plugin extends this in several ways:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 You can match whole words, such as "if" and "endif", not just
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 single characters. You can also specify a |regular-expression|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 You can define groups with more than two words, such as "if",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 "else", "endif". Banging on the "%" key will cycle from the "if" to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 the first "else", the next "else", ..., the closing "endif", and back
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 to the opening "if". Nested structures are skipped. Using |g%| goes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 in the reverse direction.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 By default, words inside comments and strings are ignored, unless
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 the cursor is inside a comment or string when you type "%". If the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 only thing you want to do is modify the behavior of "%" so that it
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
67 behaves this way, you do not have to define |b:match_words|, since the
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
68 script uses the 'matchpairs' option as well as this variable.
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
69
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 See |matchit-details| for details on what the script does, and |b:match_words|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 for how to specify matching patterns.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 MODES: *matchit-modes* *matchit-v_%* *matchit-o_%*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 Mostly, % and related motions (|g%| and |[%| and |]%|) work just like built-in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 |motion| commands in |Operator-pending| and |Visual| modes. However, you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 cannot make these motions |linewise| or |characterwise|, since the |:omap|s
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 that define them start with "v" in order to make the default behavior
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 inclusive. (See |o_v|.) In other words, "dV%" will not work. The
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 work-around is to go through Visual mode: "V%d" will work.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 LANGUAGES: *matchit-languages*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 Currently, the following languages are supported: Ada, ASP with VBS, Csh,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 DTD, Entity, Essbase, Fortran, HTML, JSP (same as HTML), LaTeX, Lua, Pascal,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 SGML, Shell, Tcsh, Vim, XML. Other languages may already have support via
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
87 the default |filetype-plugin|s in the standard vim distribution.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 To support a new language, see |matchit-newlang| below.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 DETAILS: *matchit-details* *matchit-parse*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 Here is an outline of what matchit.vim does each time you hit the "%" key. If
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 there are |backref|s in |b:match_words| then the first step is to produce a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 version in which these back references have been eliminated; if there are no
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 |backref|s then this step is skipped. This step is called parsing. For
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 example, "\(foo\|bar\):end\1" is parsed to yield
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 "\(foo\|bar\):end\(foo\|bar\)". This can get tricky, especially if there are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 nested groups. If debugging is turned on, the parsed version is saved as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 |b:match_pat|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 *matchit-choose*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 Next, the script looks for a word on the current line that matches the pattern
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 just constructed. It includes the patterns from the 'matchpairs' option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 The goal is to do what you expect, which turns out to be a little complicated.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 The script follows these rules:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 Insist on a match that ends on or after the cursor.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 Prefer a match that includes the cursor position (that is, one that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 starts on or before the cursor).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 Prefer a match that starts as close to the cursor as possible.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 If more than one pattern in |b:match_words| matches, choose the one
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 that is listed first.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 Examples:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 Suppose you >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 :let b:match_words = '<:>,<tag>:</tag>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 < and hit "%" with the cursor on or before the "<" in "a <tag> is born".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 The pattern '<' comes first, so it is preferred over '<tag>', which
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 also matches. If the cursor is on the "t", however, then '<tag>' is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 preferred, because this matches a bit of text containing the cursor.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 If the two groups of patterns were reversed then '<' would never be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 preferred.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 Suppose you >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 :let b:match_words = 'if:end if'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 < (Note the space!) and hit "%" with the cursor at the end of "end if".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 Then "if" matches, which is probably not what you want, but if the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 cursor starts on the "end " then "end if" is chosen. (You can avoid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 this problem by using a more complicated pattern.)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
133 If there is no match, the cursor does not move. (Before version 1.13 of the
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
134 script, it would fall back on the usual behavior of |%|). If debugging is
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
135 turned on, the matched bit of text is saved as |b:match_match| and the cursor
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
136 column of the start of the match is saved as |b:match_col|.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 Next, the script looks through |b:match_words| (original and parsed versions)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 for the group and pattern that match. If debugging is turned on, the group is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 saved as |b:match_ini| (the first pattern) and |b:match_tail| (the rest). If
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 there are |backref|s then, in addition, the matching pattern is saved as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 |b:match_word| and a table of translations is saved as |b:match_table|. If
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 there are |backref|s, these are determined from the matching pattern and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 |b:match_match| and substituted into each pattern in the matching group.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 The script decides whether to search forwards or backwards and chooses
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 arguments for the |searchpair()| function. Then, the cursor is moved to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 start of the match, and |searchpair()| is called. By default, matching
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 structures inside strings and comments are ignored. This can be changed by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 setting |b:match_skip|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 2. Activation *matchit-activate*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 You can use this script as a plugin, by copying it to your plugin directory.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 See |add-global-plugin| for instructions. You can also add a line to your
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 |vimrc| file, such as >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 :source $VIMRUNTIME/macros/matchit.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 or >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 :runtime macros/matchit.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 Either way, the script should start working the next time you start up Vim.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
163 (Earlier versions of the script did nothing unless a |buffer-variable| named
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
164 |b:match_words| was defined. Even earlier versions contained autocommands
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
165 that set this variable for various file types. Now, |b:match_words| is
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
166 defined in many of the default |filetype-plugin|s instead.)
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
167
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
168 For a new language, you can add autocommands to the script or to your vimrc
82b5078be2dd updated for version 7.2a
vimboss
parents: 799
diff changeset
169 file, but the recommended method is to add a line such as >
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 let b:match_words = '\<foo\>:\<bar\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 to the |filetype-plugin| for your language. See |b:match_words| below for how
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 this variable is interpreted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 TROUBLESHOOTING *matchit-troubleshoot*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 The script should work in most installations of Vim. It may not work if Vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 was compiled with a minimal feature set, for example if the |+syntax| option
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 was not enabled. If your Vim has support for syntax compiled in, but you do
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 not have |syntax| highlighting turned on, matchit.vim should work, but it may
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 fail to skip matching groups in comments and strings. If the |filetype|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 mechanism is turned off, the |b:match_words| variable will probably not be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 defined automatically.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 3. Configuration *matchit-configure*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 There are several variables that govern the behavior of matchit.vim. Note
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 that these are variables local to the buffer, not options, so use |:let| to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 define them, not |:set|. Some of these variables have values that matter; for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 others, it only matters whether the variable has been defined. All of these
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 can be defined in the |filetype-plugin| or autocommand that defines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 |b:match_words| or "on the fly."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 The main variable is |b:match_words|. It is described in the section below on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 supporting a new language.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 *MatchError* *matchit-hl* *matchit-highlight*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 MatchError is the highlight group for error messages from the script. By
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 default, it is linked to WarningMsg. If you do not want to be bothered by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 error messages, you can define this to be something invisible. For example,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 if you use the GUI version of Vim and your command line is normally white, you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 can do >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 :hi MatchError guifg=white guibg=white
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 *b:match_ignorecase*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 If you >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 :let b:match_ignorecase = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 then matchit.vim acts as if 'ignorecase' is set: for example, "end" and "END"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 are equivalent. If you >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 :let b:match_ignorecase = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 then matchit.vim treats "end" and "END" differently. (There will be no
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 b:match_infercase option unless someone requests it.)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 *b:match_debug*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 Define b:match_debug if you want debugging information to be saved. See
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 |matchit-debug|, below.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 *b:match_skip*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 If b:match_skip is defined, it is passed as the skip argument to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 |searchpair()|. This controls when matching structures are skipped, or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 ignored. By default, they are ignored inside comments and strings, as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 determined by the |syntax| mechanism. (If syntax highlighting is turned off,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 nothing is skipped.) You can set b:match_skip to a string, which evaluates to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 a non-zero, numerical value if the match is to be skipped or zero if the match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 should not be skipped. In addition, the following special values are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 supported by matchit.vim:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 s:foo becomes (current syntax item) =~ foo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 S:foo becomes (current syntax item) !~ foo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 r:foo becomes (line before cursor) =~ foo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 R:foo becomes (line before cursor) !~ foo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 (The "s" is meant to suggest "syntax", and the "r" is meant to suggest
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 "regular expression".)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 Examples:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 You can get the default behavior with >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 :let b:match_skip = 's:comment\|string'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 If you want to skip matching structures unless they are at the start
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 of the line (ignoring whitespace) then you can >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 :let b:match_skip = 'R:^\s*'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 < Do not do this if strings or comments can span several lines, since
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 the normal syntax checking will not be done if you set b:match_skip.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 In LaTeX, since "%" is used as the comment character, you can >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 :let b:match_skip = 'r:%'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 < Unfortunately, this will skip anything after "\%", an escaped "%". To
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 allow for this, and also "\\%" (an excaped backslash followed by the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 comment character) you can >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 :let b:match_skip = 'r:\(^\|[^\\]\)\(\\\\\)*%'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 <
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 7
diff changeset
252 See the $VIMRUNTIME/ftplugin/vim.vim for an example that uses both
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 syntax and a regular expression.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 4. Supporting a New Language *matchit-newlang*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 *b:match_words*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 In order for matchit.vim to support a new language, you must define a suitable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 pattern for |b:match_words|. You may also want to set some of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 |matchit-configure| variables, as described above. If your language has a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 complicated syntax, or many keywords, you will need to know something about
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 Vim's |regular-expression|s.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 The format for |b:match_words| is similar to that of the 'matchpairs' option:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 it is a comma (,)-separated list of groups; each group is a colon(:)-separated
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 7
diff changeset
266 list of patterns (regular expressions). Commas and backslashes that are part
6beb2c667935 updated for version 7.0b
vimboss
parents: 7
diff changeset
267 of a pattern should be escaped with backslashes ('\:' and '\,'). It is OK to
6beb2c667935 updated for version 7.0b
vimboss
parents: 7
diff changeset
268 have only one group; the effect is undefined if a group has only one pattern.
6beb2c667935 updated for version 7.0b
vimboss
parents: 7
diff changeset
269 A simple example is >
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 :let b:match_words = '\<if\>:\<endif\>,'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 \ . '\<while\>:\<continue\>:\<break\>:\<endwhile\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 (In Vim regular expressions, |\<| and |\>| denote word boundaries. Thus "if"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 matches the end of "endif" but "\<if\>" does not.) Then banging on the "%"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 key will bounce the cursor between "if" and the matching "endif"; and from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 "while" to any matching "continue" or "break", then to the matching "endwhile"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 and back to the "while". It is almost always easier to use |literal-string|s
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 (single quotes) as above: '\<if\>' rather than "\\<if\\>" and so on.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 Exception: If the ":" character does not appear in b:match_words, then it is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 treated as an expression to be evaluated. For example, >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 :let b:match_words = 'GetMatchWords()'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 allows you to define a function. This can return a different string depending
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 on the current syntax, for example.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 Once you have defined the appropriate value of |b:match_words|, you will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 probably want to have this set automatically each time you edit the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 appropriate file type. The recommended way to do this is by adding the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 definition to a |filetype-plugin| file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 Tips: Be careful that your initial pattern does not match your final pattern.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 See the example above for the use of word-boundary expressions. It is usually
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 better to use ".\{-}" (as many as necessary) instead of ".*" (as many as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 possible). See |\{-|. For example, in the string "<tag>label</tag>", "<.*>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 matches the whole string whereas "<.\{-}>" and "<[^>]*>" match "<tag>" and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 "</tag>".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 *matchit-spaces* *matchit-s:notend*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 If "if" is to be paired with "end if" (Note the space!) then word boundaries
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 are not enough. Instead, define a regular expression s:notend that will match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 anything but "end" and use it as follows: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 :let s:notend = '\%(\<end\s\+\)\@<!'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 :let b:match_words = s:notend . '\<if\>:\<end\s\+if\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 < *matchit-s:sol*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 This is a simplified version of what is done for Ada. The s:notend is a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 |script-variable|. Similarly, you may want to define a start-of-line regular
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 expression >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 :let s:sol = '\%(^\|;\)\s*'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 if keywords are only recognized after the start of a line or after a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 semicolon (;), with optional white space.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 *matchit-backref* *matchit-\1*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 In any group, the expressions |\1|, |\2|, ..., |\9| refer to parts of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 INITIAL pattern enclosed in |\(|escaped parentheses|\)|. These are referred
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 to as back references, or backrefs. For example, >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 :let b:match_words = '\<b\(o\+\)\>:\(h\)\1\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 means that "bo" pairs with "ho" and "boo" pairs with "hoo" and so on. Note
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 that "\1" does not refer to the "\(h\)" in this example. If you have
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 "\(nested \(parentheses\)\) then "\d" refers to the d-th "\(" and everything
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 up to and including the matching "\)": in "\(nested\(parentheses\)\)", "\1"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 refers to everything and "\2" refers to "\(parentheses\)". If you use a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 variable such as |s:notend| or |s:sol| in the previous paragraph then remember
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 to count any "\(" patterns in this variable. You do not have to count groups
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 defined by |\%(\)|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 It should be possible to resolve back references from any pattern in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 group. For example, >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 :let b:match_words = '\(foo\)\(bar\):more\1:and\2:end\1\2'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 would not work because "\2" cannot be determined from "morefoo" and "\1"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 cannot be determined from "andbar". On the other hand, >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 :let b:match_words = '\(\(foo\)\(bar\)\):\3\2:end\1'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 should work (and have the same effect as "foobar:barfoo:endfoobar"), although
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 this has not been thoroughly tested.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 You can use |zero-width| patterns such as |\@<=| and |\zs|. (The latter has
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 not been thouroughly tested in matchit.vim.) For example, if the keyword "if"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 must occur at the start of the line, with optional white space, you might use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 the pattern "\(^\s*\)\@<=if" so that the cursor will end on the "i" instead of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 at the start of the line. For another example, if HTML had only one tag then
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 one could >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 :let b:match_words = '<:>,<\@<=tag>:<\@<=/tag>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 so that "%" can bounce between matching "<" and ">" pairs or (starting on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 "tag" or "/tag") between matching tags. Without the |\@<=|, the script would
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 bounce from "tag" to the "<" in "</tag>", and another "%" would not take you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 back to where you started.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346 DEBUGGING *matchit-debug* *:MatchDebug*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 If you are having trouble figuring out the appropriate definition of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 |b:match_words| then you can take advantage of the same information I use when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 debugging the script. This is especially true if you are not sure whether
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 your patterns or my script are at fault! To make this more convenient, I have
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 made the command :MatchDebug, which defines the variable |b:match_debug| and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 creates a Matchit menu. This menu makes it convenient to check the values of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 the variables described below. You will probably also want to read
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 |matchit-details| above.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 Defining the variable |b:match_debug| causes the script to set the following
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 variables, each time you hit the "%" key. Several of these are only defined
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 if |b:match_words| includes |backref|s.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 *b:match_pat*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 The b:match_pat variable is set to |b:match_words| with |backref|s parsed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 *b:match_match*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 The b:match_match variable is set to the bit of text that is recognized as a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 match.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 *b:match_col*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 The b:match_col variable is set to the cursor column of the start of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 matching text.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 *b:match_wholeBR*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 The b:match_wholeBR variable is set to the comma-separated group of patterns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 that matches, with |backref|s unparsed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 *b:match_iniBR*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 The b:match_iniBR variable is set to the first pattern in |b:match_wholeBR|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 *b:match_ini*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 The b:match_ini variable is set to the first pattern in |b:match_wholeBR|,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 with |backref|s resolved from |b:match_match|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 *b:match_tail*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 The b:match_tail variable is set to the remaining patterns in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 |b:match_wholeBR|, with |backref|s resolved from |b:match_match|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 *b:match_word*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 The b:match_word variable is set to the pattern from |b:match_wholeBR| that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 matches |b:match_match|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 *b:match_table*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384 The back reference '\'.d refers to the same thing as '\'.b:match_table[d] in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 |b:match_word|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 5. Known Bugs and Limitations *matchit-bugs*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 Just because I know about a bug does not mean that it is on my todo list. I
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 try to respond to reports of bugs that cause real problems. If it does not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 cause serious problems, or if there is a work-around, a bug may sit there for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 a while. Moral: if a bug (known or not) bothers you, let me know.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 The various |:vmap|s defined in the script (%, |g%|, |[%|, |]%|, |a%|) may
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 have undesired effects in Select mode |Select-mode-mapping|. At least, if you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 want to replace the selection with any character in "ag%[]" there will be a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 pause of |'updatetime'| first.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 It would be nice if "\0" were recognized as the entire pattern. That is, it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 would be nice if "foo:\end\0" had the same effect as "\(foo\):\end\1". I may
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 try to implement this in a future version. (This is not so easy to arrange as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 you might think!)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 vim:tw=78:fo=tcq2: