parent
fea76ace23
commit
31760a7ef7
@ -81,7 +81,7 @@ function! vimwiki#base#find_wiki(path) "{{{
|
|||||||
return idx
|
return idx
|
||||||
endif
|
endif
|
||||||
let idx += 1
|
let idx += 1
|
||||||
endwhile
|
endfor
|
||||||
|
|
||||||
" an orphan page has been detected
|
" an orphan page has been detected
|
||||||
return -1
|
return -1
|
||||||
@ -1128,7 +1128,7 @@ endfunction " }}}
|
|||||||
" vimwiki#base#go_back_link
|
" vimwiki#base#go_back_link
|
||||||
function! vimwiki#base#go_back_link() "{{{
|
function! vimwiki#base#go_back_link() "{{{
|
||||||
let prev_link = vimwiki#vars#get_bufferlocal('prev_link')
|
let prev_link = vimwiki#vars#get_bufferlocal('prev_link')
|
||||||
if prev_link !=# ''
|
if !empty(prev_link)
|
||||||
" go back to saved wiki link
|
" go back to saved wiki link
|
||||||
execute ":e ".substitute(prev_link[0], '\s', '\\\0', 'g')
|
execute ":e ".substitute(prev_link[0], '\s', '\\\0', 'g')
|
||||||
call setpos('.', prev_link[1])
|
call setpos('.', prev_link[1])
|
||||||
|
@ -559,7 +559,7 @@ function! s:process_tags_typefaces(line, header_ids) "{{{
|
|||||||
let line = a:line
|
let line = a:line
|
||||||
let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxItalic'), 's:tag_em')
|
let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxItalic'), 's:tag_em')
|
||||||
let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxBold'), 's:tag_strong', a:header_ids)
|
let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxBold'), 's:tag_strong', a:header_ids)
|
||||||
let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxTodo'), 's:tag_todo')
|
let line = s:make_tag(line, vimwiki#vars#get_global('rxTodo'), 's:tag_todo')
|
||||||
let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxDelText'), 's:tag_strike')
|
let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxDelText'), 's:tag_strike')
|
||||||
let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxSuperScript'), 's:tag_super')
|
let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxSuperScript'), 's:tag_super')
|
||||||
let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxSubScript'), 's:tag_sub')
|
let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxSubScript'), 's:tag_sub')
|
||||||
|
@ -6,11 +6,6 @@
|
|||||||
|
|
||||||
" MISC helper functions {{{
|
" MISC helper functions {{{
|
||||||
|
|
||||||
" vimwiki#markdown_base#reset_mkd_refs
|
|
||||||
function! vimwiki#markdown_base#reset_mkd_refs() "{{{
|
|
||||||
call vimwiki#vars#set_bufferlocal('markdown_refs', {})
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
" vimwiki#markdown_base#scan_reflinks
|
" vimwiki#markdown_base#scan_reflinks
|
||||||
function! vimwiki#markdown_base#scan_reflinks() " {{{
|
function! vimwiki#markdown_base#scan_reflinks() " {{{
|
||||||
let mkd_refs = {}
|
let mkd_refs = {}
|
||||||
@ -35,29 +30,12 @@ function! vimwiki#markdown_base#scan_reflinks() " {{{
|
|||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
|
|
||||||
" vimwiki#markdown_base#get_reflinks
|
|
||||||
function! vimwiki#markdown_base#get_reflinks() " {{{
|
|
||||||
let done = 1
|
|
||||||
try
|
|
||||||
let mkd_refs = vimwiki#vars#get_bufferlocal('markdown_refs')
|
|
||||||
catch
|
|
||||||
" work-around hack
|
|
||||||
let done = 0
|
|
||||||
" ... the following command does not work inside catch block !?
|
|
||||||
" > let mkd_refs = vimwiki#markdown_base#scan_reflinks()
|
|
||||||
endtry
|
|
||||||
if !done
|
|
||||||
let mkd_refs = vimwiki#markdown_base#scan_reflinks()
|
|
||||||
endif
|
|
||||||
return mkd_refs
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
" vimwiki#markdown_base#open_reflink
|
" vimwiki#markdown_base#open_reflink
|
||||||
" try markdown reference links
|
" try markdown reference links
|
||||||
function! vimwiki#markdown_base#open_reflink(link) " {{{
|
function! vimwiki#markdown_base#open_reflink(link) " {{{
|
||||||
" echom "vimwiki#markdown_base#open_reflink"
|
" echom "vimwiki#markdown_base#open_reflink"
|
||||||
let link = a:link
|
let link = a:link
|
||||||
let mkd_refs = vimwiki#markdown_base#get_reflinks()
|
let mkd_refs = vimwiki#vars#get_bufferlocal('markdown_refs')
|
||||||
if has_key(mkd_refs, link)
|
if has_key(mkd_refs, link)
|
||||||
let url = mkd_refs[link]
|
let url = mkd_refs[link]
|
||||||
call vimwiki#base#system_open_link(url)
|
call vimwiki#base#system_open_link(url)
|
||||||
|
@ -383,7 +383,7 @@ function! s:populate_extra_markdown_vars()
|
|||||||
" 0b) match URL within [[URL|DESCRIPTION]]
|
" 0b) match URL within [[URL|DESCRIPTION]]
|
||||||
let mkd_syntax.rxWikiLink0MatchUrl = mkd_syntax.rxWikiLinkMatchUrl
|
let mkd_syntax.rxWikiLink0MatchUrl = mkd_syntax.rxWikiLinkMatchUrl
|
||||||
" 0c) match DESCRIPTION within [[URL|DESCRIPTION]]
|
" 0c) match DESCRIPTION within [[URL|DESCRIPTION]]
|
||||||
let mkd_syntax.rxWikiLink0MatchDescr = g:vimwiki_global_vars.rxWikiLinkMatchDescr
|
let mkd_syntax.rxWikiLink0MatchDescr = mkd_syntax.rxWikiLinkMatchDescr
|
||||||
|
|
||||||
let wikilink_md_prefix = '['
|
let wikilink_md_prefix = '['
|
||||||
let wikilink_md_suffix = ']'
|
let wikilink_md_suffix = ']'
|
||||||
@ -423,25 +423,25 @@ function! s:populate_extra_markdown_vars()
|
|||||||
|
|
||||||
" 1. match [URL][], [DESCRIPTION][URL]
|
" 1. match [URL][], [DESCRIPTION][URL]
|
||||||
let mkd_syntax.rxWikiLink1 = mkd_syntax.rx_wikilink_md_prefix.
|
let mkd_syntax.rxWikiLink1 = mkd_syntax.rx_wikilink_md_prefix.
|
||||||
\ mkd_syntax.rxWikiLink1Url. mkd_syntax.rx_wikilink_md_separator.
|
\ mkd_syntax.rxWikiLink1Url. rx_wikilink_md_separator.
|
||||||
\ mkd_syntax.rx_wikilink_md_suffix.
|
\ mkd_syntax.rx_wikilink_md_suffix.
|
||||||
\ '\|'. mkd_syntax.rx_wikilink_md_prefix.
|
\ '\|'. mkd_syntax.rx_wikilink_md_prefix.
|
||||||
\ mkd_syntax.rxWikiLink1Descr . mkd_syntax.rx_wikilink_md_separator.
|
\ mkd_syntax.rxWikiLink1Descr . rx_wikilink_md_separator.
|
||||||
\ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix
|
\ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix
|
||||||
" 2. match URL within [URL][], [DESCRIPTION][URL]
|
" 2. match URL within [URL][], [DESCRIPTION][URL]
|
||||||
let mkd_syntax.rxWikiLink1MatchUrl = mkd_syntax.rx_wikilink_md_prefix.
|
let mkd_syntax.rxWikiLink1MatchUrl = mkd_syntax.rx_wikilink_md_prefix.
|
||||||
\ '\zs'. mkd_syntax.rxWikiLink1Url. '\ze'. mkd_syntax.rx_wikilink_md_separator.
|
\ '\zs'. mkd_syntax.rxWikiLink1Url. '\ze'. rx_wikilink_md_separator.
|
||||||
\ mkd_syntax.rx_wikilink_md_suffix.
|
\ mkd_syntax.rx_wikilink_md_suffix.
|
||||||
\ '\|'. mkd_syntax.rx_wikilink_md_prefix.
|
\ '\|'. mkd_syntax.rx_wikilink_md_prefix.
|
||||||
\ mkd_syntax.rxWikiLink1Descr. mkd_syntax.rx_wikilink_md_separator.
|
\ mkd_syntax.rxWikiLink1Descr. rx_wikilink_md_separator.
|
||||||
\ '\zs'. mkd_syntax.rxWikiLink1Url. '\ze'. mkd_syntax.rx_wikilink_md_suffix
|
\ '\zs'. mkd_syntax.rxWikiLink1Url. '\ze'. mkd_syntax.rx_wikilink_md_suffix
|
||||||
" 3. match DESCRIPTION within [DESCRIPTION][URL]
|
" 3. match DESCRIPTION within [DESCRIPTION][URL]
|
||||||
let mkd_syntax.rxWikiLink1MatchDescr = mkd_syntax.rx_wikilink_md_prefix.
|
let mkd_syntax.rxWikiLink1MatchDescr = mkd_syntax.rx_wikilink_md_prefix.
|
||||||
\ '\zs'. mkd_syntax.rxWikiLink1Descr.'\ze'. mkd_syntax.rx_wikilink_md_separator.
|
\ '\zs'. mkd_syntax.rxWikiLink1Descr.'\ze'. rx_wikilink_md_separator.
|
||||||
\ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix
|
\ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix
|
||||||
|
|
||||||
let mkd_syntax.rxWikiLink1Prefix1 = mkd_syntax.rx_wikilink_md_prefix
|
let mkd_syntax.rxWikiLink1Prefix1 = mkd_syntax.rx_wikilink_md_prefix
|
||||||
let mkd_syntax.rxWikiLink1Suffix1 = mkd_syntax.rx_wikilink_md_separator.
|
let mkd_syntax.rxWikiLink1Suffix1 = rx_wikilink_md_separator.
|
||||||
\ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix
|
\ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix
|
||||||
|
|
||||||
" 1. match ANY wikilink
|
" 1. match ANY wikilink
|
||||||
@ -508,14 +508,14 @@ function! s:populate_extra_markdown_vars()
|
|||||||
\ mkd_syntax.rxWeblink1MatchDescr.'\|'.
|
\ mkd_syntax.rxWeblink1MatchDescr.'\|'.
|
||||||
\ mkd_syntax.rxWeblinkMatchDescr0
|
\ mkd_syntax.rxWeblinkMatchDescr0
|
||||||
|
|
||||||
let g:vimwiki_rxAnyLink = g:vimwiki_rxWikiLink.'\|'.
|
let mkd_syntax.rxAnyLink = mkd_syntax.rxWikiLink.'\|'.
|
||||||
\ g:vimwiki_rxWikiIncl.'\|'.mkd_syntax.rxWeblink
|
\ g:vimwiki_global_vars.rxWikiIncl.'\|'.mkd_syntax.rxWeblink
|
||||||
|
|
||||||
let mkd_syntax.rxMkdRef = '\['.g:vimwiki_global_vars.rxWikiLinkDescr.']:\%(\s\+\|\n\)'.
|
let mkd_syntax.rxMkdRef = '\['.g:vimwiki_global_vars.rxWikiLinkDescr.']:\%(\s\+\|\n\)'.
|
||||||
\ mkd_syntax.rxWeblink0
|
\ mkd_syntax.rxWeblink0
|
||||||
let g:vimwiki_rxMkdRefMatchDescr = '\[\zs'.g:vimwiki_global_vars.rxWikiLinkDescr.'\ze]:\%(\s\+\|\n\)'.
|
let mkd_syntax.rxMkdRefMatchDescr = '\[\zs'.g:vimwiki_global_vars.rxWikiLinkDescr.'\ze]:\%(\s\+\|\n\)'.
|
||||||
\ mkd_syntax.rxWeblink0
|
\ mkd_syntax.rxWeblink0
|
||||||
let g:vimwiki_rxMkdRefMatchUrl = '\['.g:vimwiki_global_vars.rxWikiLinkDescr.']:\%(\s\+\|\n\)\zs'.
|
let mkd_syntax.rxMkdRefMatchUrl = '\['.g:vimwiki_global_vars.rxWikiLinkDescr.']:\%(\s\+\|\n\)\zs'.
|
||||||
\ mkd_syntax.rxWeblink0.'\ze'
|
\ mkd_syntax.rxWeblink0.'\ze'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -562,9 +562,13 @@ function! vimwiki#vars#get_bufferlocal(key, ...)
|
|||||||
call setbufvar(buffer, 'vimwiki_existing_wikidirs',
|
call setbufvar(buffer, 'vimwiki_existing_wikidirs',
|
||||||
\ vimwiki#base#get_wiki_directories(vimwiki#vars#get_bufferlocal('wiki_nr')))
|
\ vimwiki#base#get_wiki_directories(vimwiki#vars#get_bufferlocal('wiki_nr')))
|
||||||
elseif a:key ==# 'prev_link'
|
elseif a:key ==# 'prev_link'
|
||||||
call setbufvar(buffer, 'vimwiki_prev_link', '')
|
call setbufvar(buffer, 'vimwiki_prev_link', [])
|
||||||
elseif a:key ==# 'fs_rescan'
|
elseif a:key ==# 'fs_rescan'
|
||||||
call setbufvar(buffer, 'vimwiki_fs_rescan', 0)
|
call setbufvar(buffer, 'vimwiki_fs_rescan', 0)
|
||||||
|
elseif a:key ==# 'markdown_refs'
|
||||||
|
call setbufvar(buffer, 'vimwiki_markdown_refs', vimwiki#markdown_base#scan_reflinks())
|
||||||
|
else
|
||||||
|
echoerr 'Vimwiki Error: unknown buffer variable ' . string(a:key)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return getbufvar(buffer, 'vimwiki_'.a:key)
|
return getbufvar(buffer, 'vimwiki_'.a:key)
|
||||||
|
@ -30,8 +30,7 @@ function! s:wrap_wikilink1_rx(target) "{{{
|
|||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! s:existing_mkd_refs() "{{{
|
function! s:existing_mkd_refs() "{{{
|
||||||
call vimwiki#markdown_base#reset_mkd_refs()
|
return keys(vimwiki#markdown_base#scan_reflinks())
|
||||||
return keys(vimwiki#markdown_base#get_reflinks())
|
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! s:highlight_existing_links() "{{{
|
function! s:highlight_existing_links() "{{{
|
||||||
@ -121,7 +120,7 @@ call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1')
|
|||||||
|
|
||||||
" Header levels, 1-6
|
" Header levels, 1-6
|
||||||
for s:i in range(1,6)
|
for s:i in range(1,6)
|
||||||
execute 'syntax match VimwikiHeader'.s:i.' /'.vimwiki#vars#get_syntaxlocalg('rxH'.s:i).'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
execute 'syntax match VimwikiHeader'.s:i.' /'.vimwiki#vars#get_syntaxlocal('rxH'.s:i).'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
Loading…
Reference in New Issue
Block a user