Config: make vimwiki_markdown_link_ext wikilocal
This commit is contained in:
parent
d5964f0c84
commit
4672deb44e
@ -2255,7 +2255,7 @@ endfunction
|
|||||||
" [__LinkDescription__](__LinkUrl__.FileExtension)
|
" [__LinkDescription__](__LinkUrl__.FileExtension)
|
||||||
function! vimwiki#base#normalize_link_helper(str, rxUrl, rxDesc, template) abort
|
function! vimwiki#base#normalize_link_helper(str, rxUrl, rxDesc, template) abort
|
||||||
let url = matchstr(a:str, a:rxUrl)
|
let url = matchstr(a:str, a:rxUrl)
|
||||||
if vimwiki#vars#get_wikilocal('syntax') ==# 'markdown' && vimwiki#vars#get_global('markdown_link_ext')
|
if vimwiki#vars#get_wikilocal('syntax') ==# 'markdown' && vimwiki#vars#get_wikilocal('markdown_link_ext')
|
||||||
" Strip the extension if it exists so it doesn't get added multiple times
|
" Strip the extension if it exists so it doesn't get added multiple times
|
||||||
let url = substitute(url, '\'.vimwiki#vars#get_wikilocal('ext').'$', '', '')
|
let url = substitute(url, '\'.vimwiki#vars#get_wikilocal('ext').'$', '', '')
|
||||||
endif
|
endif
|
||||||
@ -2406,11 +2406,9 @@ function! s:normalize_link_syntax_v() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" Normalize link
|
" Normalize link (Implemented as a switch function)
|
||||||
function! vimwiki#base#normalize_link(is_visual_mode) abort
|
function! vimwiki#base#normalize_link(is_visual_mode) abort
|
||||||
" Switch implementation
|
|
||||||
" If visual mode
|
" If visual mode
|
||||||
" TODO elseif line("'<") == line("'>")
|
|
||||||
if a:is_visual_mode
|
if a:is_visual_mode
|
||||||
return s:normalize_link_syntax_v()
|
return s:normalize_link_syntax_v()
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
let s:margin_set_by_user = 0
|
let s:margin_set_by_user = 0
|
||||||
|
|
||||||
|
|
||||||
" Helper, Init global and local variables
|
" Init global and local variables
|
||||||
function! vimwiki#vars#init() abort
|
function! vimwiki#vars#init() abort
|
||||||
call s:populate_global_variables()
|
call s:populate_global_variables()
|
||||||
call s:populate_wikilocal_options()
|
call s:populate_wikilocal_options()
|
||||||
@ -201,7 +201,6 @@ function! s:read_global_settings_from_user() abort
|
|||||||
\ 'listsym_rejected': {'type': type(''), 'default': '-', 'length': 1},
|
\ 'listsym_rejected': {'type': type(''), 'default': '-', 'length': 1},
|
||||||
\ 'map_prefix': {'type': type(''), 'default': '<Leader>w'},
|
\ 'map_prefix': {'type': type(''), 'default': '<Leader>w'},
|
||||||
\ 'markdown_header_style': {'type': type(0), 'default': 1, 'min':0, 'max': 2},
|
\ 'markdown_header_style': {'type': type(0), 'default': 1, 'min':0, 'max': 2},
|
||||||
\ 'markdown_link_ext': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
|
||||||
\ 'menu': {'type': type(''), 'default': 'Vimwiki'},
|
\ 'menu': {'type': type(''), 'default': 'Vimwiki'},
|
||||||
\ 'table_auto_fmt': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
|
\ 'table_auto_fmt': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
|
||||||
\ 'table_reduce_last_col': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
\ 'table_reduce_last_col': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||||
@ -352,6 +351,7 @@ function! s:populate_wikilocal_options() abort
|
|||||||
let g:vimwiki_wikilocal_vars = []
|
let g:vimwiki_wikilocal_vars = []
|
||||||
|
|
||||||
" Declare default values
|
" Declare default values
|
||||||
|
" Please: keep alphabetical sort
|
||||||
let default_values = {
|
let default_values = {
|
||||||
\ 'auto_diary_index': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
\ 'auto_diary_index': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||||
\ 'auto_export': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
\ 'auto_export': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||||
@ -373,9 +373,15 @@ function! s:populate_wikilocal_options() abort
|
|||||||
\ 'diary_sort': {'type': type(''), 'default': 'desc', 'possible_values': ['asc', 'desc']},
|
\ 'diary_sort': {'type': type(''), 'default': 'desc', 'possible_values': ['asc', 'desc']},
|
||||||
\ 'exclude_files': {'type': type([]), 'default': []},
|
\ 'exclude_files': {'type': type([]), 'default': []},
|
||||||
\ 'ext': {'type': type(''), 'default': '.wiki', 'min_length': 1},
|
\ 'ext': {'type': type(''), 'default': '.wiki', 'min_length': 1},
|
||||||
|
\ 'bullet_types': {'type': type([]), 'default': []},
|
||||||
|
\ 'cycle_bullets': {'type': type(0), 'default': 0},
|
||||||
|
\ 'html_filename_parameterization': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||||
\ 'index': {'type': type(''), 'default': 'index', 'min_length': 1},
|
\ 'index': {'type': type(''), 'default': 'index', 'min_length': 1},
|
||||||
\ 'links_space_char': {'type': type(''), 'default': ' ', 'min_length': 1},
|
\ 'links_space_char': {'type': type(''), 'default': ' ', 'min_length': 1},
|
||||||
\ 'list_margin': {'type': type(0), 'default': -1, 'min': -1},
|
\ 'list_margin': {'type': type(0), 'default': -1, 'min': -1},
|
||||||
|
\ 'listsym_rejected': {'type': type(''), 'default': vimwiki#vars#get_global('listsym_rejected')},
|
||||||
|
\ 'listsyms': {'type': type(''), 'default': vimwiki#vars#get_global('listsyms')},
|
||||||
|
\ 'markdown_link_ext': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||||
\ 'maxhi': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
\ 'maxhi': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||||
\ 'name': {'type': type(''), 'default': ''},
|
\ 'name': {'type': type(''), 'default': ''},
|
||||||
\ 'nested_syntaxes': {'type': type({}), 'default': {}},
|
\ 'nested_syntaxes': {'type': type({}), 'default': {}},
|
||||||
@ -388,11 +394,6 @@ function! s:populate_wikilocal_options() abort
|
|||||||
\ 'template_default': {'type': type(''), 'default': 'default', 'min_length': 1},
|
\ 'template_default': {'type': type(''), 'default': 'default', 'min_length': 1},
|
||||||
\ 'template_ext': {'type': type(''), 'default': '.tpl'},
|
\ 'template_ext': {'type': type(''), 'default': '.tpl'},
|
||||||
\ 'template_path': {'type': type(''), 'default': $HOME . '/vimwiki/templates/'},
|
\ 'template_path': {'type': type(''), 'default': $HOME . '/vimwiki/templates/'},
|
||||||
\ 'html_filename_parameterization': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
|
||||||
\ 'bullet_types': {'type': type([]), 'default': []},
|
|
||||||
\ 'cycle_bullets': {'type': type(0), 'default': 0},
|
|
||||||
\ 'listsyms': {'type': type(''), 'default': vimwiki#vars#get_global('listsyms')},
|
|
||||||
\ 'listsym_rejected': {'type': type(''), 'default': vimwiki#vars#get_global('listsym_rejected')},
|
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
" Fill default setting <- user or plugin values
|
" Fill default setting <- user or plugin values
|
||||||
@ -593,6 +594,7 @@ function! vimwiki#vars#populate_syntax_vars(syntax) abort
|
|||||||
|
|
||||||
" Init syntax variable dictionary
|
" Init syntax variable dictionary
|
||||||
let g:vimwiki_syntax_variables[a:syntax] = {}
|
let g:vimwiki_syntax_variables[a:syntax] = {}
|
||||||
|
let syntax_dic = g:vimwiki_syntax_variables[a:syntax]
|
||||||
|
|
||||||
" Autoload default syntax file
|
" Autoload default syntax file
|
||||||
execute 'runtime! syntax/vimwiki_'.a:syntax.'.vim'
|
execute 'runtime! syntax/vimwiki_'.a:syntax.'.vim'
|
||||||
@ -646,66 +648,66 @@ function! vimwiki#vars#populate_syntax_vars(syntax) abort
|
|||||||
\ '^\s*\('.header_symbol.'\{1,6}\)\zs[^'.header_symbol.'].*\ze$'
|
\ '^\s*\('.header_symbol.'\{1,6}\)\zs[^'.header_symbol.'].*\ze$'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxPreStart =
|
let syntax_dic.rxPreStart =
|
||||||
\ '^\s*'.g:vimwiki_syntax_variables[a:syntax].rxPreStart
|
\ '^\s*'.syntax_dic.rxPreStart
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxPreEnd =
|
let syntax_dic.rxPreEnd =
|
||||||
\ '^\s*'.g:vimwiki_syntax_variables[a:syntax].rxPreEnd.'\s*$'
|
\ '^\s*'.syntax_dic.rxPreEnd.'\s*$'
|
||||||
|
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxMathStart =
|
let syntax_dic.rxMathStart =
|
||||||
\ '^\s*'.g:vimwiki_syntax_variables[a:syntax].rxMathStart
|
\ '^\s*'.syntax_dic.rxMathStart
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxMathEnd =
|
let syntax_dic.rxMathEnd =
|
||||||
\ '^\s*'.g:vimwiki_syntax_variables[a:syntax].rxMathEnd.'\s*$'
|
\ '^\s*'.syntax_dic.rxMathEnd.'\s*$'
|
||||||
|
|
||||||
let g:vimwiki_syntax_variables[a:syntax].number_kinds = []
|
let syntax_dic.number_kinds = []
|
||||||
let g:vimwiki_syntax_variables[a:syntax].number_divisors = ''
|
let syntax_dic.number_divisors = ''
|
||||||
for i in g:vimwiki_syntax_variables[a:syntax].number_types
|
for i in syntax_dic.number_types
|
||||||
call add(g:vimwiki_syntax_variables[a:syntax].number_kinds, i[0])
|
call add(syntax_dic.number_kinds, i[0])
|
||||||
let g:vimwiki_syntax_variables[a:syntax].number_divisors .= vimwiki#u#escape(i[1])
|
let syntax_dic.number_divisors .= vimwiki#u#escape(i[1])
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
let char_to_rx = {'1': '\d\+', 'i': '[ivxlcdm]\+', 'I': '[IVXLCDM]\+',
|
let char_to_rx = {'1': '\d\+', 'i': '[ivxlcdm]\+', 'I': '[IVXLCDM]\+',
|
||||||
\ 'a': '\l\{1,2}', 'A': '\u\{1,2}'}
|
\ 'a': '\l\{1,2}', 'A': '\u\{1,2}'}
|
||||||
|
|
||||||
" Create regexp for bulleted list items
|
" Create regexp for bulleted list items
|
||||||
if !empty(g:vimwiki_syntax_variables[a:syntax].bullet_types)
|
if !empty(syntax_dic.bullet_types)
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxListBullet =
|
let syntax_dic.rxListBullet =
|
||||||
\ join( map(copy(g:vimwiki_syntax_variables[a:syntax].bullet_types),
|
\ join( map(copy(syntax_dic.bullet_types),
|
||||||
\'vimwiki#u#escape(v:val).'
|
\'vimwiki#u#escape(v:val).'
|
||||||
\ .'repeat("\\+", g:vimwiki_syntax_variables[a:syntax].recurring_bullets)'
|
\ .'repeat("\\+", syntax_dic.recurring_bullets)'
|
||||||
\ ) , '\|')
|
\ ) , '\|')
|
||||||
else
|
else
|
||||||
"regex that matches nothing
|
"regex that matches nothing
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxListBullet = '$^'
|
let syntax_dic.rxListBullet = '$^'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Create regex for numbered list items
|
" Create regex for numbered list items
|
||||||
if !empty(g:vimwiki_syntax_variables[a:syntax].number_types)
|
if !empty(syntax_dic.number_types)
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxListNumber = '\C\%('
|
let syntax_dic.rxListNumber = '\C\%('
|
||||||
for type in g:vimwiki_syntax_variables[a:syntax].number_types[:-2]
|
for type in syntax_dic.number_types[:-2]
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxListNumber .= char_to_rx[type[0]] .
|
let syntax_dic.rxListNumber .= char_to_rx[type[0]] .
|
||||||
\ vimwiki#u#escape(type[1]) . '\|'
|
\ vimwiki#u#escape(type[1]) . '\|'
|
||||||
endfor
|
endfor
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxListNumber .=
|
let syntax_dic.rxListNumber .=
|
||||||
\ char_to_rx[g:vimwiki_syntax_variables[a:syntax].number_types[-1][0]].
|
\ char_to_rx[syntax_dic.number_types[-1][0]].
|
||||||
\ vimwiki#u#escape(g:vimwiki_syntax_variables[a:syntax].number_types[-1][1]) . '\)'
|
\ vimwiki#u#escape(syntax_dic.number_types[-1][1]) . '\)'
|
||||||
else
|
else
|
||||||
"regex that matches nothing
|
"regex that matches nothing
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxListNumber = '$^'
|
let syntax_dic.rxListNumber = '$^'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L))
|
" 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L))
|
||||||
" let g:vimwiki_rxWeblink = '[\["(|]\@<!'. g:vimwiki_rxWeblinkUrl .
|
" let g:vimwiki_rxWeblink = '[\["(|]\@<!'. g:vimwiki_rxWeblinkUrl .
|
||||||
" \ '\%([),:;.!?]\=\%([ \t]\|$\)\)\@='
|
" \ '\%([),:;.!?]\=\%([ \t]\|$\)\)\@='
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxWeblink =
|
let syntax_dic.rxWeblink =
|
||||||
\ '\<'. g:vimwiki_global_vars.rxWeblinkUrl . '[^[:space:]><]*'
|
\ '\<'. g:vimwiki_global_vars.rxWeblinkUrl . '[^[:space:]><]*'
|
||||||
" 0a) match URL within URL
|
" 0a) match URL within URL
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxWeblinkMatchUrl =
|
let syntax_dic.rxWeblinkMatchUrl =
|
||||||
\ g:vimwiki_syntax_variables[a:syntax].rxWeblink
|
\ syntax_dic.rxWeblink
|
||||||
" 0b) match DESCRIPTION within URL
|
" 0b) match DESCRIPTION within URL
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxWeblinkMatchDescr = ''
|
let syntax_dic.rxWeblinkMatchDescr = ''
|
||||||
|
|
||||||
" template for matching all wiki links with a given target file
|
" template for matching all wiki links with a given target file
|
||||||
let g:vimwiki_syntax_variables[a:syntax].WikiLinkMatchUrlTemplate =
|
let syntax_dic.WikiLinkMatchUrlTemplate =
|
||||||
\ g:vimwiki_global_vars.rx_wikilink_prefix .
|
\ g:vimwiki_global_vars.rx_wikilink_prefix .
|
||||||
\ '\zs__LinkUrl__\ze\%(#.*\)\?' .
|
\ '\zs__LinkUrl__\ze\%(#.*\)\?' .
|
||||||
\ g:vimwiki_global_vars.rx_wikilink_suffix .
|
\ g:vimwiki_global_vars.rx_wikilink_suffix .
|
||||||
@ -717,19 +719,19 @@ function! vimwiki#vars#populate_syntax_vars(syntax) abort
|
|||||||
\ g:vimwiki_global_vars.rx_wikilink_suffix
|
\ g:vimwiki_global_vars.rx_wikilink_suffix
|
||||||
|
|
||||||
" a) match [[URL|DESCRIPTION]]
|
" a) match [[URL|DESCRIPTION]]
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxWikiLink = g:vimwiki_global_vars.rx_wikilink_prefix.
|
let syntax_dic.rxWikiLink = g:vimwiki_global_vars.rx_wikilink_prefix.
|
||||||
\ g:vimwiki_global_vars.rxWikiLinkUrl.'\%('.g:vimwiki_global_vars.rx_wikilink_separator.
|
\ g:vimwiki_global_vars.rxWikiLinkUrl.'\%('.g:vimwiki_global_vars.rx_wikilink_separator.
|
||||||
\ g:vimwiki_global_vars.rxWikiLinkDescr.'\)\?'.g:vimwiki_global_vars.rx_wikilink_suffix
|
\ g:vimwiki_global_vars.rxWikiLinkDescr.'\)\?'.g:vimwiki_global_vars.rx_wikilink_suffix
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxAnyLink =
|
let syntax_dic.rxAnyLink =
|
||||||
\ g:vimwiki_syntax_variables[a:syntax].rxWikiLink.'\|'.
|
\ syntax_dic.rxWikiLink.'\|'.
|
||||||
\ g:vimwiki_global_vars.rxWikiIncl.'\|'.g:vimwiki_syntax_variables[a:syntax].rxWeblink
|
\ g:vimwiki_global_vars.rxWikiIncl.'\|'.syntax_dic.rxWeblink
|
||||||
" b) match URL within [[URL|DESCRIPTION]]
|
" b) match URL within [[URL|DESCRIPTION]]
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxWikiLinkMatchUrl =
|
let syntax_dic.rxWikiLinkMatchUrl =
|
||||||
\ g:vimwiki_global_vars.rx_wikilink_prefix . '\zs'. g:vimwiki_global_vars.rxWikiLinkUrl
|
\ g:vimwiki_global_vars.rx_wikilink_prefix . '\zs'. g:vimwiki_global_vars.rxWikiLinkUrl
|
||||||
\ .'\ze\%('. g:vimwiki_global_vars.rx_wikilink_separator
|
\ .'\ze\%('. g:vimwiki_global_vars.rx_wikilink_separator
|
||||||
\ . g:vimwiki_global_vars.rxWikiLinkDescr.'\)\?'.g:vimwiki_global_vars.rx_wikilink_suffix
|
\ . g:vimwiki_global_vars.rxWikiLinkDescr.'\)\?'.g:vimwiki_global_vars.rx_wikilink_suffix
|
||||||
" c) match DESCRIPTION within [[URL|DESCRIPTION]]
|
" c) match DESCRIPTION within [[URL|DESCRIPTION]]
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxWikiLinkMatchDescr =
|
let syntax_dic.rxWikiLinkMatchDescr =
|
||||||
\ g:vimwiki_global_vars.rx_wikilink_prefix . g:vimwiki_global_vars.rxWikiLinkUrl
|
\ g:vimwiki_global_vars.rx_wikilink_prefix . g:vimwiki_global_vars.rxWikiLinkUrl
|
||||||
\ . g:vimwiki_global_vars.rx_wikilink_separator.'\%(\zs'
|
\ . g:vimwiki_global_vars.rx_wikilink_separator.'\%(\zs'
|
||||||
\ . g:vimwiki_global_vars.rxWikiLinkDescr. '\ze\)\?'
|
\ . g:vimwiki_global_vars.rxWikiLinkDescr. '\ze\)\?'
|
||||||
@ -881,7 +883,7 @@ function! s:populate_extra_markdown_vars() abort
|
|||||||
let mkd_syntax.rxWeblink1Separator = ']('
|
let mkd_syntax.rxWeblink1Separator = ']('
|
||||||
|
|
||||||
let rxWeblink1Ext = ''
|
let rxWeblink1Ext = ''
|
||||||
if vimwiki#vars#get_global('markdown_link_ext')
|
if vimwiki#vars#get_wikilocal('markdown_link_ext')
|
||||||
let rxWeblink1Ext = '__FileExtension__'
|
let rxWeblink1Ext = '__FileExtension__'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -1,6 +1,36 @@
|
|||||||
Include: vader_includes/vader_setup.vader
|
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
|
# Issues: #382
|
||||||
####################
|
####################
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Before (Define functions):
|
Before (Define functions):
|
||||||
" change the syntax using a temporary wiki
|
" Change the syntax using a temporary wiki
|
||||||
function! SetSyntax(vw_syn)
|
function! SetSyntax(vw_syn)
|
||||||
if a:vw_syn ==# 'default'
|
if a:vw_syn ==# 'default'
|
||||||
let ext = 'wiki'
|
let ext = 'wiki'
|
||||||
@ -29,17 +29,17 @@ Before (Define functions):
|
|||||||
let num_wikis = num_wikis - 1
|
let num_wikis = num_wikis - 1
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" add the new wiki
|
" Add the new wiki
|
||||||
call vimwiki#vars#add_temporary_wiki(new_temp_wiki_settings)
|
call vimwiki#vars#add_temporary_wiki(new_temp_wiki_settings)
|
||||||
call vimwiki#vars#set_bufferlocal('wiki_nr', 3)
|
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.'
|
Assert vimwiki#vars#get_wikilocal('syntax') ==# a:vw_syn, 'ERROR: Vimwiki syntax not set correctly.'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" reload plugin to change settings
|
" Reload plugin to change settings
|
||||||
function! ReloadVimwiki()
|
function! ReloadVimwiki()
|
||||||
" clear mappings so plugin can be reloaded
|
" Clear mappings so plugin can be reloaded
|
||||||
" this is needed if running manually multiple times
|
" this is needed if running manually multiple times
|
||||||
nmapclear
|
nmapclear
|
||||||
|
|
||||||
@ -47,6 +47,12 @@ Before (Define functions):
|
|||||||
source plugin/vimwiki.vim
|
source plugin/vimwiki.vim
|
||||||
endfunction
|
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
|
" Copy wiki test resources so that vimtest user can write them
|
||||||
function! CopyResources()
|
function! CopyResources()
|
||||||
call system('cp -r /testplugin/test/resources/* $HOME/')
|
call system('cp -r /testplugin/test/resources/* $HOME/')
|
||||||
@ -61,7 +67,7 @@ Before (Define functions):
|
|||||||
let tpbl=[]
|
let tpbl=[]
|
||||||
call map(range(1, tabpagenr('$')), 'extend(tpbl, tabpagebuflist(v:val))')
|
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')
|
for buf in filter(range(1, bufnr('$')), 'bufexists(v:val) && index(tpbl, v:val)==-1')
|
||||||
if bufname(buf) =~ 'Vader'
|
if bufname(buf) =~? 'Vader'
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
silent execute 'bwipeout!' buf
|
silent execute 'bwipeout!' buf
|
||||||
@ -89,7 +95,7 @@ Before (Define functions):
|
|||||||
" Destroy a variable is exists (unlet)
|
" Destroy a variable is exists (unlet)
|
||||||
function! DestroyVar(var)
|
function! DestroyVar(var)
|
||||||
if ! exists(a:var) | return | endif
|
if ! exists(a:var) | return | endif
|
||||||
execute "unlet " . a:var
|
execute 'unlet ' . a:var
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Assert current tab is desired tab
|
" Assert current tab is desired tab
|
||||||
|
Loading…
Reference in New Issue
Block a user