Highlight matching bracket
In addition to jumping to the corresponding bracket or parenthesis with
%, Vim has a little-known feature for showing corresponding parens when inserting.
showmatch feature might be useful for those writing code with many nested parentheses, such as Lisp. With
:setshowmatch enabled, Vim enables a special bracket highlighting while in insert mode. After typing a paren, brace, or bracket, the cursor will automatically jump to the matching bracket ever so briefly. Just long enough for you to visually confirm which parenthesis you are closing. This can reduce the need to even use the
% command to bounce to the bracket manually.
You can change the time the cursor spends there before bouncing back with
Here’s how I use showmatch:
:set showmatch matchtime=3
This feature is best demonstrated so watch the brief screencast here. Notice how the insert-mode cursor jumps to the opposite bracket, highlighting the opposite side.
inoremap } }<Left><c-o>%<c-o>:sleep 500m<CR><c-o>%<c-o>a inoremap ] ]<Left><c-o>%<c-o>:sleep 500m<CR><c-o>%<c-o>a inoremap ) )<Left><c-o>%<c-o>:sleep 500m<CR><c-o>%<c-o>a
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?