Option for automatic detection of nested syntaxes

This commit is contained in:
mMontu 2016-01-27 13:30:30 -02:00
parent fc947523b0
commit a2888692fd
3 changed files with 19 additions and 1 deletions

View File

@ -1940,6 +1940,20 @@ or in: >
}}} }}}
*vimwiki-option-automatic_nested_syntaxes*
------------------------------------------------------------------------------
Key Default value~
automatic_nested_syntaxes 1
Description~
Allows for smaller |vimwiki-option-nested_syntaxes| dictionaries, by turning
entry for python on the previous example unnecessary: >
let wiki.nested_syntaxes = {'python': 'python', 'c++': 'cpp'}
It requires that the file is reloaded (|:edit|) after new |filetype| is
included in a file.
*vimwiki-option-diary_rel_path* *vimwiki-option-diary_rel_path*
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Key Default value~ Key Default value~

View File

@ -390,6 +390,7 @@ let s:vimwiki_defaults.template_default = ''
let s:vimwiki_defaults.template_ext = '' let s:vimwiki_defaults.template_ext = ''
let s:vimwiki_defaults.nested_syntaxes = {} let s:vimwiki_defaults.nested_syntaxes = {}
let s:vimwiki_defaults.automatic_nested_syntaxes = 1
let s:vimwiki_defaults.auto_export = 0 let s:vimwiki_defaults.auto_export = 0
let s:vimwiki_defaults.auto_toc = 0 let s:vimwiki_defaults.auto_toc = 0
" is wiki temporary -- was added to g:vimwiki_list by opening arbitrary wiki " is wiki temporary -- was added to g:vimwiki_list by opening arbitrary wiki

View File

@ -600,7 +600,10 @@ call vimwiki#u#reload_regexes_custom()
let b:current_syntax="vimwiki" let b:current_syntax="vimwiki"
" EMBEDDED syntax setup "{{{ " EMBEDDED syntax setup "{{{
let s:nested = extend(VimwikiGet('nested_syntaxes'), vimwiki#base#detect_nested_syntax()) let s:nested = VimwikiGet('nested_syntaxes')
if VimwikiGet('automatic_nested_syntaxes')
let s:nested = extend(s:nested, vimwiki#base#detect_nested_syntax())
endif
if !empty(s:nested) if !empty(s:nested)
for [s:hl_syntax, s:vim_syntax] in items(s:nested) for [s:hl_syntax, s:vim_syntax] in items(s:nested)
call vimwiki#base#nested_syntax(s:vim_syntax, call vimwiki#base#nested_syntax(s:vim_syntax,