X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/8a97a4231254ab25e017fecd10ba2068bd588e52..34997613f623002a61f0d058789dfeabbbc0174b:/.vim/bundle/explainpat/doc/explainpat.txt diff --git a/.vim/bundle/explainpat/doc/explainpat.txt b/.vim/bundle/explainpat/doc/explainpat.txt new file mode 100644 index 0000000..0268c69 --- /dev/null +++ b/.vim/bundle/explainpat/doc/explainpat.txt @@ -0,0 +1,103 @@ +*explainpat.txt* Give detailed help on a regexp pattern. + + For Vim version 7.0. Last change: 2017 Dec 15 + By Andy Wokula + + *explainpat* *explainpat.vim* +ExplainPat is a plugin to inspect a Vim regexp pattern and show a line of help +for each found regexp item. Purpose is to get a better view on somebody +else's complex regexp string. It may also help with spotting mistakes. + +If you find that it explains something wrong, please drop me an email. + +URL http://vim.sourceforge.net/scripts/script.php?script_id=4364 +============================================================================== + *:ExplainPattern* +:ExplainPattern {pattern} +:ExplainPattern {register} + inspect the given Vim {pattern} and print a line of + help (with color) for each found pattern item. Nested + items get extra indent. + + A single-char argument is used as {register} argument: + / explain the last search pattern + * explain pattern from the clipboard + a explain pattern from register a + etc. + +> + :ExplainPattern \C^\%(\\\%(@<\|%#=\|%[dxouU[(^$V#<>]\=\|z[1-9se(]\|@[>=!]\|_[[^$.]\=\|.\)\|.\) + +Notes: +The pattern is first converted into a purely |magic| pattern using +|nwo#magic#MakeMagic()|. This means that embedded |/\V| |/\M| |/\m| |/\v| +specifiers are effectively removed from the explanation. + +:ExplainPattern also accepts some invalid patterns: > + :ExplainPattern \) + Pattern: \) + \) end of group + +============================================================================== +TODO: +? `\%[...]` can be nested? But documentation |/\%[]| says no. + +Ideas: +- If the user already knows regular expressions but of a different kind, + explain items in that different language. + Other regexp idioms: + Perl, Python, Emacs, Java, C#, Sed, Grep; + Vim ... very magic, nomagic, very nomagic + Possible config var name: + g:explainpat_user_knows = "Perl" + g:explainpat_background = "Perl" + g:explainpat_in_terms_of = "Perl" + g:explainpat_language = "Perl" + +============================================================================== +History: + +v0.9 ++ BF accept `\@123<=` and `\@123 explainpat#NewHelpPrinter() + +v0.7 ++ BF `\{3,4\}` not accepted, only `\{3,4}` + +v0.6 ++ BF `[]` is a literal string (not a collection) + +v0.5 ++ BF `$\n^` ++ wording: `\|` is not an "OR branch" (it separates or branches) ++ NF added tests (not part of release) ++ NF accept custom help printer (for testing purpose, could also be used to + export HTML etc.) + +v0.4 ++ BF `[foo` is a literal string ++ BF for |/star|, |/^| and |/$|, distinguish position in the pattern + (sometimes these become literal); special cases: `^**`, `^^`, `\c^^`, `$$`, + `a\|^b`, `a\&*b`, `[ab`, `\_[ab`, ... + +v0.3 ++ BF accept `\z(...\)` and `\z[N]` ++ BF accept `[=a=]` and `[.a.]` in collections + +v0.2 ++ include vim_use suggestions [2012 Dec 19] + * for collections [^...], add "not matching [...]" + * fix `\%>'a1` + * more detailed `\%x31` + +v0.1 (initial version) ++ start of "first" capturing group, start of 2nd ... ++ `\|` should get less indent than the branches, do we need to create an + AST? ! no, keep it straight forward ++ `\%[...]` ++ `\{`, `\{-` + +============================================================================== +vim:tw=78:fo=tcq2:sts=0:ts=8:sw=8:fdm=marker:fmr=^_\^,^\^:ft=help: