codekingpro/portable-devtools
114k
1*pi_paren.txt* For Vim version 9.2. Last change: 2026 Feb 142 3 4 VIM REFERENCE MANUAL by Bram Moolenaar5 6 7Highlighting matching parens *matchparen*8 9The functionality mentioned here is a |standard-plugin|.10This plugin is only available if 'compatible' is not set.11 12You can avoid loading this plugin by setting the "loaded_matchparen" variable: >13 14 :let loaded_matchparen = 115 16The plugin installs CursorMoved, CursorMovedI and WinEnter autocommands to17redefine the match highlighting.18 19 *:NoMatchParen* *:DoMatchParen*20To disable the plugin after it was loaded use this command: >21 22 :NoMatchParen23 24And to enable it again: >25 26 :DoMatchParen27 28The highlighting used is MatchParen. You can specify different colors with29the ":highlight" command. Example: >30 31 :hi MatchParen ctermbg=blue guibg=lightblue32 33By default the plugin will highlight both the paren under the cursor and the34matching one using the |hl-MatchParen| highlighting group. This may result in35the cursor briefly disappearing from the screen as the MatchParen colors take36over the cursor highlight. To prevent this from happening and have the plugin37only highlight the matching paren and not the one under the cursor38(effectively leaving the cursor style unchanged), you can set the39"matchparen_disable_cursor_hl" variable: >40 41 :let matchparen_disable_cursor_hl = 142 43The characters to be matched come from the 'matchpairs' option. You can44change the value to highlight different matches. Note that not everything is45possible. For example, you can't highlight single or double quotes, because46the start and end are equal.47 48The syntax highlighting attributes are used. When the cursor currently is not49in a string or comment syntax item, then matches inside string and comment50syntax items are ignored. Any syntax items with "string" or "comment"51somewhere in their name are considered string or comment items.52 53The search is limited to avoid a delay when moving the cursor. The limits54are:55- What is visible in the window.56- 100 lines above or below the cursor to avoid a long delay when there are57 closed folds.58- 'synmaxcol' times 2 bytes before or after the cursor to avoid a delay59 in a long line with syntax highlighting.60- A timeout of 300 msec (60 msec in Insert mode). This can be changed with61 the "g:matchparen_timeout" and "g:matchparen_insert_timeout" variables and62 their buffer-local equivalents "b:matchparen_timeout" and63 "b:matchparen_insert_timeout".64 65If you would like the |%| command to work better, the matchit plugin can be66used, see |matchit-install|. This plugin also helps to skip matches in67comments. This is unrelated to the matchparen highlighting, they use a68different mechanism.69 70==============================================================================71 vim:tw=78:ts=8:noet:ft=help:norl:72 