mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.1.0143: matchit and matchparen don't handle E363
Problem: Matchit and matchparen don't handle E363.
Solution: Catch the E363 error. (Christian Brabandt)
3d1d6475f9
This commit is contained in:
parent
24ce4c6233
commit
091ae1e63f
@ -1,5 +1,5 @@
|
|||||||
" matchit.vim: (global plugin) Extended "%" matching
|
" matchit.vim: (global plugin) Extended "%" matching
|
||||||
" Last Change: 2017 Sep 15
|
" Last Change: 2018 Jul 3 by Christian Brabandt
|
||||||
" Maintainer: Benji Fisher PhD <benji@member.AMS.org>
|
" Maintainer: Benji Fisher PhD <benji@member.AMS.org>
|
||||||
" Version: 1.13.3, for Vim 6.3+
|
" Version: 1.13.3, for Vim 6.3+
|
||||||
" Fix from Tommy Allen included.
|
" Fix from Tommy Allen included.
|
||||||
@ -268,7 +268,7 @@ function! s:Match_wrapper(word, forward, mode) range
|
|||||||
" execute "normal!" . curcol . "l"
|
" execute "normal!" . curcol . "l"
|
||||||
" endif
|
" endif
|
||||||
if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on"))
|
if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on"))
|
||||||
let skip = "0"
|
let skip = '0'
|
||||||
else
|
else
|
||||||
execute "if " . skip . "| let skip = '0' | endif"
|
execute "if " . skip . "| let skip = '0' | endif"
|
||||||
endif
|
endif
|
||||||
@ -708,10 +708,16 @@ fun! s:MultiMatch(spflag, mode)
|
|||||||
let openpat = substitute(openpat, ',', '\\|', 'g')
|
let openpat = substitute(openpat, ',', '\\|', 'g')
|
||||||
let closepat = substitute(close, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g')
|
let closepat = substitute(close, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g')
|
||||||
let closepat = substitute(closepat, ',', '\\|', 'g')
|
let closepat = substitute(closepat, ',', '\\|', 'g')
|
||||||
|
|
||||||
if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on"))
|
if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on"))
|
||||||
let skip = '0'
|
let skip = '0'
|
||||||
else
|
else
|
||||||
execute "if " . skip . "| let skip = '0' | endif"
|
try
|
||||||
|
execute "if " . skip . "| let skip = '0' | endif"
|
||||||
|
catch /^Vim\%((\a\+)\)\=:E363/
|
||||||
|
" We won't find anything, so skip searching, should keep Vim responsive.
|
||||||
|
return
|
||||||
|
endtry
|
||||||
endif
|
endif
|
||||||
mark '
|
mark '
|
||||||
let level = v:count1
|
let level = v:count1
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
" Vim plugin for showing matching parens
|
" Vim plugin for showing matching parens
|
||||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||||
" Last Change: 2018 Jun 23
|
" Last Change: 2018 Jul 3
|
||||||
|
|
||||||
" Exit quickly when:
|
" Exit quickly when:
|
||||||
" - this plugin was already loaded (or disabled)
|
" - this plugin was already loaded (or disabled)
|
||||||
@ -103,18 +103,28 @@ function! s:Highlight_Matching_Pair()
|
|||||||
call cursor(c_lnum, c_col - before)
|
call cursor(c_lnum, c_col - before)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Build an expression that detects whether the current cursor position is in
|
if !has("syntax") || !exists("g:syntax_on")
|
||||||
" certain syntax types (string, comment, etc.), for use as searchpairpos()'s
|
let s_skip = "0"
|
||||||
" skip argument.
|
else
|
||||||
" We match "escape" for special items, such as lispEscapeSpecial.
|
" Build an expression that detects whether the current cursor position is
|
||||||
let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' .
|
" in certain syntax types (string, comment, etc.), for use as
|
||||||
|
" searchpairpos()'s skip argument.
|
||||||
|
" We match "escape" for special items, such as lispEscapeSpecial.
|
||||||
|
let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' .
|
||||||
\ '''v:val =~? "string\\|character\\|singlequote\\|escape\\|comment"''))'
|
\ '''v:val =~? "string\\|character\\|singlequote\\|escape\\|comment"''))'
|
||||||
" If executing the expression determines that the cursor is currently in
|
" If executing the expression determines that the cursor is currently in
|
||||||
" one of the syntax types, then we want searchpairpos() to find the pair
|
" one of the syntax types, then we want searchpairpos() to find the pair
|
||||||
" within those syntax types (i.e., not skip). Otherwise, the cursor is
|
" within those syntax types (i.e., not skip). Otherwise, the cursor is
|
||||||
" outside of the syntax types and s_skip should keep its value so we skip any
|
" outside of the syntax types and s_skip should keep its value so we skip
|
||||||
" matching pair inside the syntax types.
|
" any matching pair inside the syntax types.
|
||||||
execute 'if' s_skip '| let s_skip = "0" | endif'
|
" Catch if this throws E363: pattern uses more memory than 'maxmempattern'.
|
||||||
|
try
|
||||||
|
execute 'if ' . s_skip . ' | let s_skip = "0" | endif'
|
||||||
|
catch /^Vim\%((\a\+)\)\=:E363/
|
||||||
|
" We won't find anything, so skip searching, should keep Vim responsive.
|
||||||
|
return
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
|
|
||||||
" Limit the search to lines visible in the window.
|
" Limit the search to lines visible in the window.
|
||||||
let stoplinebottom = line('w$')
|
let stoplinebottom = line('w$')
|
||||||
|
Loading…
Reference in New Issue
Block a user