parent
1806d3edfa
commit
b61ff8b5ee
@ -824,7 +824,7 @@ function! s:update_wiki_links_dir(dir, old_fname, new_fname) " {{{
|
|||||||
let new_fname = a:new_fname
|
let new_fname = a:new_fname
|
||||||
|
|
||||||
let old_fname_r = vimwiki#base#apply_template(
|
let old_fname_r = vimwiki#base#apply_template(
|
||||||
\ vimwiki#vars#get_global('WikiLinkMatchUrlTemplate'), old_fname, '', '')
|
\ vimwiki#vars#get_syntaxlocal('WikiLinkMatchUrlTemplate'), old_fname, '', '')
|
||||||
|
|
||||||
let files = split(glob(vimwiki#vars#get_wikilocal('path').a:dir.'*'.vimwiki#vars#get_wikilocal('ext')), '\n')
|
let files = split(glob(vimwiki#vars#get_wikilocal('path').a:dir.'*'.vimwiki#vars#get_wikilocal('ext')), '\n')
|
||||||
for fname in files
|
for fname in files
|
||||||
@ -1056,7 +1056,7 @@ endfunction "}}}
|
|||||||
" WIKI link following functions {{{
|
" WIKI link following functions {{{
|
||||||
" vimwiki#base#find_next_link
|
" vimwiki#base#find_next_link
|
||||||
function! vimwiki#base#find_next_link() "{{{
|
function! vimwiki#base#find_next_link() "{{{
|
||||||
call vimwiki#base#search_word(vimwiki#vars#get_global('rxAnyLink'), '')
|
call vimwiki#base#search_word(vimwiki#vars#get_syntaxlocal('rxAnyLink'), '')
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
" vimwiki#base#find_prev_link
|
" vimwiki#base#find_prev_link
|
||||||
@ -1064,9 +1064,9 @@ function! vimwiki#base#find_prev_link() "{{{
|
|||||||
"Jump 2 times if the cursor is in the middle of a link
|
"Jump 2 times if the cursor is in the middle of a link
|
||||||
if synIDattr(synID(line('.'), col('.'), 0), "name") =~# "VimwikiLink.*" &&
|
if synIDattr(synID(line('.'), col('.'), 0), "name") =~# "VimwikiLink.*" &&
|
||||||
\ synIDattr(synID(line('.'), col('.')-1, 0), "name") =~# "VimwikiLink.*"
|
\ synIDattr(synID(line('.'), col('.')-1, 0), "name") =~# "VimwikiLink.*"
|
||||||
call vimwiki#base#search_word(vimwiki#vars#get_global('rxAnyLink'), 'b')
|
call vimwiki#base#search_word(vimwiki#vars#get_syntaxlocal('rxAnyLink'), 'b')
|
||||||
endif
|
endif
|
||||||
call vimwiki#base#search_word(vimwiki#vars#get_global('rxAnyLink'), 'b')
|
call vimwiki#base#search_word(vimwiki#vars#get_syntaxlocal('rxAnyLink'), 'b')
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
" vimwiki#base#follow_link
|
" vimwiki#base#follow_link
|
||||||
@ -1094,8 +1094,8 @@ function! vimwiki#base#follow_link(split, ...) "{{{ Parse link at cursor and pas
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" try WikiLink
|
" try WikiLink
|
||||||
let lnk = matchstr(vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWikiLink')),
|
let lnk = matchstr(vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink')),
|
||||||
\ vimwiki#vars#get_global('rxWikiLinkMatchUrl'))
|
\ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'))
|
||||||
" try WikiIncl
|
" try WikiIncl
|
||||||
if lnk == ""
|
if lnk == ""
|
||||||
let lnk = matchstr(vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWikiIncl')),
|
let lnk = matchstr(vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWikiIncl')),
|
||||||
@ -1221,7 +1221,7 @@ function! vimwiki#base#rename_link() "{{{
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let url = matchstr(new_link, vimwiki#vars#get_global('rxWikiLinkMatchUrl'))
|
let url = matchstr(new_link, vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'))
|
||||||
if url != ''
|
if url != ''
|
||||||
let new_link = url
|
let new_link = url
|
||||||
endif
|
endif
|
||||||
@ -1763,12 +1763,12 @@ endfunction " }}}
|
|||||||
function! s:normalize_link_syntax_n() " {{{
|
function! s:normalize_link_syntax_n() " {{{
|
||||||
|
|
||||||
" try WikiLink
|
" try WikiLink
|
||||||
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWikiLink'))
|
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink'))
|
||||||
if !empty(lnk)
|
if !empty(lnk)
|
||||||
let sub = vimwiki#base#normalize_link_helper(lnk,
|
let sub = vimwiki#base#normalize_link_helper(lnk,
|
||||||
\ vimwiki#vars#get_global('rxWikiLinkMatchUrl'), vimwiki#vars#get_global('rxWikiLinkMatchDescr'),
|
\ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'), vimwiki#vars#get_global('rxWikiLinkMatchDescr'),
|
||||||
\ vimwiki#vars#get_global('WikiLinkTemplate2'))
|
\ vimwiki#vars#get_global('WikiLinkTemplate2'))
|
||||||
call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_global('rxWikiLink'), sub)
|
call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink'), sub)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ function! s:tag_wikilink(value) "{{{
|
|||||||
" [[url#a1#a2]] -> <a href="url.html#a1-a2">url#a1#a2</a>
|
" [[url#a1#a2]] -> <a href="url.html#a1-a2">url#a1#a2</a>
|
||||||
" [[#a1#a2]] -> <a href="#a1-a2">#a1#a2</a>
|
" [[#a1#a2]] -> <a href="#a1-a2">#a1#a2</a>
|
||||||
let str = a:value
|
let str = a:value
|
||||||
let url = matchstr(str, vimwiki#vars#get_global('rxWikiLinkMatchUrl'))
|
let url = matchstr(str, vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'))
|
||||||
let descr = matchstr(str, vimwiki#vars#get_global('rxWikiLinkMatchDescr'))
|
let descr = matchstr(str, vimwiki#vars#get_global('rxWikiLinkMatchDescr'))
|
||||||
let descr = (substitute(descr,'^\s*\(.*\)\s*$','\1','') != '' ? descr : url)
|
let descr = (substitute(descr,'^\s*\(.*\)\s*$','\1','') != '' ? descr : url)
|
||||||
|
|
||||||
@ -571,7 +571,7 @@ endfunction " }}}
|
|||||||
|
|
||||||
function! s:process_tags_links(line) " {{{
|
function! s:process_tags_links(line) " {{{
|
||||||
let line = a:line
|
let line = a:line
|
||||||
let line = s:make_tag(line, vimwiki#vars#get_global('rxWikiLink'), 's:tag_wikilink')
|
let line = s:make_tag(line, vimwiki#vars#get_syntaxlocal('rxWikiLink'), 's:tag_wikilink')
|
||||||
let line = s:make_tag(line, vimwiki#vars#get_global('rxWikiIncl'), 's:tag_wikiincl')
|
let line = s:make_tag(line, vimwiki#vars#get_global('rxWikiIncl'), 's:tag_wikiincl')
|
||||||
let line = s:make_tag(line, vimwiki#vars#get_global('rxWeblink'), 's:tag_weblink')
|
let line = s:make_tag(line, vimwiki#vars#get_global('rxWeblink'), 's:tag_weblink')
|
||||||
return line
|
return line
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
" vimwiki#markdown_base#reset_mkd_refs
|
" vimwiki#markdown_base#reset_mkd_refs
|
||||||
function! vimwiki#markdown_base#reset_mkd_refs() "{{{
|
function! vimwiki#markdown_base#reset_mkd_refs() "{{{
|
||||||
call VimwikiClear('markdown_refs')
|
call vimwiki#vars#set_bufferlocal('markdown_refs', {})
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
" vimwiki#markdown_base#scan_reflinks
|
" vimwiki#markdown_base#scan_reflinks
|
||||||
@ -92,8 +92,8 @@ function! vimwiki#markdown_base#follow_link(split, ...) "{{{ Parse link at curso
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" try WikiLink
|
" try WikiLink
|
||||||
let lnk = matchstr(vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWikiLink')),
|
let lnk = matchstr(vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink')),
|
||||||
\ vimwiki#vars#get_global('rxWikiLinkMatchUrl'))
|
\ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'))
|
||||||
" try WikiIncl
|
" try WikiIncl
|
||||||
if lnk == ""
|
if lnk == ""
|
||||||
let lnk = matchstr(vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWikiIncl')),
|
let lnk = matchstr(vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_global('rxWikiIncl')),
|
||||||
@ -142,7 +142,7 @@ function! s:normalize_link_syntax_n() " {{{
|
|||||||
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink0'))
|
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink0'))
|
||||||
if !empty(lnk)
|
if !empty(lnk)
|
||||||
let sub = vimwiki#base#normalize_link_helper(lnk,
|
let sub = vimwiki#base#normalize_link_helper(lnk,
|
||||||
\ vimwiki#vars#get_global('rxWikiLinkMatchUrl'), vimwiki#vars#get_global('rxWikiLinkMatchDescr'),
|
\ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'), vimwiki#vars#get_global('rxWikiLinkMatchDescr'),
|
||||||
\ vimwiki#vars#get_syntaxlocal('WikiLink1Template2'))
|
\ vimwiki#vars#get_syntaxlocal('WikiLink1Template2'))
|
||||||
call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink0'), sub)
|
call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink0'), sub)
|
||||||
return
|
return
|
||||||
@ -152,7 +152,7 @@ function! s:normalize_link_syntax_n() " {{{
|
|||||||
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink1'))
|
let lnk = vimwiki#base#matchstr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink1'))
|
||||||
if !empty(lnk)
|
if !empty(lnk)
|
||||||
let sub = vimwiki#base#normalize_link_helper(lnk,
|
let sub = vimwiki#base#normalize_link_helper(lnk,
|
||||||
\ vimwiki#vars#get_global('rxWikiLinkMatchUrl'), vimwiki#vars#get_global('rxWikiLinkMatchDescr'),
|
\ vimwiki#vars#get_syntaxlocal('rxWikiLinkMatchUrl'), vimwiki#vars#get_global('rxWikiLinkMatchDescr'),
|
||||||
\ vimwiki#vars#get_global('WikiLinkTemplate2'))
|
\ vimwiki#vars#get_global('WikiLinkTemplate2'))
|
||||||
call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink1'), sub)
|
call vimwiki#base#replacestr_at_cursor(vimwiki#vars#get_syntaxlocal('rxWikiLink1'), sub)
|
||||||
return
|
return
|
||||||
|
@ -326,7 +326,7 @@ function! vimwiki#tags#generate_tags(...) abort "{{{
|
|||||||
|
|
||||||
let links_rx = '\m\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxH2').'\)\|\%(^\s*'
|
let links_rx = '\m\%(^\s*$\)\|\%('.vimwiki#vars#get_syntaxlocal('rxH2').'\)\|\%(^\s*'
|
||||||
\ .vimwiki#u#escape(vimwiki#lst#default_symbol()).' '
|
\ .vimwiki#u#escape(vimwiki#lst#default_symbol()).' '
|
||||||
\ .vimwiki#vars#get_global('rxWikiLink').'$\)'
|
\ .vimwiki#vars#get_syntaxlocal('rxWikiLink').'$\)'
|
||||||
|
|
||||||
call vimwiki#base#update_listing_in_buffer(lines, 'Generated Tags', links_rx,
|
call vimwiki#base#update_listing_in_buffer(lines, 'Generated Tags', links_rx,
|
||||||
\ line('$')+1, 1)
|
\ line('$')+1, 1)
|
||||||
|
@ -46,11 +46,6 @@ function vimwiki#u#reload_regexes() "{{{
|
|||||||
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'.vim'
|
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'.vim'
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
" Load omnipresent Wiki syntax
|
|
||||||
function vimwiki#u#reload_omni_regexes() "{{{
|
|
||||||
execute 'runtime! syntax/omnipresent_syntax.vim'
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
" Load syntax-specific functionality
|
" Load syntax-specific functionality
|
||||||
function vimwiki#u#reload_regexes_custom() "{{{
|
function vimwiki#u#reload_regexes_custom() "{{{
|
||||||
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'_custom.vim'
|
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'_custom.vim'
|
||||||
|
@ -95,18 +95,6 @@ function! s:populate_global_variables()
|
|||||||
let g:vimwiki_global_vars.WikiLinkTemplate2 = wikilink_prefix . '__LinkUrl__'. wikilink_separator
|
let g:vimwiki_global_vars.WikiLinkTemplate2 = wikilink_prefix . '__LinkUrl__'. wikilink_separator
|
||||||
\ . '__LinkDescription__' . wikilink_suffix
|
\ . '__LinkDescription__' . wikilink_suffix
|
||||||
|
|
||||||
" template for matching all wiki links with a given target file
|
|
||||||
let g:vimwiki_global_vars.WikiLinkMatchUrlTemplate =
|
|
||||||
\ g:vimwiki_global_vars.rx_wikilink_prefix .
|
|
||||||
\ '\zs__LinkUrl__\ze\%(#.*\)\?' .
|
|
||||||
\ g:vimwiki_global_vars.rx_wikilink_suffix .
|
|
||||||
\ '\|' .
|
|
||||||
\ g:vimwiki_global_vars.rx_wikilink_prefix .
|
|
||||||
\ '\zs__LinkUrl__\ze\%(#.*\)\?' .
|
|
||||||
\ g:vimwiki_global_vars.rx_wikilink_separator .
|
|
||||||
\ '.*' .
|
|
||||||
\ g:vimwiki_global_vars.rx_wikilink_suffix
|
|
||||||
|
|
||||||
let valid_chars = '[^\\\]]'
|
let valid_chars = '[^\\\]]'
|
||||||
let g:vimwiki_global_vars.rxWikiLinkUrl = valid_chars.'\{-}'
|
let g:vimwiki_global_vars.rxWikiLinkUrl = valid_chars.'\{-}'
|
||||||
let g:vimwiki_global_vars.rxWikiLinkDescr = valid_chars.'\{-}'
|
let g:vimwiki_global_vars.rxWikiLinkDescr = valid_chars.'\{-}'
|
||||||
@ -118,14 +106,6 @@ function! s:populate_global_variables()
|
|||||||
let g:vimwiki_global_vars.rxWord = '[^[:blank:]!"$%&''()*+,:;<=>?\[\]\\^`{}]\+'
|
let g:vimwiki_global_vars.rxWord = '[^[:blank:]!"$%&''()*+,:;<=>?\[\]\\^`{}]\+'
|
||||||
|
|
||||||
" [[URL]], or [[URL|DESCRIPTION]]
|
" [[URL]], or [[URL|DESCRIPTION]]
|
||||||
" a) match [[URL|DESCRIPTION]]
|
|
||||||
let g:vimwiki_global_vars.rxWikiLink = g:vimwiki_global_vars.rx_wikilink_prefix.
|
|
||||||
\ g:vimwiki_global_vars.rxWikiLinkUrl.'\%('.g:vimwiki_global_vars.rx_wikilink_separator.
|
|
||||||
\ g:vimwiki_global_vars.rxWikiLinkDescr.'\)\?'.g:vimwiki_global_vars.rx_wikilink_suffix
|
|
||||||
" b) match URL within [[URL|DESCRIPTION]]
|
|
||||||
let g:vimwiki_global_vars.rxWikiLinkMatchUrl = g:vimwiki_global_vars.rx_wikilink_prefix.
|
|
||||||
\ '\zs'. g:vimwiki_global_vars.rxWikiLinkUrl.'\ze\%('. g:vimwiki_global_vars.rx_wikilink_separator.
|
|
||||||
\ 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_global_vars.rxWikiLinkMatchDescr = g:vimwiki_global_vars.rx_wikilink_prefix.
|
let g:vimwiki_global_vars.rxWikiLinkMatchDescr = 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.'\%('.
|
||||||
@ -176,9 +156,6 @@ function! s:populate_global_variables()
|
|||||||
" 0b) match DESCRIPTION within URL
|
" 0b) match DESCRIPTION within URL
|
||||||
let g:vimwiki_global_vars.rxWeblinkMatchDescr = ''
|
let g:vimwiki_global_vars.rxWeblinkMatchDescr = ''
|
||||||
|
|
||||||
let g:vimwiki_global_vars.rxAnyLink = g:vimwiki_global_vars.rxWikiLink.'\|'.
|
|
||||||
\ g:vimwiki_global_vars.rxWikiIncl.'\|'.g:vimwiki_global_vars.rxWeblink
|
|
||||||
|
|
||||||
let g:vimwiki_global_vars.rxTodo = '\C\%(TODO:\|DONE:\|STARTED:\|FIXME:\|FIXED:\|XXX:\)'
|
let g:vimwiki_global_vars.rxTodo = '\C\%(TODO:\|DONE:\|STARTED:\|FIXME:\|FIXED:\|XXX:\)'
|
||||||
|
|
||||||
" default colors when headers of different levels are highlighted differently
|
" default colors when headers of different levels are highlighted differently
|
||||||
@ -370,6 +347,113 @@ function! vimwiki#vars#populate_syntax_vars(syntax)
|
|||||||
else
|
else
|
||||||
let g:vimwiki_syntax_variables[a:syntax].rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_syntax_variables[a:syntax].rxListBullet.'\|'.g:vimwiki_syntax_variables[a:syntax].rxListNumber.'\)\s\+\['.g:vimwiki_syntax_variables[a:syntax].listsyms_list[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
|
let g:vimwiki_syntax_variables[a:syntax].rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_syntax_variables[a:syntax].rxListBullet.'\|'.g:vimwiki_syntax_variables[a:syntax].rxListNumber.'\)\s\+\['.g:vimwiki_syntax_variables[a:syntax].listsyms_list[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" template for matching all wiki links with a given target file
|
||||||
|
let g:vimwiki_syntax_variables[a:syntax].WikiLinkMatchUrlTemplate =
|
||||||
|
\ g:vimwiki_global_vars.rx_wikilink_prefix .
|
||||||
|
\ '\zs__LinkUrl__\ze\%(#.*\)\?' .
|
||||||
|
\ g:vimwiki_global_vars.rx_wikilink_suffix .
|
||||||
|
\ '\|' .
|
||||||
|
\ g:vimwiki_global_vars.rx_wikilink_prefix .
|
||||||
|
\ '\zs__LinkUrl__\ze\%(#.*\)\?' .
|
||||||
|
\ g:vimwiki_global_vars.rx_wikilink_separator .
|
||||||
|
\ '.*' .
|
||||||
|
\ g:vimwiki_global_vars.rx_wikilink_suffix
|
||||||
|
|
||||||
|
" a) match [[URL|DESCRIPTION]]
|
||||||
|
let g:vimwiki_syntax_variables[a:syntax].rxWikiLink = g:vimwiki_global_vars.rx_wikilink_prefix.
|
||||||
|
\ g:vimwiki_global_vars.rxWikiLinkUrl.'\%('.g:vimwiki_global_vars.rx_wikilink_separator.
|
||||||
|
\ g:vimwiki_global_vars.rxWikiLinkDescr.'\)\?'.g:vimwiki_global_vars.rx_wikilink_suffix
|
||||||
|
let g:vimwiki_syntax_variables[a:syntax].rxAnyLink = g:vimwiki_syntax_variables[a:syntax].rxWikiLink.'\|'.
|
||||||
|
\ g:vimwiki_global_vars.rxWikiIncl.'\|'.g:vimwiki_global_vars.rxWeblink
|
||||||
|
" b) match URL within [[URL|DESCRIPTION]]
|
||||||
|
let g:vimwiki_syntax_variables[a:syntax].rxWikiLinkMatchUrl = g:vimwiki_global_vars.rx_wikilink_prefix.
|
||||||
|
\ '\zs'. g:vimwiki_global_vars.rxWikiLinkUrl.'\ze\%('. g:vimwiki_global_vars.rx_wikilink_separator.
|
||||||
|
\ g:vimwiki_global_vars.rxWikiLinkDescr.'\)\?'.g:vimwiki_global_vars.rx_wikilink_suffix
|
||||||
|
|
||||||
|
if a:syntax ==# 'markdown'
|
||||||
|
call s:populate_extra_markdown_vars()
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! s:populate_extra_markdown_vars()
|
||||||
|
let mkd_syntax = g:vimwiki_syntax_variables['markdown']
|
||||||
|
|
||||||
|
" 0a) match [[URL|DESCRIPTION]]
|
||||||
|
let mkd_syntax.vimwiki_rxWikiLink0 = mkd_syntax.rxWikiLink
|
||||||
|
" 0b) match URL within [[URL|DESCRIPTION]]
|
||||||
|
let mkd_syntax.vimwiki_rxWikiLink0MatchUrl = mkd_syntax.rxWikiLinkMatchUrl
|
||||||
|
" 0c) match DESCRIPTION within [[URL|DESCRIPTION]]
|
||||||
|
let mkd_syntax.vimwiki_rxWikiLink0MatchDescr = g:vimwiki_global_vars.rxWikiLinkMatchDescr
|
||||||
|
|
||||||
|
let wikilink_md_prefix = '['
|
||||||
|
let wikilink_md_suffix = ']'
|
||||||
|
let wikilink_md_separator = ']['
|
||||||
|
let rx_wikilink_md_separator = vimwiki#u#escape(wikilink_md_separator)
|
||||||
|
let mkd_syntax.rx_wikilink_md_prefix = vimwiki#u#escape(wikilink_md_prefix)
|
||||||
|
let mkd_syntax.rx_wikilink_md_suffix = vimwiki#u#escape(wikilink_md_suffix)
|
||||||
|
|
||||||
|
" [URL][]
|
||||||
|
let mkd_syntax.WikiLink1Template1 = wikilink_md_prefix . '__LinkUrl__'.
|
||||||
|
\ wikilink_md_separator. wikilink_md_suffix
|
||||||
|
" [DESCRIPTION][URL]
|
||||||
|
let mkd_syntax.WikiLink1Template2 = wikilink_md_prefix. '__LinkDescription__'.
|
||||||
|
\ wikilink_md_separator. '__LinkUrl__'. wikilink_md_suffix
|
||||||
|
let mkd_syntax.WikiLinkMatchUrlTemplate .=
|
||||||
|
\ '\|' .
|
||||||
|
\ mkd_syntax.rx_wikilink_md_prefix .
|
||||||
|
\ '.*' .
|
||||||
|
\ rx_wikilink_md_separator .
|
||||||
|
\ '\zs__LinkUrl__\ze\%(#.*\)\?' .
|
||||||
|
\ mkd_syntax.rx_wikilink_md_suffix .
|
||||||
|
\ '\|' .
|
||||||
|
\ mkd_syntax.rx_wikilink_md_prefix .
|
||||||
|
\ '\zs__LinkUrl__\ze\%(#.*\)\?' .
|
||||||
|
\ rx_wikilink_md_separator .
|
||||||
|
\ mkd_syntax.rx_wikilink_md_suffix
|
||||||
|
|
||||||
|
let valid_chars = '[^\\\[\]]'
|
||||||
|
let mkd_syntax.rxWikiLink1Url = valid_chars.'\{-}'
|
||||||
|
let mkd_syntax.rxWikiLink1Descr = valid_chars.'\{-}'
|
||||||
|
let mkd_syntax.rxWikiLink1InvalidPrefix = '[\]\[]\@<!'
|
||||||
|
let mkd_syntax.rxWikiLink1InvalidSuffix = '[\]\[]\@!'
|
||||||
|
let mkd_syntax.rx_wikilink_md_prefix = mkd_syntax.rxWikiLink1InvalidPrefix.
|
||||||
|
\ mkd_syntax.rx_wikilink_md_prefix
|
||||||
|
let mkd_syntax.rx_wikilink_md_suffix = mkd_syntax.rx_wikilink_md_suffix.
|
||||||
|
\ mkd_syntax.rxWikiLink1InvalidSuffix
|
||||||
|
|
||||||
|
" 1. match [URL][], [DESCRIPTION][URL]
|
||||||
|
let mkd_syntax.rxWikiLink1 = mkd_syntax.rx_wikilink_md_prefix.
|
||||||
|
\ mkd_syntax.rxWikiLink1Url. mkd_syntax.rx_wikilink_md_separator.
|
||||||
|
\ mkd_syntax.rx_wikilink_md_suffix.
|
||||||
|
\ '\|'. mkd_syntax.rx_wikilink_md_prefix.
|
||||||
|
\ mkd_syntax.rxWikiLink1Descr . mkd_syntax.rx_wikilink_md_separator.
|
||||||
|
\ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix
|
||||||
|
" 2. match URL within [URL][], [DESCRIPTION][URL]
|
||||||
|
let mkd_syntax.rxWikiLink1MatchUrl = mkd_syntax.rx_wikilink_md_prefix.
|
||||||
|
\ '\zs'. mkd_syntax.rxWikiLink1Url. '\ze'. mkd_syntax.rx_wikilink_md_separator.
|
||||||
|
\ mkd_syntax.rx_wikilink_md_suffix.
|
||||||
|
\ '\|'. mkd_syntax.rx_wikilink_md_prefix.
|
||||||
|
\ mkd_syntax.rxWikiLink1Descr. mkd_syntax.rx_wikilink_md_separator.
|
||||||
|
\ '\zs'. mkd_syntax.rxWikiLink1Url. '\ze'. mkd_syntax.rx_wikilink_md_suffix
|
||||||
|
" 3. match DESCRIPTION within [DESCRIPTION][URL]
|
||||||
|
let mkd_syntax.rxWikiLink1MatchDescr = mkd_syntax.rx_wikilink_md_prefix.
|
||||||
|
\ '\zs'. mkd_syntax.rxWikiLink1Descr.'\ze'. mkd_syntax.rx_wikilink_md_separator.
|
||||||
|
\ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix
|
||||||
|
|
||||||
|
let mkd_syntax.rxWikiLink1Prefix1 = mkd_syntax.rx_wikilink_md_prefix
|
||||||
|
let mkd_syntax.rxWikiLink1Suffix1 = mkd_syntax.rx_wikilink_md_separator.
|
||||||
|
\ mkd_syntax.rxWikiLink1Url . mkd_syntax.rx_wikilink_md_suffix
|
||||||
|
|
||||||
|
" 1. match ANY wikilink
|
||||||
|
let mkd_syntax.rxWikiLink = ''.
|
||||||
|
\ mkd_syntax.rxWikiLink0.'\|'.
|
||||||
|
\ mkd_syntax.rxWikiLink1
|
||||||
|
" 2. match URL within ANY wikilink
|
||||||
|
let mkd_syntax.rxWikiLinkMatchUrl = ''.
|
||||||
|
\ g:vimwiki_rxWikiLink0MatchUrl.'\|'.
|
||||||
|
\ g:vimwiki_rxWikiLink1MatchUrl
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ endfunction "}}}
|
|||||||
" use max highlighting - could be quite slow if there are too many wikifiles
|
" use max highlighting - could be quite slow if there are too many wikifiles
|
||||||
if vimwiki#vars#get_wikilocal('maxhi')
|
if vimwiki#vars#get_wikilocal('maxhi')
|
||||||
" WikiLink
|
" WikiLink
|
||||||
call s:add_target_syntax_OFF(vimwiki#vars#get_global('rxWikiLink'))
|
call s:add_target_syntax_OFF(vimwiki#vars#get_syntaxlocal('rxWikiLink'))
|
||||||
" WikiIncl
|
" WikiIncl
|
||||||
call s:add_target_syntax_OFF(vimwiki#vars#get_global('rxWikiIncl'))
|
call s:add_target_syntax_OFF(vimwiki#vars#get_global('rxWikiIncl'))
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ if vimwiki#vars#get_wikilocal('maxhi')
|
|||||||
call s:highlight_existing_links()
|
call s:highlight_existing_links()
|
||||||
else
|
else
|
||||||
" Wikilink
|
" Wikilink
|
||||||
call s:add_target_syntax_ON(vimwiki#vars#get_global('rxWikiLink'), 'VimwikiLink')
|
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWikiLink'), 'VimwikiLink')
|
||||||
" WikiIncl
|
" WikiIncl
|
||||||
call s:add_target_syntax_ON(vimwiki#vars#get_global('rxWikiIncl'), 'VimwikiLink')
|
call s:add_target_syntax_ON(vimwiki#vars#get_global('rxWikiIncl'), 'VimwikiLink')
|
||||||
endif
|
endif
|
||||||
|
@ -16,108 +16,16 @@
|
|||||||
|
|
||||||
" LINKS: setup of larger regexes {{{
|
" LINKS: setup of larger regexes {{{
|
||||||
|
|
||||||
" LINKS: setup wikilink0 regexps {{{
|
|
||||||
" 0. [[URL]], or [[URL|DESCRIPTION]]
|
|
||||||
|
|
||||||
" 0a) match [[URL|DESCRIPTION]]
|
|
||||||
let g:vimwiki_rxWikiLink0 = g:vimwiki_rxWikiLink
|
|
||||||
" 0b) match URL within [[URL|DESCRIPTION]]
|
|
||||||
let g:vimwiki_rxWikiLink0MatchUrl = g:vimwiki_rxWikiLinkMatchUrl
|
|
||||||
" 0c) match DESCRIPTION within [[URL|DESCRIPTION]]
|
|
||||||
let g:vimwiki_rxWikiLink0MatchDescr = g:vimwiki_rxWikiLinkMatchDescr
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
" LINKS: setup wikilink1 regexps {{{
|
|
||||||
" 1. [URL][], or [DESCRIPTION][URL]
|
|
||||||
|
|
||||||
let s:wikilink_md_prefix = '['
|
|
||||||
let s:wikilink_md_suffix = ']'
|
|
||||||
let s:wikilink_md_separator = ']['
|
|
||||||
let s:rx_wikilink_md_prefix = vimwiki#u#escape(s:wikilink_md_prefix)
|
|
||||||
let s:rx_wikilink_md_suffix = vimwiki#u#escape(s:wikilink_md_suffix)
|
|
||||||
let s:rx_wikilink_md_separator = vimwiki#u#escape(s:wikilink_md_separator)
|
|
||||||
|
|
||||||
" [URL][]
|
|
||||||
let g:vimwiki_WikiLink1Template1 = s:wikilink_md_prefix . '__LinkUrl__'.
|
|
||||||
\ s:wikilink_md_separator. s:wikilink_md_suffix
|
|
||||||
" [DESCRIPTION][URL]
|
|
||||||
let g:vimwiki_WikiLink1Template2 = s:wikilink_md_prefix. '__LinkDescription__'.
|
|
||||||
\ s:wikilink_md_separator. '__LinkUrl__'.
|
|
||||||
\ s:wikilink_md_suffix
|
|
||||||
"
|
|
||||||
let g:vimwiki_WikiLinkMatchUrlTemplate .=
|
|
||||||
\ '\|' .
|
|
||||||
\ s:rx_wikilink_md_prefix .
|
|
||||||
\ '.*' .
|
|
||||||
\ s:rx_wikilink_md_separator .
|
|
||||||
\ '\zs__LinkUrl__\ze\%(#.*\)\?' .
|
|
||||||
\ s:rx_wikilink_md_suffix .
|
|
||||||
\ '\|' .
|
|
||||||
\ s:rx_wikilink_md_prefix .
|
|
||||||
\ '\zs__LinkUrl__\ze\%(#.*\)\?' .
|
|
||||||
\ s:rx_wikilink_md_separator .
|
|
||||||
\ s:rx_wikilink_md_suffix
|
|
||||||
|
|
||||||
let s:valid_chars = '[^\\\[\]]'
|
|
||||||
let g:vimwiki_rxWikiLink1Url = s:valid_chars.'\{-}'
|
|
||||||
let g:vimwiki_rxWikiLink1Descr = s:valid_chars.'\{-}'
|
|
||||||
|
|
||||||
let g:vimwiki_rxWikiLink1InvalidPrefix = '[\]\[]\@<!'
|
|
||||||
let g:vimwiki_rxWikiLink1InvalidSuffix = '[\]\[]\@!'
|
|
||||||
let s:rx_wikilink_md_prefix = g:vimwiki_rxWikiLink1InvalidPrefix.
|
|
||||||
\ s:rx_wikilink_md_prefix
|
|
||||||
let s:rx_wikilink_md_suffix = s:rx_wikilink_md_suffix.
|
|
||||||
\ g:vimwiki_rxWikiLink1InvalidSuffix
|
|
||||||
|
|
||||||
"
|
|
||||||
" 1. [URL][], [DESCRIPTION][URL]
|
|
||||||
" 1a) match [URL][], [DESCRIPTION][URL]
|
|
||||||
let g:vimwiki_rxWikiLink1 = s:rx_wikilink_md_prefix.
|
|
||||||
\ g:vimwiki_rxWikiLink1Url. s:rx_wikilink_md_separator.
|
|
||||||
\ s:rx_wikilink_md_suffix.
|
|
||||||
\ '\|'. s:rx_wikilink_md_prefix.
|
|
||||||
\ g:vimwiki_rxWikiLink1Descr.s:rx_wikilink_md_separator.
|
|
||||||
\ g:vimwiki_rxWikiLink1Url.s:rx_wikilink_md_suffix
|
|
||||||
" 1b) match URL within [URL][], [DESCRIPTION][URL]
|
|
||||||
let g:vimwiki_rxWikiLink1MatchUrl = s:rx_wikilink_md_prefix.
|
|
||||||
\ '\zs'. g:vimwiki_rxWikiLink1Url. '\ze'. s:rx_wikilink_md_separator.
|
|
||||||
\ s:rx_wikilink_md_suffix.
|
|
||||||
\ '\|'. s:rx_wikilink_md_prefix.
|
|
||||||
\ g:vimwiki_rxWikiLink1Descr. s:rx_wikilink_md_separator.
|
|
||||||
\ '\zs'. g:vimwiki_rxWikiLink1Url. '\ze'. s:rx_wikilink_md_suffix
|
|
||||||
" 1c) match DESCRIPTION within [DESCRIPTION][URL]
|
|
||||||
let g:vimwiki_rxWikiLink1MatchDescr = s:rx_wikilink_md_prefix.
|
|
||||||
\ '\zs'. g:vimwiki_rxWikiLink1Descr.'\ze'. s:rx_wikilink_md_separator.
|
|
||||||
\ g:vimwiki_rxWikiLink1Url.s:rx_wikilink_md_suffix
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
" LINKS: Syntax helper {{{
|
|
||||||
let g:vimwiki_rxWikiLink1Prefix1 = s:rx_wikilink_md_prefix
|
|
||||||
let g:vimwiki_rxWikiLink1Suffix1 = s:rx_wikilink_md_separator.
|
|
||||||
\ g:vimwiki_rxWikiLink1Url.s:rx_wikilink_md_suffix
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
" *. ANY wikilink {{{
|
" *. ANY wikilink {{{
|
||||||
" *a) match ANY wikilink
|
|
||||||
let g:vimwiki_rxWikiLink = ''.
|
|
||||||
\ g:vimwiki_rxWikiLink0.'\|'.
|
|
||||||
\ g:vimwiki_rxWikiLink1
|
|
||||||
" *b) match URL within ANY wikilink
|
|
||||||
let g:vimwiki_rxWikiLinkMatchUrl = ''.
|
|
||||||
\ g:vimwiki_rxWikiLink0MatchUrl.'\|'.
|
|
||||||
\ g:vimwiki_rxWikiLink1MatchUrl
|
|
||||||
" *c) match DESCRIPTION within ANY wikilink
|
" *c) match DESCRIPTION within ANY wikilink
|
||||||
let g:vimwiki_rxWikiLinkMatchDescr = ''.
|
let g:vimwiki_rxWikiLinkMatchDescr = ''.
|
||||||
\ g:vimwiki_rxWikiLink0MatchDescr.'\|'.
|
\ g:vimwiki_rxWikiLink0MatchDescr.'\|'.
|
||||||
\ g:vimwiki_rxWikiLink1MatchDescr
|
\ g:vimwiki_rxWikiLink1MatchDescr
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" LINKS: setup of wikiincl regexps {{{
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
" LINKS: Syntax helper {{{
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
" LINKS: Setup weblink0 regexps {{{
|
" LINKS: Setup weblink0 regexps {{{
|
||||||
" 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_rxWeblink0 = g:vimwiki_rxWeblink
|
let g:vimwiki_rxWeblink0 = g:vimwiki_rxWeblink
|
||||||
@ -336,12 +244,12 @@ let s:options = ' contained transparent contains=NONE'
|
|||||||
" conceal wikilink1
|
" conceal wikilink1
|
||||||
execute 'syn match VimwikiWikiLink1Char /'.s:rx_wikilink_md_prefix.'/'.s:options
|
execute 'syn match VimwikiWikiLink1Char /'.s:rx_wikilink_md_prefix.'/'.s:options
|
||||||
execute 'syn match VimwikiWikiLink1Char /'.s:rx_wikilink_md_suffix.'/'.s:options
|
execute 'syn match VimwikiWikiLink1Char /'.s:rx_wikilink_md_suffix.'/'.s:options
|
||||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Prefix1.'/'.s:options
|
execute 'syn match VimwikiWikiLink1Char /'.vimwiki#vars#get_syntaxlocal('rxWikiLink1Prefix1').'/'.s:options
|
||||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Suffix1.'/'.s:options
|
execute 'syn match VimwikiWikiLink1Char /'.vimwiki#vars#get_syntaxlocal('rxWikiLink1Suffix1').'/'.s:options
|
||||||
|
|
||||||
" conceal weblink1
|
" conceal weblink1
|
||||||
execute 'syn match VimwikiWeblink1Char "'.g:vimwiki_rxWeblink1Prefix1.'"'.s:options
|
execute 'syn match VimwikiWeblink1Char "'.vimwiki#vars#get_syntaxlocal('rxWeblink1Prefix1').'"'.s:options
|
||||||
execute 'syn match VimwikiWeblink1Char "'.g:vimwiki_rxWeblink1Suffix1.'"'.s:options
|
execute 'syn match VimwikiWeblink1Char "'.vimwiki#vars#get_syntaxlocal('rxWeblink1Suffix1').'"'.s:options
|
||||||
|
|
||||||
if exists("+conceallevel")
|
if exists("+conceallevel")
|
||||||
syntax conceal off
|
syntax conceal off
|
||||||
|
Loading…
Reference in New Issue
Block a user