diff --git a/autoload/matchup.vim b/autoload/matchup.vim index 0ce781d..6d256b7 100644 --- a/autoload/matchup.vim +++ b/autoload/matchup.vim @@ -51,6 +51,7 @@ function! s:init_options() call s:init_option('matchup_delim_count_max', 8) call s:init_option('matchup_delim_start_plaintext', 1) call s:init_option('matchup_delim_noskips', 0) + call s:init_option('matchup_delim_nomids', 0) call s:init_option('matchup_motion_enabled', 1) call s:init_option('matchup_motion_cursor_end', 1) diff --git a/autoload/matchup/delim.vim b/autoload/matchup/delim.vim index c1225b8..afebcca 100644 --- a/autoload/matchup/delim.vim +++ b/autoload/matchup/delim.vim @@ -779,7 +779,7 @@ function! s:get_matching_delims(down, stopline) dict " {{{1 let l:mids = matchup#delim#fill_backrefs(l:mids, self.groups, 1) " if there are no mids, we're done - if empty(l:mids) + if empty(l:mids) || g:matchup_delim_nomids return [[l:match_corr, l:lnum_corr, l:cnum_corr]] endif diff --git a/autoload/matchup/matchparen.vim b/autoload/matchup/matchparen.vim index a66676d..af1349a 100644 --- a/autoload/matchup/matchparen.vim +++ b/autoload/matchup/matchparen.vim @@ -409,7 +409,7 @@ function! s:matchparen.highlight(...) abort dict " {{{1 \ g:matchup_matchparen_deferred) \ && get(b:, 'matchup_matchparen_hi_surround_always', \ g:matchup_matchparen_hi_surround_always) - call s:highlight_surrounding(l:insertmode) + call s:highlight_surrounding(l:insertmode, 10) endif return endif @@ -716,6 +716,10 @@ endfunction function! s:highlight_surrounding(...) " {{{1 let l:opts = { 'local': 0, 'matches': [] } + if a:0 >= 2 + let l:opts['stopline'] = a:2 + echo a:2 + endif let l:delims = matchup#delim#get_surrounding('delim_all', 1, l:opts) let l:open = l:delims[0] if empty(l:open) | return | endif diff --git a/doc/matchup.txt b/doc/matchup.txt index cd7e69b..2ad5b45 100644 --- a/doc/matchup.txt +++ b/doc/matchup.txt @@ -6,7 +6,7 @@ Web: https://github.com/andymass/vim-matchup Script ID: 5624 License: MIT license {{{ - Copyright (c) 2020 Andy Massimino + Copyright (c) 2021 Andy Massimino Copyright (c) 2016 Karl Yngve LervÄg @@ -507,6 +507,15 @@ Options~ < Default: 0 (matching enabled within strings and comments) +*g:matchup_delim_nomids* + + If set to 1, middle words (like `return`) are not matched to start and + end words for higlighting and motions. + + let g:matchup_delim_noskips = 0 +< + Default: 0 + *g:matchup_delim_start_plaintext* When enabled (the default), the plugin will be loaded for all buffers,