1*pi_logipat.txt* Logical Patterns May 01, 2019 2 3Author: Charles E. Campbell <[email protected]> 4Copyright: (c) 2004-2016 by Charles E. Campbell *logiPat-copyright* 5 The VIM LICENSE applies to LogiPat.vim and LogiPat.txt 6 (see |copyright|) except use "LogiPat" instead of "Vim" 7 No warranty, express or implied. Use At-Your-Own-Risk. 8 9============================================================================== 101. Contents *logiPat* *logiPat-contents* 11 12 1. Contents.................: |logiPat-contents| 13 2. LogiPat Manual...........: |logiPat-manual| 14 3. LogiPat Examples.........: |logiPat-examples| 15 4. Caveat...................: |logiPat-caveat| 16 5. LogiPat History..........: |logiPat-history| 17 18 19============================================================================== 202. LogiPat Manual *logiPat-manual* *logiPat-man* 21 22 *logiPat-arg* *logiPat-input* *logiPat-pattern* *logiPat-operators* 23 Boolean logic patterns are composed of 24 25 operators ! = not 26 | = logical-or 27 & = logical-and 28 grouping ( ... ) 29 patterns "pattern" 30 31 *logiPat-cmd* 32 :LogiPat {boolean-logic pattern} *:LogiPat* 33 :LogiPat is a command which takes a boolean-logic 34 argument (|logiPat-arg|). 35 36 :LP {boolean-logic pattern} *:LP* 37 :LP is a shorthand command version of :LogiPat 38 (|logiPat-cmd|). 39 40 :LPE {boolean-logic pattern} *:LPE* 41 No search is done, but the conversion from the 42 boolean logic pattern to the regular expression 43 is performed and echoed onto the display. 44 45 :LogiPatFlags {search flags} *LogiPat-flags* 46 LogiPat uses the |search()| command. The flags 47 passed to that call to search() may be specified 48 by the :LogiPatFlags command. 49 50 :LPF {search flags} *:LPF* 51 :LPF is a shorthand version of :LogiPatFlags. 52 53 :let pat=LogiPat({boolean-logic pattern}) *LogiPat()* 54 If one calls LogiPat() directly, no search 55 is done, but the transformation from the boolean 56 logic pattern into a regular expression pattern 57 is performed and returned. 58 59 To get a " inside a pattern, as opposed to having it delimit 60 the pattern, double it. 61 62 63============================================================================== 643. LogiPat Examples *logiPat-examples* 65 66 LogiPat takes Boolean logic arguments and produces a regular 67 expression which implements the choices. A series of examples 68 follows: 69> 70 :LogiPat "abc" 71< will search for lines containing the string :abc: 72> 73 :LogiPat "ab""cd" 74< will search for lines containing the string :ab"cd: 75> 76 :LogiPat !"abc" 77< will search for lines which don't contain the string :abc: 78> 79 :LogiPat "abc"|"def" 80< will search for lines which contain either the string 81 :abc: or the string :def: 82> 83 :LogiPat !("abc"|"def") 84< will search for lines which don't contain either 85 of the strings :abc: or :def: 86> 87 :LogiPat "abc"&"def" 88< will search for lines which contain both of the strings 89 :abc: and :def: 90> 91 :let pat= LogiPat('!"abc"') 92< will return the regular expression which will match 93 all lines not containing :abc: . The double quotes 94 are needed to pass normal patterns to LogiPat, and 95 differentiate such patterns from boolean logic 96 operators. 97 98 99============================================================================== 1004. Caveat *logiPat-caveat* 101 102 The "not" operator may be fragile; ie. it may not always play well 103 with the & (logical-and) and | (logical-or) operators. Please try out 104 your patterns, possibly with :set hls, to insure that what is matching 105 is what you want. 106 107 108============================================================================== 1095. LogiPat History *logiPat-history* 110 111 v4 Jun 22, 2015 * LogiPat has been picked up by Bram M for standard 112 plugin distribution; hence the name change 113 v3 Sep 25, 2006 * LP_Or() fixed; it now encapsulates its output 114 in \%(...\) parentheses 115 Dec 12, 2011 * |:LPE| added 116 * "" is mapped to a single " and left inside patterns 117 v2 May 31, 2005 * LPF and LogiPatFlags commands weren't working 118 v1 May 23, 2005 * initial release 119 120 121============================================================================== 122vim:tw=78:ts=8:noet:ft=help 123