Dynamically detect nested syntaxes (fix #128)
This commit is contained in:
parent
edb72680a1
commit
fc947523b0
@ -1926,6 +1926,18 @@ function! vimwiki#base#normalize_link(is_visual_mode) "{{{
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
" vimwiki#base#detect_nested_syntax
|
||||
function! vimwiki#base#detect_nested_syntax() "{{{
|
||||
let last_word = '\v.*<(\w+)\s*$'
|
||||
let lines = map(filter(getline(1, "$"), 'v:val =~ "{{{" && v:val =~ last_word'),
|
||||
\ 'substitute(v:val, last_word, "\\=submatch(1)", "")')
|
||||
let dict = {}
|
||||
for elem in lines
|
||||
exe "let dict.".elem." = elem"
|
||||
endfor
|
||||
return dict
|
||||
endfunction "}}}
|
||||
|
||||
" }}}
|
||||
|
||||
" Command completion functions {{{
|
||||
|
@ -600,7 +600,7 @@ call vimwiki#u#reload_regexes_custom()
|
||||
let b:current_syntax="vimwiki"
|
||||
|
||||
" EMBEDDED syntax setup "{{{
|
||||
let s:nested = VimwikiGet('nested_syntaxes')
|
||||
let s:nested = extend(VimwikiGet('nested_syntaxes'), vimwiki#base#detect_nested_syntax())
|
||||
if !empty(s:nested)
|
||||
for [s:hl_syntax, s:vim_syntax] in items(s:nested)
|
||||
call vimwiki#base#nested_syntax(s:vim_syntax,
|
||||
|
Loading…
Reference in New Issue
Block a user