aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/pattern.txt
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
commit931bffbda3668ddc609fc1da8f9eb576b170aa52 (patch)
treed8c1843a95da5ea0bb4acc09f7e37843d9995c86 /runtime/doc/pattern.txt
parent142d9041391780ac15b89886a54015fdc5c73995 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-userreg.tar.gz
rneovim-userreg.tar.bz2
rneovim-userreg.zip
Merge remote-tracking branch 'upstream/master' into userreguserreg
Diffstat (limited to 'runtime/doc/pattern.txt')
-rw-r--r--runtime/doc/pattern.txt42
1 files changed, 20 insertions, 22 deletions
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
index 5357aaa3f1..17136ee650 100644
--- a/runtime/doc/pattern.txt
+++ b/runtime/doc/pattern.txt
@@ -72,7 +72,7 @@ N Repeat the latest "/" or "?" [count] times in
command "/\<keyword\>". |exclusive|
'ignorecase' is used, 'smartcase' is not.
*v_star-default*
- In Visual mode, search forward for the current selection.
+{Visual}* In Visual mode, search forward for the current selection.
|default-mappings|
*#*
@@ -81,7 +81,7 @@ N Repeat the latest "/" or "?" [count] times in
backspace, try using "stty erase <BS>" before starting
Vim (<BS> is CTRL-H or a real backspace).
*v_#-default*
- In Visual mode, search backward for the current selection.
+{Visual}# In Visual mode, search backward for the current selection.
|default-mappings|
*gstar*
@@ -97,6 +97,8 @@ g# Like "#", but don't put "\<" and "\>" around the word.
*gd*
gd Goto local Declaration. When the cursor is on a local
variable, this command will jump to its declaration.
+ This was made to work for C code, in other languages
+ it may not work well.
First Vim searches for the start of the current
function, just like "[[". If it is not found the
search stops in line 1. If it is found, Vim goes back
@@ -430,8 +432,6 @@ after: \v \m \M \V matches ~
\\ \\ \\ \\ literal backslash
\{ { { { literal curly brace
-{only Vim supports \m, \M, \v and \V}
-
If you want to you can make a pattern immune to the 'magic' option being set
or not by putting "\m" or "\M" at the start of the pattern.
@@ -453,7 +453,7 @@ More explanation and examples below, follow the links. *E64* *E871*
\{n} \{n} n exactly
\{n,} \{n,} at least n as many as possible
\{,m} \{,m} 0 to m as many as possible
- \{} \{} 0 or more as many as possible (same as *)
+ \{} \{} 0 or more as many as possible (same as "*")
|/\{-| \{-n,m} \{-n,m} n to m as few as possible
\{-n} \{-n} n exactly
@@ -631,7 +631,7 @@ overview.
\{n} Matches n of the preceding atom
\{n,} Matches at least n of the preceding atom, as many as possible
\{,m} Matches 0 to m of the preceding atom, as many as possible
-\{} Matches 0 or more of the preceding atom, as many as possible (like *)
+\{} Matches 0 or more of the preceding atom, as many as possible (like "*")
*/\{-*
\{-n,m} matches n to m of the preceding atom, as few as possible
\{-n} matches n of the preceding atom
@@ -1065,7 +1065,7 @@ match ASCII characters, as indicated by the range.
\(\) A pattern enclosed by escaped parentheses. */\(* */\(\)* */\)*
E.g., "\(^a\)" matches 'a' at the start of a line.
- There can only be ten of these. You can use "\%(" to add more, but
+ There can only be nine of these. You can use "\%(" to add more, but
not counting it as a sub-expression.
*E51* *E54* *E55* *E872* *E873*
@@ -1129,21 +1129,21 @@ x A single character, with no special meaning, matches itself
are supported:
Name Func Contents ~
*[:alnum:]* [:alnum:] isalnum ASCII letters and digits
-*[:alpha:]* [:alpha:] isalpha ASCII letters
-*[:blank:]* [:blank:] space and tab
-*[:cntrl:]* [:cntrl:] iscntrl ASCII control characters
-*[:digit:]* [:digit:] decimal digits '0' to '9'
+*[:alpha:]* [:alpha:] isalpha ASCII letters
+*[:blank:]* [:blank:] space and tab
+*[:cntrl:]* [:cntrl:] iscntrl ASCII control characters
+*[:digit:]* [:digit:] decimal digits '0' to '9'
*[:graph:]* [:graph:] isgraph ASCII printable characters excluding
space
*[:lower:]* [:lower:] (1) lowercase letters (all letters when
'ignorecase' is used)
-*[:print:]* [:print:] (2) printable characters including space
+*[:print:]* [:print:] (2) printable characters including space
*[:punct:]* [:punct:] ispunct ASCII punctuation characters
-*[:space:]* [:space:] whitespace characters: space, tab, CR,
+*[:space:]* [:space:] whitespace characters: space, tab, CR,
NL, vertical tab, form feed
*[:upper:]* [:upper:] (3) uppercase letters (all letters when
'ignorecase' is used)
-*[:xdigit:]* [:xdigit:] hexadecimal digits: 0-9, a-f, A-F
+*[:xdigit:]* [:xdigit:] hexadecimal digits: 0-9, a-f, A-F
*[:return:]* [:return:] the <CR> character
*[:tab:]* [:tab:] the <Tab> character
*[:escape:]* [:escape:] the <Esc> character
@@ -1254,7 +1254,6 @@ letters only.
When "\c" appears anywhere in the pattern, the whole pattern is handled like
'ignorecase' is on. The actual value of 'ignorecase' and 'smartcase' is
ignored. "\C" does the opposite: Force matching case for the whole pattern.
-{only Vim supports \c and \C}
Note that 'ignorecase', "\c" and "\C" are not used for the character classes.
Examples:
@@ -1296,7 +1295,6 @@ will probably never match.
When "\Z" appears anywhere in the pattern, all composing characters are
ignored. Thus only the base characters need to match, the composing
characters may be different and the number of composing characters may differ.
-Only relevant when 'encoding' is "utf-8".
Exception: If the pattern starts with one or more composing characters, these
must match.
*/\%C*
@@ -1337,11 +1335,10 @@ difference between them is mostly just notation; here's a summary of where
they differ:
Capability in Vimspeak in Perlspeak ~
-----------------------------------------------------------------
force case insensitivity \c (?i)
force case sensitivity \C (?-i)
backref-less grouping \%(atom\) (?:atom)
-conservative quantifiers \{-n,m} *?, +?, ??, {}?
+conservative quantifiers \{-n,m} `*?,` +?, ??, {}?
0-width match atom\@= (?=atom)
0-width non-match atom\@! (?!atom)
0-width preceding match atom\@<= (?<=atom)
@@ -1445,10 +1442,11 @@ Finally, these constructs are unique to Perl:
Just like |:match| above, but set a separate match. Thus
there can be three matches active at the same time. The match
with the lowest number has priority if several match at the
- same position.
- The ":3match" command is used by the |matchparen| plugin. You
- are suggested to use ":match" for manual matching and
- ":2match" for another plugin.
+ same position. It uses the match id 3.
+ The ":3match" command is used by (older Vims) |matchparen|
+ plugin. You are suggested to use ":match" for manual matching
+ and ":2match" for another plugin or even better make use of
+ the more flexible |matchadd()| (and similar) functions instead.
==============================================================================
11. Fuzzy matching *fuzzy-matching*