annotate runtime/doc/pi_logipat.txt @ 22796:d3694e3685d3 v8.2.1946

patch 8.2.1946: sort() with NULL string not tested Commit: https://github.com/vim/vim/commit/35efa22ff2b98126363098db9304796b5624f97f Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 3 18:51:54 2020 +0100 patch 8.2.1946: sort() with NULL string not tested Problem: sort() with NULL string not tested. Solution: Add a test. use v:collate. (Dominique Pell?, closes https://github.com/vim/vim/issues/7247)
author Bram Moolenaar <Bram@vim.org>
date Tue, 03 Nov 2020 19:00:03 +0100
parents 9b7f90e56753
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19116
9b7f90e56753 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19099
diff changeset
1 *pi_logipat.txt* Logical Patterns May 01, 2019
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
2
19099
1a951a4beee3 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18857
diff changeset
3 Author: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
1a951a4beee3 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18857
diff changeset
4 Copyright: (c) 2004-2016 by Charles E. Campbell *logiPat-copyright*
6855
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 ==============================================================================
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
10 1. Contents *logiPat* *logiPat-contents*
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
12 1. Contents.................: |logiPat-contents|
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
13 2. LogiPat Manual...........: |logiPat-manual|
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
14 3. LogiPat Examples.........: |logiPat-examples|
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
15 4. Caveat...................: |logiPat-caveat|
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
16 5. LogiPat History..........: |logiPat-history|
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
17
6855
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 ==============================================================================
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
20 2. LogiPat Manual *logiPat-manual* *logiPat-man*
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
22 *logiPat-arg* *logiPat-input* *logiPat-pattern* *logiPat-operators*
6855
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
19099
1a951a4beee3 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18857
diff changeset
31 *logiPat-cmd*
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 :LogiPat {boolean-logic pattern} *:LogiPat*
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 :LogiPat is a command which takes a boolean-logic
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
34 argument (|logiPat-arg|).
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36 :LP {boolean-logic pattern} *:LP*
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 :LP is a shorthand command version of :LogiPat
19099
1a951a4beee3 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18857
diff changeset
38 (|logiPat-cmd|).
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
39
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
40 :LPE {boolean-logic pattern} *:LPE*
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41 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
42 boolean logic pattern to the regular expression
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
43 is performed and echoed onto the display.
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
44
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
45 :LogiPatFlags {search flags} *LogiPat-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
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
62
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
63 ==============================================================================
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
64 3. LogiPat Examples *logiPat-examples*
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
65
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
66 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
67 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
68 follows:
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
69 >
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
70 :LogiPat "abc"
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
71 < will search for lines containing the string :abc:
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
72 >
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
73 :LogiPat "ab""cd"
19099
1a951a4beee3 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18857
diff changeset
74 < will search for lines containing the string :ab"cd:
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
75 >
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
76 :LogiPat !"abc"
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
77 < 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
78 >
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
79 :LogiPat "abc"|"def"
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
80 < 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
81 :abc: or the string :def:
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
82 >
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
83 :LogiPat !("abc"|"def")
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
84 < 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
85 of the strings :abc: or :def:
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
86 >
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
87 :LogiPat "abc"&"def"
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
88 < 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
89 :abc: and :def:
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
90 >
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
91 :let pat= LogiPat('!"abc"')
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
92 < will return the regular expression which will match
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
93 all lines not containing :abc: . The double quotes
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
94 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
95 differentiate such patterns from boolean logic
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
96 operators.
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 ==============================================================================
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
100 4. Caveat *logiPat-caveat*
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
101
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
102 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
103 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
104 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
105 is what you want.
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
106
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
107
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
108 ==============================================================================
18857
70ce979e76bc Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
109 5. LogiPat History *logiPat-history*
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
110
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
111 v4 Jun 22, 2015 * LogiPat has been picked up by Bram M for standard
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
112 plugin distribution; hence the name change
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
113 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
114 in \%(...\) parentheses
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
115 Dec 12, 2011 * |:LPE| added
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
116 * "" 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
117 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
118 v1 May 23, 2005 * initial release
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
119
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 6855
diff changeset
120
6855
ee45d3b0579b Add the logiPat plugin to the distribution.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
121 ==============================================================================
19116
9b7f90e56753 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19099
diff changeset
122 vim:tw=78:ts=8:noet:ft=help