Mercurial > vim
comparison runtime/plugin/matchparen.vim @ 845:0fe7765dcb8e
updated for version 7.0f03
author | vimboss |
---|---|
date | Thu, 27 Apr 2006 21:40:34 +0000 |
parents | 23f82b5d2814 |
children | ddfb6f3f3b2b |
comparison
equal
deleted
inserted
replaced
844:d3bbb5dd3913 | 845:0fe7765dcb8e |
---|---|
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: 2006 Apr 04 | 3 " Last Change: 2006 Apr 27 |
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 availble. | 8 " - the "CursorMoved" autocmd event is not availble. |
85 if c == '[' | 85 if c == '[' |
86 let c = '\[' | 86 let c = '\[' |
87 let c2 = '\]' | 87 let c2 = '\]' |
88 endif | 88 endif |
89 | 89 |
90 " When not in a string or comment ignore matches inside them. | |
91 let s_skip ='synIDattr(synID(line("."), col(".") - before, 0), "name") ' . | |
92 \ '=~? "string\\|comment"' | |
93 execute 'if' s_skip '| let s_skip = 0 | endif' | |
94 | |
95 " Find the match. When it was just before the cursor move it there for a | 90 " Find the match. When it was just before the cursor move it there for a |
96 " moment. | 91 " moment. |
97 if before > 0 | 92 if before > 0 |
98 let save_cursor = getpos('.') | 93 let save_cursor = getpos('.') |
99 call cursor(c_lnum, c_col - before) | 94 call cursor(c_lnum, c_col - before) |
100 endif | 95 endif |
96 | |
97 " When not in a string or comment ignore matches inside them. | |
98 let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' . | |
99 \ '=~? "string\\|comment"' | |
100 execute 'if' s_skip '| let s_skip = 0 | endif' | |
101 | |
101 let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline) | 102 let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline) |
103 | |
102 if before > 0 | 104 if before > 0 |
103 call setpos('.', save_cursor) | 105 call setpos('.', save_cursor) |
104 endif | 106 endif |
105 | 107 |
106 " If a match is found setup match highlighting. | 108 " If a match is found setup match highlighting. |