match "foo bar" if the Visual selection continues after the "r".
Only works for the current buffer.
*/\%#* *cursor-position*
\%# Matches with the cursor position. Only works when matching in a
buffer displayed in a window.
WARNING: When the cursor is moved after the pattern was used, the
result becomes invalid. Vim doesn't automatically update the matches.
This is especially relevant for syntax highlighting and 'hlsearch'.
In other words: When the cursor moves the display isn't updated for
this change. An update is done for lines which are changed (the whole
line is updated) or when using the |CTRL-L| command (the whole screen
is updated). Example, to highlight the word under the cursor: >
/\k*\%#\k*
< When 'hlsearch' is set and you move the cursor around and make changes
this will clearly show when the match is updated or not.
*/\%'m* */\%<'m* */\%>'m*
\%'m Matches with the position of mark m.
\%<'m Matches before the position of mark m.
\%>'m Matches after the position of mark m.
Example, to highlight the text from mark 's to 'e: >
/.\%>'s.*\%<'e..
< Note that two dots are required to include mark 'e in the match. That
is because "\%<'e" matches at the character before the 'e mark, and
since it's a |/zero-width| match it doesn't include that character.
WARNING: When the mark is moved after the pattern was used, the result
becomes invalid. Vim doesn't automatically update the matches.
Similar to moving the cursor for "\%#" |/\%#|.
*/\%l* */\%>l* */\%<l* *E951* *E1204*
\%23l Matches in a specific line.
\%<23l Matches above a specific line (lower line number).
\%>23l Matches below a specific line (higher line number).
\%.l Matches at the cursor line.
\%<.l Matches above the cursor line.
\%>.l Matches below the cursor line.
These six can be used to match specific lines in a buffer. The "23"
can be any line number. The first line is 1.
WARNING: When inserting or deleting lines Vim does not automatically
update the matches. This means Syntax highlighting quickly becomes
wrong. Also when referring to the cursor position (".") and
the cursor moves the display isn't updated for this change. An update
is done when using the |CTRL-L| command (the whole screen is updated).
Example, to highlight the line where the cursor currently is: >
:exe '/\%' .. line(".") .. 'l'
< Alternatively use: >
/\%.l
< When 'hlsearch' is set and you move the cursor around and make changes
this will clearly show when the match is updated or not.
*/\%c* */\%>c* */\%<c*
\%23c Matches in a specific column.
\%<23c Matches before a specific column.
\%>23c Matches after a specific column.
\%.c Matches at the cursor column.
\%<.c Matches before the cursor column.
\%>.c Matches after the cursor column.
These six can be used to match specific columns in a buffer or string.
The "23" can be any column number. The first column is 1. Actually,
the column is the byte number (thus it's not exactly right for
multibyte characters).
WARNING: When inserting or deleting text Vim does not automatically
update the matches. This means Syntax highlighting quickly becomes
wrong. Also when referring to the cursor position (".") and
the cursor moves the display isn't updated for this change. An update
is done when using the |CTRL-L| command (the whole screen is updated).
Example, to highlight the column where the cursor currently is: >
:exe '/\%' .. col(".") .. 'c'
< Alternatively use: >
/\%.c
< When 'hlsearch' is set and you move the cursor around and make changes
this will clearly show when the match is updated or not.
Example for matching a single byte in column 44: >
/\%>43c.\%<46c
< Note that "\%<46c" matches in column 45 when the "." matches a byte in
column 44.
*/\%v* */\%>v* */\%<v*
\%23v Matches in a specific virtual column.
\%<23v Matches before a specific virtual column.
\%>23v Matches after a specific virtual column.
\%.v Matches at the current virtual column.
\%<.v Matches before