pi_logipat.txt 4.1 KB

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