Home Explore Blog CI



neovim

7th chunk of `runtime/pack/dist/opt/matchit/doc/matchit.txt`
0de316b37307e853038683b577786b3b404adeadafa765ea0000000100000d13
 line, with optional white space, you might use
the pattern "\(^\s*\)\@<=if" so that the cursor will end on the "i" instead of
at the start of the line.  For another example, if HTML had only one tag then
one could >
	:let b:match_words = '<:>,<\@<=tag>:<\@<=/tag>'
so that "%" can bounce between matching "<" and ">" pairs or (starting on
"tag" or "/tag") between matching tags.  Without the |\@<=|, the script would
bounce from "tag" to the "<" in "</tag>", and another "%" would not take you
back to where you started.

DEBUGGING				*matchit-debug* *:MatchDebug*

If you are having trouble figuring out the appropriate definition of
|b:match_words| then you can take advantage of the same information I use when
debugging the script.  This is especially true if you are not sure whether
your patterns or my script are at fault!  To make this more convenient, I have
made the command :MatchDebug, which defines the variable |b:match_debug| and
creates a Matchit menu.  This menu makes it convenient to check the values of
the variables described below.  You will probably also want to read
|matchit-details| above.

Defining the variable |b:match_debug| causes the script to set the following
variables, each time you hit the "%" key.  Several of these are only defined
if |b:match_words| includes |backref|s.

							*b:match_pat*
The b:match_pat variable is set to |b:match_words| with |backref|s parsed.
							*b:match_match*
The b:match_match variable is set to the bit of text that is recognized as a
match.
							*b:match_col*
The b:match_col variable is set to the cursor column of the start of the
matching text.
							*b:match_wholeBR*
The b:match_wholeBR variable is set to the comma-separated group of patterns
that matches, with |backref|s unparsed.
							*b:match_iniBR*
The b:match_iniBR variable is set to the first pattern in |b:match_wholeBR|.
							*b:match_ini*
The b:match_ini variable is set to the first pattern in |b:match_wholeBR|,
with |backref|s resolved from |b:match_match|.
							*b:match_tail*
The b:match_tail variable is set to the remaining patterns in
|b:match_wholeBR|, with |backref|s resolved from |b:match_match|.
							*b:match_word*
The b:match_word variable is set to the pattern from |b:match_wholeBR| that
matches |b:match_match|.
							*b:match_table*
The back reference '\'.d refers to the same thing as '\'.b:match_table[d] in
|b:match_word|.

==============================================================================
5. Known Bugs and Limitations				*matchit-bugs*

Repository: https://github.com/chrisbra/matchit/
Bugs can be reported at the repository and the latest development snapshot can
also be downloaded there.

Just because I know about a bug does not mean that it is on my todo list.  I
try to respond to reports of bugs that cause real problems.  If it does not
cause serious problems, or if there is a work-around, a bug may sit there for
a while.  Moral:  if a bug (known or not) bothers you, let me know.

It would be nice if "\0" were recognized as the entire pattern.  That is, it
would be nice if "foo:\end\0" had the same effect as "\(foo\):\end\1".  I may
try to implement this in a future version.  (This is not so easy to arrange as
you might think!)

==============================================================================
vim:tw=78:ts=8:fo=tcq2:ft=help:

Title: Debugging b:match_words and Known Bugs
Summary
This section explains how to use `:MatchDebug` and the associated variables (b:match_pat, b:match_match, b:match_col, b:match_wholeBR, b:match_iniBR, b:match_ini, b:match_tail, b:match_word, b:match_table) to debug your `b:match_words` definitions and identify issues. It also includes a section on known bugs and limitations of the matchit plugin, pointing to the repository for bug reports and the latest development version.