Add starter standard html regexes

This commit is contained in:
Andy K. Massimino
2021-11-04 21:46:53 -04:00
parent d51703ab92
commit f4395fd74c
2 changed files with 29 additions and 1 deletions

View File

@@ -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*>\='

View File

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