]> git.madduck.net Git - etc/vim.git/blob - doc/explainpat.txt

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Version 0.5
[etc/vim.git] / doc / explainpat.txt
1 *explainpat.txt*    Give detailed help on a regexp pattern.
2
3                     For Vim version 7.0.  Last change: 2013 Mar 09
4                     By Andy Wokula <anwoku@yahoo.de>
5
6                                                 *explainpat* *explainpat.vim*
7 ExplainPat is a plugin to inspect a Vim regexp pattern and show a line of help
8 for each found regexp item.
9
10 If you find that it explains something wrong, please drop me an email.
11
12 URL http://vim.sourceforge.net/scripts/script.php?script_id=4364
13 ==============================================================================
14                                                 *:ExplainPattern*
15 :ExplainPattern {pattern}
16 :ExplainPattern {register}
17                         inspect the given Vim {pattern} and print a line of
18                         help (with color) for each found pattern item.  Nested
19                         items get extra indent.
20
21                         A single-char argument is used as {register} argument:
22                                 /       explain the last search pattern
23                                 *       explain pattern from the clipboard
24                                 a       explain pattern from register a
25
26 Notes:
27 The pattern is first converted into a purely |magic| pattern using
28 |nwo#magic#MakeMagic()|.  This means that embedded |/\V| |/\M| |/\m| |/\v|
29 specifiers are effectively removed from the explanation.
30
31 :ExplainPattern also accepts some invalid patterns: >
32         :ExplainPattern \)
33         Pattern: \)
34         \)         end of group
35
36 ==============================================================================
37 History:
38
39 v0.5
40 + BF `$\n^`
41 + wording: `\|' is not an "OR branch" (it separates or branches)
42 + NF added tests (not part of release)
43 + NF accept custom help printer (for testing purpose, could also be used to
44   export HTML etc.)
45
46 v0.4
47 + BF `[foo` is a literal string
48 + BF for |/star|, |/^| and |/$|, distinguish position in the pattern
49   (sometimes these become literal); special cases: `^**', `^^', `\c^^', `$$',
50   `a\|^b', `a\&*b', `[ab', `\_[ab', ...
51
52 v0.3
53 + BF accept `\z(...\)` and `\z[N]`
54 + BF accept `[=a=]` and `[.a.]` in collections
55
56 v0.2
57 + include vim_use suggestions [2012 Dec 19]
58   * for collections [^...], add "not matching [...]"
59   * fix `\%>'a1`
60   * more detailed `\%x31`
61
62 v0.1 (initial version)
63 + start of "first" capturing group, start of 2nd ...
64 + `\|' should get less indent than the branches, do we need to create an
65   AST?  ! no, keep it straight forward
66 + \%[...]
67 + \{, \{-
68
69 ==============================================================================
70 vim:tw=78:fo=tcq2:sts=0:ts=8:sw=8:fdm=marker:fmr=^_\^,^\^:ft=help: