Add option to not match mids, re #127

This commit is contained in:
Andy K. Massimino
2021-01-28 22:46:53 -05:00
parent c74467ea13
commit 5b872ed3e4
4 changed files with 17 additions and 3 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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,