Config: make vimwiki_markdown_link_ext wikilocal

This commit is contained in:
Tinmarino
2020-07-26 17:55:47 -04:00
parent d5964f0c84
commit 4672deb44e
4 changed files with 93 additions and 57 deletions

View File

@ -1,6 +1,36 @@
Include: vader_includes/vader_setup.vader
# Visual Creatin {{{1
# vimwiki_markdown_link_ext {{{1
####################
Execute (Log):
Log 'vimwiki_markdown_link_ext'
Given vimwiki (abc def ghi jkl):
abc def ghi jkl
Execute (Set filename wiki_test.md):
Log '>> Visual creation, markdown syntax'
file wiki_test.md
let g:vimwiki_markdown_link_ext = 1
call ReloadVars()
call SetSyntax('markdown')
AssertEqual vimwiki#vars#get_wikilocal('syntax'), 'markdown'
AssertEqual vimwiki#vars#get_wikilocal('markdown_link_ext'), 1
Do (vee<CR>):
vee\<CR>
Expect (append md suffix):
[abc def](abc def.md) ghi jkl
Execute (Restore variable g:vimwiki_markdown_link_ext):
unlet g:vimwiki_markdown_link_ext
call ReloadVars()
# Visual Creation {{{1
# Issues: #382
####################

View File

@ -1,5 +1,5 @@
Before (Define functions):
" change the syntax using a temporary wiki
" Change the syntax using a temporary wiki
function! SetSyntax(vw_syn)
if a:vw_syn ==# 'default'
let ext = 'wiki'
@ -29,17 +29,17 @@ Before (Define functions):
let num_wikis = num_wikis - 1
endwhile
" add the new wiki
" Add the new wiki
call vimwiki#vars#add_temporary_wiki(new_temp_wiki_settings)
call vimwiki#vars#set_bufferlocal('wiki_nr', 3)
" verify syntax was set correctly
" Verify syntax was set correctly
Assert vimwiki#vars#get_wikilocal('syntax') ==# a:vw_syn, 'ERROR: Vimwiki syntax not set correctly.'
endfunction
" reload plugin to change settings
" Reload plugin to change settings
function! ReloadVimwiki()
" clear mappings so plugin can be reloaded
" Clear mappings so plugin can be reloaded
" this is needed if running manually multiple times
nmapclear
@ -47,6 +47,12 @@ Before (Define functions):
source plugin/vimwiki.vim
endfunction
function! ReloadVars()
" vars#init will not reload syntax varaible if not set
unlet g:vimwiki_syntax_variables
call vimwiki#vars#init()
endfunction
" Copy wiki test resources so that vimtest user can write them
function! CopyResources()
call system('cp -r /testplugin/test/resources/* $HOME/')
@ -61,7 +67,7 @@ Before (Define functions):
let tpbl=[]
call map(range(1, tabpagenr('$')), 'extend(tpbl, tabpagebuflist(v:val))')
for buf in filter(range(1, bufnr('$')), 'bufexists(v:val) && index(tpbl, v:val)==-1')
if bufname(buf) =~ 'Vader'
if bufname(buf) =~? 'Vader'
continue
endif
silent execute 'bwipeout!' buf
@ -89,7 +95,7 @@ Before (Define functions):
" Destroy a variable is exists (unlet)
function! DestroyVar(var)
if ! exists(a:var) | return | endif
execute "unlet " . a:var
execute 'unlet ' . a:var
endfunction
" Assert current tab is desired tab