HiMtchBrkt : Highlights matching bracket in normal mode
| script karma |
Rating 69/26,
Downloaded by 1920 |
| created by |
| Charles Campbell |
| |
| script type |
| utility |
| |
| description |
The HiMtchBrkt plugin attempts to highlight the matching bracket as you move your cursor in normal mode. Bracket include
(){}[] (actually the |'matchpairs'| option is used)
and the matching one is highlighted when the cursor is moved on top of the bracket. It does so by making a fair number of maps that intercept the requested motion, perform the requested motion, then also call the HiMatchBracket() function which does the work to highlight any matching bracket. Basically it does a "%" to find the matching bracket (if any) and then constructs and executes an appropriate ":match" command.
As of version 10, such overloaded motions include:
, E F) k <down>
; f( F[ l <end>
$ f) F] w <home>
% f[ F{ <c-b> <left>
0 f] F} <c-d> <leftmouse>
b f{ h <c-f> <right>
B f} j <c-u> <up>
e F(
Version 12 supports overloading of 0, too (if you have vim6.2 and patch 405 or later).
Because vim is rich with commands that can move the cursor, the script also uses the CursorHold event (see |cursorhold| and |'updatetime'|) to highlight matching brackets after the cursor is left still for awhile.
To start HiMtchBrkt mode you have several choices:
(put in your .vimrc) let g:HiMtchBrktOn= 1 (vim will always start up in HiMtchBrkt mode)
command: :HMBstart
map: \[i
To stop HiMtchBrkt mode:
command: :HMBstop
map: \[s
When you start HiMtchBrkt, any user maps associated with HiMtchBrkt maps are saved; when you stop HiMtchBrkt, those maps are restored.
|
| |
| install details |
* place into your .vim/plugin or vimfiles\plugin directory
* gunzip HiMtchBrkt.vim.gz
Will automatically install help when you next bring up vim |
| |
script versions (upload new version)
Click on the package to download.
| HiMtchBrkt.tar.gz |
22 |
2006-02-28 |
6.0 |
Charles Campbell |
HiMtchBrkt is faster (under vim v7) with the ability to restrict searches to only that which is currently visible. Several bugfixes, too. (works with both vim v6.0 and v7.0)
|
| HiMtchBrkt.tar.gz |
21 |
2006-02-13 |
6.0 |
Charles Campbell |
If you have vim v7.0 (with snapshot#195 or later), HiMtchBrkt will now take advantage of the new CursorMoved and CursorMovedI events. More reliable, no need to overload motions with maps, and quicker.
HiMtchBrkt's new :HMBsurround command triggers display of containing brackets
HiMtchBrkt now comes with menus for gvim which show on/off choices for HMBsurround
|
| HiMtchBrkt.tar.gz |
20 |
2006-02-09 |
6.0 |
Charles Campbell |
* :HMBstart or setting g:HiMtchBrktOn=1 in your .vimrc will have HiMtchBrkt start as enabled.
* Messages no longer cleared with vim7.0aa snapshot #185 or later.
* :HMBsurround will cause surrounding brackets to be highlighted
|
| HiMtchBrkt.tar.gz |
19 |
2006-01-17 |
6.0 |
Charles Campbell |
HiMtchBrkt now appends its maps to any pre-existing maps. The the help on "Installing HiMtchBrkt" tells you how to get it to start up automatically, if you wish; that way, HiMtchBrkt will work well with matchit and other plugins. CusorHold timeout is now 2 seconds, implementing a tradeoff between seeing messages and getting CursorHold to call HiMtchBracket(). CursorHold on an empty buffer no longer calls HiMtchBracket(). Finally, various unwanted motions have been worked around (tnx to Mun Johl and Gary Johnson for testing & pointing things out).
|
|