moment this command is executed.
The {group} highlighting still applies when a character is
to be highlighted for 'hlsearch', as the highlighting for
matches is given higher priority than that of 'hlsearch'.
Syntax highlighting (see 'syntax') is also overruled by
matches.
Note that highlighting the last used search pattern with
'hlsearch' is used in all windows, while the pattern defined
with ":match" only exists in the current window. It is kept
when switching to another buffer.
'ignorecase' does not apply, use |/\c| in the pattern to
ignore case. Otherwise case is not ignored.
'redrawtime' defines the maximum time searched for pattern
matches.
When matching end-of-line and Vim redraws only part of the
display you may get unexpected results. That is because Vim
looks for a match in the line where redrawing starts.
Also see |matcharg()| and |getmatches()|. The former returns
the highlight group and pattern of a previous |:match|
command. The latter returns a list with highlight groups and
patterns defined by both |matchadd()| and |:match|.
Highlighting matches using |:match| are limited to three
matches (aside from |:match|, |:2match| and |:3match| are
available). |matchadd()| does not have this limitation and in
addition makes it possible to prioritize matches.
Another example, which highlights all characters in virtual
column 72 and more: >
:highlight rightMargin term=bold ctermfg=blue guifg=blue
:match rightMargin /.\%>72v/
< To highlight all character that are in virtual column 7: >
:highlight col8 ctermbg=grey guibg=grey
:match col8 /\%<8v.\%>7v/
< Note the use of two items to also match a character that
occupies more than one virtual column, such as a TAB.
:mat[ch]
:mat[ch] none
Clear a previously defined match pattern.
:2mat[ch] {group} /{pattern}/ *:2match*
:2mat[ch]
:2mat[ch] none
:3mat[ch] {group} /{pattern}/ *:3match*
:3mat[ch]
:3mat[ch] none
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