Mercurial > vim
annotate runtime/doc/pi_logipat.txt @ 7517:9d67399f49c6 v7.4.1060
commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 7 22:01:01 2016 +0100
patch 7.4.1060
Problem: Instructions for writing tests are outdated.
Solution: Mention Make_all.mak. Add steps for new style tests.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 07 Jan 2016 22:15:05 +0100 |
parents | ee45d3b0579b |
children | 47f17f66da3d |
rev | line source |
---|---|
6855
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
1 *pi_logipat.txt* Logical Patterns Mar 13, 2013 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
2 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
3 Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM> |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
4 Copyright: (c) 2004-2013 by Charles E. Campbell *logipat-copyright* |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
5 The VIM LICENSE applies to LogiPat.vim and LogiPat.txt |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
6 (see |copyright|) except use "LogiPat" instead of "Vim" |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
7 No warranty, express or implied. Use At-Your-Own-Risk. |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
8 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
9 ============================================================================== |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
10 1. Contents *logipat* *logipat-contents* |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
11 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
12 1. Contents.................: |logipat-contents| |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
13 2. LogiPat Manual...........: |logipat-manual| |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
14 3. LogiPat Examples.........: |logipat-examples| |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
15 4. Caveat...................: |logipat-caveat| |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
16 5. LogiPat History..........: |logipat-history| |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
17 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
18 ============================================================================== |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
19 2. LogiPat Manual *logipat-manual* *logipat-man* |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
20 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
21 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
22 *logipat-arg* *logipat-input* *logipat-pattern* *logipat-operators* |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
23 Boolean logic patterns are composed of |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
24 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
25 operators ! = not |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
26 | = logical-or |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
27 & = logical-and |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
28 grouping ( ... ) |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
29 patterns "pattern" |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
30 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
31 :LogiPat {boolean-logic pattern} *:LogiPat* |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
32 :LogiPat is a command which takes a boolean-logic |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
33 argument (|logipat-arg|). |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
34 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
35 :LP {boolean-logic pattern} *:LP* |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
36 :LP is a shorthand command version of :LogiPat |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
37 (|:LogiPat|). |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
38 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
39 :ELP {boolean-logic pattern} *:ELP* |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
40 No search is done, but the conversion from the |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
41 boolean logic pattern to the regular expression |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
42 is performed and echoed onto the display. |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
43 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
44 :LogiPatFlags {search flags} *LogiPat-flags* |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
45 :LogiPatFlags {search flags} |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
46 LogiPat uses the |search()| command. The flags |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
47 passed to that call to search() may be specified |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
48 by the :LogiPatFlags command. |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
49 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
50 :LPF {search flags} *:LPF* |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
51 :LPF is a shorthand version of :LogiPatFlags. |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
52 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
53 :let pat=LogiPat({boolean-logic pattern}) *LogiPat()* |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
54 If one calls LogiPat() directly, no search |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
55 is done, but the transformation from the boolean |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
56 logic pattern into a regular expression pattern |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
57 is performed and returned. |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
58 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
59 To get a " inside a pattern, as opposed to having it delimit |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
60 the pattern, double it. |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
61 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
62 ============================================================================== |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
63 3. LogiPat Examples *logipat-examples* |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
64 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
65 LogiPat takes Boolean logic arguments and produces a regular |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
66 expression which implements the choices. A series of examples |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
67 follows: |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
68 > |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
69 :LogiPat "abc" |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
70 < will search for lines containing the string :abc: |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
71 > |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
72 :LogiPat "ab""cd" |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
73 < will search for lines containing the string :ab"c: |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
74 > |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
75 :LogiPat !"abc" |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
76 < will search for lines which don't contain the string :abc: |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
77 > |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
78 :LogiPat "abc"|"def" |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
79 < will search for lines which contain either the string |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
80 :abc: or the string :def: |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
81 > |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
82 :LogiPat !("abc"|"def") |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
83 < will search for lines which don't contain either |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
84 of the strings :abc: or :def: |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
85 > |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
86 :LogiPat "abc"&"def" |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
87 < will search for lines which contain both of the strings |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
88 :abc: and :def: |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
89 > |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
90 :let pat= LogiPat('!"abc"') |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
91 < will return the regular expression which will match |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
92 all lines not containing :abc: . The double quotes |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
93 are needed to pass normal patterns to LogiPat, and |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
94 differentiate such patterns from boolean logic |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
95 operators. |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
96 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
97 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
98 ============================================================================== |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
99 4. Caveat *logipat-caveat* |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
100 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
101 The "not" operator may be fragile; ie. it may not always play well |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
102 with the & (logical-and) and | (logical-or) operators. Please try out |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
103 your patterns, possibly with :set hls, to insure that what is matching |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
104 is what you want. |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
105 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
106 ============================================================================== |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
107 3. LogiPat History *logipat-history* |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
108 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
109 v3 Sep 25, 2006 * LP_Or() fixed; it now encapsulates its output |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
110 in \%(...\) parentheses |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
111 Dec 12, 2011 * |:ELP| added |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
112 * "" is mapped to a single " and left inside patterns |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
113 v2 May 31, 2005 * LPF and LogiPatFlags commands weren't working |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
114 v1 May 23, 2005 * initial release |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
115 |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
116 ============================================================================== |
ee45d3b0579b
Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
117 vim:tw=78:ts=8:ft=help |