summaryrefslogtreecommitdiff
path: root/runtime/plugin/matchparen.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-05-17 18:14:19 +0200
committerBram Moolenaar <Bram@vim.org>2013-05-17 18:14:19 +0200
commitad3b366c8250a6f3c7ac699bc4b0f2e613286089 (patch)
tree23a07a413110c9587852eb5ec0e29119d3debc62 /runtime/plugin/matchparen.vim
parentd620aa9be4d574627c020dedd39313f8482ab216 (diff)
downloadvim-ad3b366c8250a6f3c7ac699bc4b0f2e613286089.zip
Update runtime files.
Diffstat (limited to 'runtime/plugin/matchparen.vim')
-rw-r--r--runtime/plugin/matchparen.vim20
1 files changed, 16 insertions, 4 deletions
diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim
index 2965ad147..0fdfef164 100644
--- a/runtime/plugin/matchparen.vim
+++ b/runtime/plugin/matchparen.vim
@@ -1,6 +1,6 @@
" Vim plugin for showing matching parens
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2013 Mar 19
+" Last Change: 2013 May 08
" Exit quickly when:
" - this plugin was already loaded (or disabled)
@@ -11,6 +11,13 @@ if exists("g:loaded_matchparen") || &cp || !exists("##CursorMoved")
endif
let g:loaded_matchparen = 1
+if !exists("g:matchparen_timeout")
+ let g:matchparen_timeout = 300
+endif
+if !exists("g:matchparen_insert_timeout")
+ let g:matchparen_insert_timeout = 60
+endif
+
augroup matchparen
" Replace all matchparen autocommands
autocmd! CursorMoved,CursorMovedI,WinEnter * call s:Highlight_Matching_Pair()
@@ -99,10 +106,15 @@ function! s:Highlight_Matching_Pair()
let stopline = stoplinetop
endif
+ " Limit the search time to 300 msec to avoid a hang on very long lines.
+ " This fails when a timeout is not supported.
+ if mode() == 'i' || mode() == 'R'
+ let timeout = exists("b:matchparen_insert_timeout") ? b:matchparen_insert_timeout : g:matchparen_insert_timeout
+ else
+ let timeout = exists("b:matchparen_timeout") ? b:matchparen_timeout : g:matchparen_timeout
+ endif
try
- " Limit the search time to 300 msec to avoid a hang on very long lines.
- " This fails when a timeout is not supported.
- let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 300)
+ let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, timeout)
catch /E118/
" Can't use the timeout, restrict the stopline a bit more to avoid taking
" a long time on closed folds and long lines.