diff --git a/autoload/matchup/text_obj.vim b/autoload/matchup/text_obj.vim index f68a85e..acba1c5 100644 --- a/autoload/matchup/text_obj.vim +++ b/autoload/matchup/text_obj.vim @@ -127,9 +127,12 @@ function! matchup#text_obj#delimited(is_inner, visual, type) abort " {{{1 let [l:l2, l:c2] = matchup#pos#prev(l:l2, l:c2)[1:2] " make *i% more like *it for html + " don't include next < if matchup#quirks#ishtmllike() \ && !matchup#util#matchpref('classic_textobj', 0) \ && l:close.match =~? '/\w\+\s*>\=' + \ && !(a:visual + \ && matchup#pos#equal([l:l1, l:c1], [l:l2, l:c2])) let [l:l2, l:c2] = matchup#pos#prev(l:l2, l:c2)[1:2] endif @@ -209,6 +212,7 @@ function! matchup#text_obj#delimited(is_inner, visual, type) abort " {{{1 let l:c2 += matchup#delim#end_offset(l:close) " make *a% more like *at for html + " capture starting < if matchup#quirks#ishtmllike() \ && !matchup#util#matchpref('classic_textobj', 0) \ && l:close.match =~? '/\w\+\s*>\=' diff --git a/autoload/matchup/util.vim b/autoload/matchup/util.vim index 20c059d..64488ce 100644 --- a/autoload/matchup/util.vim +++ b/autoload/matchup/util.vim @@ -158,7 +158,31 @@ endfunction " }}}1 +function! matchup#util#standard_html(...) abort " {{{1 + let l:prefs = a:0 ? a:1 : {} + + let l:words = '<:>,<\@<=!--:-->' + + if get(l:prefs, 'lists', 0) + let l:words .= ',<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>' + let l:words .= ',<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>' + endif + + if get(l:prefs, 'tagnameonly', 1) + let l:words .= ',<\@<=\([^/][^ \t>]*\)\g{hlend}' + \ . '\%(>\|$\|[ \t][^>]*\%(>\|$\)\)' + \ . ':<\@<=/\1\g{hlend}>' + else + let l:words .= ',<\@<=\([^/][^ \t>]*\)' + \ . '\%(>\|$\|[ \t][^>]*\%(>\|$\)\)' + \ . ':<\@<=/\1>' + endif + + return l:words +endfunction + +" }}}1 + let &cpo = s:save_cpo " vim: fdm=marker sw=2 -