Util: add vimwiki#vars#set_syntaxlocal function for consistency

This commit is contained in:
Tinmarino
2023-06-14 10:42:23 -04:00
parent cd9cfd299e
commit d63948d873
+22
View File
@@ -1606,6 +1606,28 @@ function! vimwiki#vars#get_syntaxlocal(key, ...) abort
endfunction endfunction
function! vimwiki#vars#set_syntaxlocal(key, value, ...) abort
" Set syntax variable
" Param: 1: key (<string>)
" Param: 2: value (<any type>)
" Param: (3): syntax name (<string> ex:'markdown')
" Set desired syntax variable to value
if a:0
let syntax = a:1
else
let syntax = vimwiki#vars#get_wikilocal('syntax')
endif
" Create syntax variable dict if not exists (lazy)
if !exists('g:vimwiki_syntaxlocal_vars') || !has_key(g:vimwiki_syntaxlocal_vars, syntax)
call vimwiki#vars#populate_syntax_vars(syntax)
endif
" Set d_syntax[a:key]
let g:vimwiki_syntaxlocal_vars[syntax][a:key] = a:value
endfunction
function! vimwiki#vars#get_bufferlocal(key, ...) abort function! vimwiki#vars#get_bufferlocal(key, ...) abort
" Return: buffer local variable " Return: buffer local variable
" for the buffer we are currently in or for the given buffer (number or name). " for the buffer we are currently in or for the given buffer (number or name).