Do not load whole syntax file for a buffer twice.
Load twice only regexes for a concrete syntax.
This commit is contained in:
parent
79b78dc9ee
commit
58e072fa92
@ -78,3 +78,13 @@ endfunction "}}}
|
||||
function! vimwiki#u#escape(string) "{{{
|
||||
return escape(a:string, '.*[]\^$')
|
||||
endfunction "}}}
|
||||
|
||||
" Load concrete Wiki syntax: sets regexes and templates for headers and links
|
||||
function vimwiki#u#reload_regexes() "{{{
|
||||
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'.vim'
|
||||
endfunction "}}}
|
||||
|
||||
" Load syntax-specific functionality
|
||||
function vimwiki#u#reload_regexes_custom() "{{{
|
||||
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'_custom.vim'
|
||||
endfunction "}}}
|
||||
|
@ -7,7 +7,8 @@ if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1 " Don't load another plugin for this buffer
|
||||
execute 'runtime! syntax/vimwiki.vim'
|
||||
|
||||
call vimwiki#u#reload_regexes()
|
||||
|
||||
" UNDO list {{{
|
||||
" Reset the following options to undo this plugin.
|
||||
|
@ -9,6 +9,7 @@ if version < 600
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
"TODO do nothing if ...? (?)
|
||||
let starttime = reltime() " start the clock
|
||||
if VimwikiGet('maxhi')
|
||||
@ -43,10 +44,8 @@ let g:vimwiki_rxWeblinkUrl = g:vimwiki_rxWebProtocols .
|
||||
|
||||
" }}}
|
||||
|
||||
" -------------------------------------------------------------------------
|
||||
" Load concrete Wiki syntax: sets regexes and templates for headers and links
|
||||
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'.vim'
|
||||
" -------------------------------------------------------------------------
|
||||
call vimwiki#u#reload_regexes()
|
||||
|
||||
let time0 = vimwiki#u#time(starttime) "XXX
|
||||
|
||||
" LINKS: setup of larger regexes {{{
|
||||
@ -399,10 +398,7 @@ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
syntax match VimwikiCellSeparator
|
||||
\ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
|
||||
|
||||
" List items
|
||||
let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s'
|
||||
let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.join(g:vimwiki_listsyms, '').']\)\]\s\)\?'
|
||||
|
||||
" Lists
|
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListItemWithoutCB.'/'
|
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListDefine.'/'
|
||||
execute 'syntax match VimwikiListTodo /'.g:vimwiki_rxListItem.'/'
|
||||
@ -577,10 +573,8 @@ hi def link VimwikiLinkCharT VimwikiLinkT
|
||||
hi def link VimwikiNoExistsLinkCharT VimwikiNoExistsLinkT
|
||||
"}}}
|
||||
|
||||
" -------------------------------------------------------------------------
|
||||
" Load syntax-specific functionality
|
||||
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'_custom.vim'
|
||||
" -------------------------------------------------------------------------
|
||||
call vimwiki#u#reload_regexes_custom()
|
||||
|
||||
" FIXME it now does not make sense to pretend there is a single syntax "vimwiki"
|
||||
let b:current_syntax="vimwiki"
|
||||
|
@ -80,8 +80,10 @@ let g:vimwiki_number_types = ['1)', '1.', 'i)', 'I)', 'a)', 'A)']
|
||||
"it is used for i_<C-L><C-J> among other things
|
||||
let g:vimwiki_list_markers = ['-', '•', '1.', '*', 'I)', 'a)']
|
||||
let g:vimwiki_rxListDefine = '::\(\s\|$\)'
|
||||
|
||||
call vimwiki#lst#setup_marker_infos()
|
||||
|
||||
let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s'
|
||||
let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.join(g:vimwiki_listsyms, '').']\)\]\s\)\?'
|
||||
let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
|
||||
|
||||
" Preformatted text
|
||||
|
@ -78,6 +78,9 @@ let g:vimwiki_number_types = ['1.']
|
||||
let g:vimwiki_list_markers = ['-', '*', '+', '1.']
|
||||
let g:vimwiki_rxListDefine = '::\%(\s\|$\)'
|
||||
call vimwiki#lst#setup_marker_infos()
|
||||
|
||||
let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s'
|
||||
let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.join(g:vimwiki_listsyms, '').']\)\]\s\)\?'
|
||||
let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
|
||||
|
||||
" Preformatted text
|
||||
|
@ -59,7 +59,10 @@ let g:vimwiki_number_types = []
|
||||
let g:vimwiki_list_markers = ['*', '#']
|
||||
let g:vimwiki_rxListDefine = '^\%(;\|:\)\s'
|
||||
call vimwiki#lst#setup_marker_infos()
|
||||
let g:vimwiki_rxListItemAndChildren = '^\('.g:vimwiki_rxListBullet.'\)\s\+\['.g:vimwiki_listsyms[4].'\]\s.*\%(\n\%(\1\%('.g:vimwiki_rxListBullet.'\).*\|^$\|^\s.*\)\)*'
|
||||
|
||||
let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s'
|
||||
let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.join(g:vimwiki_listsyms, '').']\)\]\s\)\?'
|
||||
let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
|
||||
|
||||
" Preformatted text
|
||||
let g:vimwiki_rxPreStart = '<pre>'
|
||||
|
Loading…
Reference in New Issue
Block a user