mirror of
https://github.com/chenasraf/vim-matchup.git
synced 2026-05-18 01:38:57 +00:00
Allow arg in gspec (for future expansion)
This commit is contained in:
@@ -164,9 +164,10 @@ function! s:init_delim_lists(...) abort " {{{1
|
||||
let l:words[l:i] = substitute(l:words[l:i],
|
||||
\ g:matchup#re#gspec,
|
||||
\ '\=[get(l:replacement,submatch(1),""),'
|
||||
\ . 'add(l:special_flags,submatch(1))][0]', 'g')
|
||||
for l:f in l:special_flags
|
||||
let l:extra_list[l:i][l:f] = 1
|
||||
\ . 'add(l:special_flags,'
|
||||
\ . '[submatch(1),submatch(2)])][0]', 'g')
|
||||
for [l:f, l:a] in l:special_flags
|
||||
let l:extra_list[l:i][l:f] = len(l:a) ? l:a : 1
|
||||
endfor
|
||||
endfor
|
||||
|
||||
|
||||
@@ -4,23 +4,20 @@
|
||||
" Email: a@normed.space
|
||||
"
|
||||
|
||||
let g:matchup#re#not_bslash = '\v%(\\@<!%(\\\\)*)@<=\m'
|
||||
let s:nbsl = '\v%(\\@<!%(\\\\)*)@<=\m'
|
||||
let g:matchup#re#not_bslash = s:nbsl
|
||||
|
||||
" 1 \1 \\1 \\\1 \\\\1 \\\\\1
|
||||
let g:matchup#re#backref = g:matchup#re#not_bslash.'\\'.'\(\d\)'
|
||||
let g:matchup#re#backref = s:nbsl . '\\' . '\(\d\)'
|
||||
|
||||
" \zs atom
|
||||
let g:matchup#re#zs = g:matchup#re#not_bslash . '\\zs'
|
||||
let g:matchup#re#zs = s:nbsl . '\\zs'
|
||||
|
||||
" \ze atom
|
||||
let g:matchup#re#ze = g:matchup#re#not_bslash . '\\ze'
|
||||
let g:matchup#re#ze = s:nbsl . '\\ze'
|
||||
|
||||
" \g{special}
|
||||
let g:matchup#re#gspec = g:matchup#re#not_bslash . '\\g{\(.\{-}\)}'
|
||||
|
||||
function! matchup#re#gspec_pat(key)
|
||||
return g:matchup#re#not_bslash . '\V\\g{'.escape(a:key, '\').'}\m'
|
||||
endfunction
|
||||
" \g{special}, \g{special:arg}
|
||||
let g:matchup#re#gspec = s:nbsl . '\\g{\(\w\+\):\?\(.\{-}\)\?}'
|
||||
|
||||
" vim: fdm=marker sw=2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user