Improve ]% esp for html

This commit is contained in:
Andy K. Massimino
2019-01-16 10:35:28 -05:00
parent 13b3ebb3c7
commit c860f4c967
2 changed files with 15 additions and 5 deletions

View File

@@ -156,6 +156,12 @@ function! matchup#delim#get_surrounding(type, ...) " {{{1
endif
let l:matches = matchup#delim#get_matching(l:open, 1)
" TODO: getting one match result here is surely wrong
if len(l:matches) == 1
let l:matches = []
endif
if has_key(l:opts, 'matches')
let l:opts.matches = l:matches
endif
@@ -163,7 +169,7 @@ function! matchup#delim#get_surrounding(type, ...) " {{{1
if len(l:matches)
let l:close = l:local ? l:open.links.next : l:open.links.close
let l:pos_val_try = matchup#pos#val(l:close)
\ + matchup#delim#end_offset(l:close)
\ + matchup#delim#end_offset(l:close)
endif
if len(l:matches) && l:pos_val_try >= l:pos_val_cursor

View File

@@ -148,12 +148,12 @@ function! matchup#motion#find_unmatched(visual, down) " {{{1
" set the timeout fairly high
call matchup#perf#timeout_start(750)
for l:second_try in range(2)
for l:tries in range(3)
let [l:open, l:close] = matchup#delim#get_surrounding('delim_all',
\ l:second_try ? l:count : 1)
\ l:tries ? l:count : 1)
if empty(l:open) || empty(l:close)
call matchup#perf#toc('motion#find_unmatched', 'fail'.l:second_try)
call matchup#perf#toc('motion#find_unmatched', 'fail'.l:tries)
return
endif
@@ -167,7 +167,11 @@ function! matchup#motion#find_unmatched(visual, down) " {{{1
if l:exclusive
let l:new_pos[1] -= 1
else
let l:new_pos[1] += matchup#delim#end_offset(l:delim)
if l:is_oper
let l:new_pos[1] += matchup#delim#end_offset(l:delim)
else
let l:new_pos[1] = matchup#delim#jump_target(l:delim)
endif
endif
endif