mirror of
https://github.com/chenasraf/vim-matchup.git
synced 2026-05-18 01:38:57 +00:00
Add starter standard html regexes
This commit is contained in:
@@ -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*>\='
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user