diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index dceb57d..7fb1f7f 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -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 {{{ diff --git a/syntax/vimwiki.vim b/syntax/vimwiki.vim index fb52ff6..4cf9d91 100644 --- a/syntax/vimwiki.vim +++ b/syntax/vimwiki.vim @@ -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,