Home Explore Blog CI



neovim

21th chunk of `runtime/doc/pattern.txt`
e446c45153392a188096c6ccc68db8520d5460d1adca2c69000000010000086b
 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

Title: Vim Match Highlighting Details and Additional Match Commands
Summary
This section elaborates on the `:match` command, noting that the specified highlight group must exist beforehand. It clarifies that match highlighting has higher priority than 'hlsearch' and syntax highlighting. The pattern is window-specific and persists when switching buffers. 'ignorecase' is not applied by default; use `\/c` for case-insensitive matching. 'redrawtime' affects the search time for matches. It also mentions functions like `matcharg()` and `getmatches()` for retrieving match information. The section then discusses the limitations of `:match` to three matches and introduces `:2match` and `:3match` as additional match commands, allowing three simultaneous active matches with priority given to the lowest number.