comparison runtime/plugin/matchparen.vim @ 4437:eb6ab7e78925

Update runtime files.
author Bram Moolenaar <bram@vim.org>
date Fri, 17 May 2013 18:14:19 +0200
parents 04736b4030ec
children f9fa2e506b9f
comparison
equal deleted inserted replaced
4436:a4fb812810e3 4437:eb6ab7e78925
1 " Vim plugin for showing matching parens 1 " Vim plugin for showing matching parens
2 " Maintainer: Bram Moolenaar <Bram@vim.org> 2 " Maintainer: Bram Moolenaar <Bram@vim.org>
3 " Last Change: 2013 Mar 19 3 " Last Change: 2013 May 08
4 4
5 " Exit quickly when: 5 " Exit quickly when:
6 " - this plugin was already loaded (or disabled) 6 " - this plugin was already loaded (or disabled)
7 " - when 'compatible' is set 7 " - when 'compatible' is set
8 " - the "CursorMoved" autocmd event is not available. 8 " - the "CursorMoved" autocmd event is not available.
9 if exists("g:loaded_matchparen") || &cp || !exists("##CursorMoved") 9 if exists("g:loaded_matchparen") || &cp || !exists("##CursorMoved")
10 finish 10 finish
11 endif 11 endif
12 let g:loaded_matchparen = 1 12 let g:loaded_matchparen = 1
13
14 if !exists("g:matchparen_timeout")
15 let g:matchparen_timeout = 300
16 endif
17 if !exists("g:matchparen_insert_timeout")
18 let g:matchparen_insert_timeout = 60
19 endif
13 20
14 augroup matchparen 21 augroup matchparen
15 " Replace all matchparen autocommands 22 " Replace all matchparen autocommands
16 autocmd! CursorMoved,CursorMovedI,WinEnter * call s:Highlight_Matching_Pair() 23 autocmd! CursorMoved,CursorMovedI,WinEnter * call s:Highlight_Matching_Pair()
17 if exists('##TextChanged') 24 if exists('##TextChanged')
97 let stopline = stoplinebottom 104 let stopline = stoplinebottom
98 else 105 else
99 let stopline = stoplinetop 106 let stopline = stoplinetop
100 endif 107 endif
101 108
109 " Limit the search time to 300 msec to avoid a hang on very long lines.
110 " This fails when a timeout is not supported.
111 if mode() == 'i' || mode() == 'R'
112 let timeout = exists("b:matchparen_insert_timeout") ? b:matchparen_insert_timeout : g:matchparen_insert_timeout
113 else
114 let timeout = exists("b:matchparen_timeout") ? b:matchparen_timeout : g:matchparen_timeout
115 endif
102 try 116 try
103 " Limit the search time to 300 msec to avoid a hang on very long lines. 117 let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, timeout)
104 " This fails when a timeout is not supported.
105 let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 300)
106 catch /E118/ 118 catch /E118/
107 " Can't use the timeout, restrict the stopline a bit more to avoid taking 119 " Can't use the timeout, restrict the stopline a bit more to avoid taking
108 " a long time on closed folds and long lines. 120 " a long time on closed folds and long lines.
109 " The "viewable" variables give a range in which we can scroll while 121 " The "viewable" variables give a range in which we can scroll while
110 " keeping the cursor at the same position. 122 " keeping the cursor at the same position.