aboutsummaryrefslogtreecommitdiff
path: root/runtime/plugin/matchparen.vim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-05-04 13:56:28 -0400
committerJustin M. Keyes <justinkz@gmail.com>2016-05-04 13:56:28 -0400
commite2cc3f98fb3ca771d9bd108ae9c37c19bea8025b (patch)
treee45f71a17c410e456c56de52f94f5c7f95152ad7 /runtime/plugin/matchparen.vim
parent490804ed33a5da70ba14bc54bceea5decb62874a (diff)
parent6a32852137a3d54131534fe628230eca5311d3fc (diff)
downloadrneovim-e2cc3f98fb3ca771d9bd108ae9c37c19bea8025b.tar.gz
rneovim-e2cc3f98fb3ca771d9bd108ae9c37c19bea8025b.tar.bz2
rneovim-e2cc3f98fb3ca771d9bd108ae9c37c19bea8025b.zip
Merge pull request #4704 from KillTheMule/vim-runtime-patches-all
vim-patch:{a0f849e, d7464be, b4ff518, e392eb4, d042dc8, 2c5e8e8, 256972a, cc7ff3f}
Diffstat (limited to 'runtime/plugin/matchparen.vim')
-rw-r--r--runtime/plugin/matchparen.vim11
1 files changed, 8 insertions, 3 deletions
diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim
index 3804ab949a..2a5a16a57e 100644
--- a/runtime/plugin/matchparen.vim
+++ b/runtime/plugin/matchparen.vim
@@ -55,14 +55,19 @@ function! s:Highlight_Matching_Pair()
let before = 0
let text = getline(c_lnum)
- let c = text[c_col - 1]
+ let matches = matchlist(text, '\(.\)\=\%'.c_col.'c\(.\)')
+ if empty(matches)
+ let [c_before, c] = ['', '']
+ else
+ let [c_before, c] = matches[1:2]
+ endif
let plist = split(&matchpairs, '.\zs[:,]')
let i = index(plist, c)
if i < 0
" not found, in Insert mode try character before the cursor
if c_col > 1 && (mode() == 'i' || mode() == 'R')
- let before = 1
- let c = text[c_col - 2]
+ let before = strlen(c_before)
+ let c = c_before
let i = index(plist, c)
endif
if i < 0