diff options
author | Bram Moolenaar <Bram@vim.org> | 2014-07-19 14:04:47 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2014-07-19 14:04:47 +0200 |
commit | 07d87790f1e733d69bd7910bf049adeeb6d0f338 (patch) | |
tree | cfafa9324d4664657695a094a68107ad5e6279e4 /runtime/plugin | |
parent | a04854932ec96ab48498fd4a5e8b5f4fd4df14cf (diff) | |
download | vim-07d87790f1e733d69bd7910bf049adeeb6d0f338.zip |
Update runtime files. Make matchparen plugin backwards compatible.
Add json filetype.
Diffstat (limited to 'runtime/plugin')
-rw-r--r-- | runtime/plugin/matchparen.vim | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim index 23c79382f..817ce62b2 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: 2014 Jul 09 +" Last Change: 2014 Jul 19 " Exit quickly when: " - this plugin was already loaded (or disabled) @@ -88,7 +88,13 @@ function! s:Highlight_Matching_Pair() " Find the match. When it was just before the cursor move it there for a " moment. if before > 0 - let save_cursor = getcurpos() + let has_getcurpos = exists("*getcurpos") + if has_getcurpos + " getcurpos() is more efficient but doesn't exist before 7.4.313. + let save_cursor = getcurpos() + else + let save_cursor = winsaveview() + endif call cursor(c_lnum, c_col - before) endif @@ -148,7 +154,11 @@ function! s:Highlight_Matching_Pair() endtry if before > 0 - call setpos('.', save_cursor) + if has_getcurpos + call setpos('.', save_cursor) + else + call winrestview(save_cursor) + endif endif " If a match is found setup match highlighting. |