parent
c0ead893b4
commit
4a04fc7519
@ -581,10 +581,8 @@ endfunction "}}}
|
|||||||
" vimwiki#base#backlinks
|
" vimwiki#base#backlinks
|
||||||
function! vimwiki#base#backlinks() "{{{
|
function! vimwiki#base#backlinks() "{{{
|
||||||
let filename = expand("%:t:r")
|
let filename = expand("%:t:r")
|
||||||
let rx_wikilink = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate1,
|
let rx_wikilink = vimwiki#base#apply_template(
|
||||||
\ '\zs'.filename.'\ze\%(#.*\)\?', '.*', '').
|
\ g:vimwiki_WikiLinkMatchUrlTemplate, filename, '', '')
|
||||||
\ '\|'. vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate2,
|
|
||||||
\ '\zs'.filename.'\ze\%(#.*\)\?', '.*', '')
|
|
||||||
execute 'lvimgrep "\C'.rx_wikilink.'" '.
|
execute 'lvimgrep "\C'.rx_wikilink.'" '.
|
||||||
\ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ')
|
\ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ')
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
@ -821,17 +819,13 @@ endfunction " }}}
|
|||||||
function! s:update_wiki_links_dir(dir, old_fname, new_fname) " {{{
|
function! s:update_wiki_links_dir(dir, old_fname, new_fname) " {{{
|
||||||
let old_fname = substitute(a:old_fname, '[/\\]', '[/\\\\]', 'g')
|
let old_fname = substitute(a:old_fname, '[/\\]', '[/\\\\]', 'g')
|
||||||
let new_fname = a:new_fname
|
let new_fname = a:new_fname
|
||||||
let old_fname_r = old_fname
|
|
||||||
let new_fname_r = new_fname
|
|
||||||
|
|
||||||
let old_fname_r = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate1,
|
let old_fname_r = vimwiki#base#apply_template(
|
||||||
\ '\zs'.old_fname.'\ze\%(#.*\)\?', '.*', '').
|
\ g:vimwiki_WikiLinkMatchUrlTemplate, old_fname, '', '')
|
||||||
\ '\|'. vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate2,
|
|
||||||
\ '\zs'.old_fname.'\ze\%(#.*\)\?', '.*', '')
|
|
||||||
|
|
||||||
let files = split(glob(VimwikiGet('path').a:dir.'*'.VimwikiGet('ext')), '\n')
|
let files = split(glob(VimwikiGet('path').a:dir.'*'.VimwikiGet('ext')), '\n')
|
||||||
for fname in files
|
for fname in files
|
||||||
call s:update_wiki_link(fname, old_fname_r, new_fname_r)
|
call s:update_wiki_link(fname, old_fname_r, new_fname)
|
||||||
endfor
|
endfor
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
@ -1587,15 +1581,15 @@ endfunction
|
|||||||
" arguments rxUrl, rxDesc, and rxStyle are copied verbatim, without any
|
" arguments rxUrl, rxDesc, and rxStyle are copied verbatim, without any
|
||||||
" special character escapes or substitutions.
|
" special character escapes or substitutions.
|
||||||
function! vimwiki#base#apply_template(template, rxUrl, rxDesc, rxStyle) "{{{
|
function! vimwiki#base#apply_template(template, rxUrl, rxDesc, rxStyle) "{{{
|
||||||
let lnk = vimwiki#u#escape(a:template)
|
let lnk = a:template
|
||||||
if a:rxUrl != ""
|
if a:rxUrl != ""
|
||||||
let lnk = substitute(lnk, '__LinkUrl__', '\='."'".a:rxUrl."'", '')
|
let lnk = substitute(lnk, '__LinkUrl__', '\='."'".a:rxUrl."'", 'g')
|
||||||
endif
|
endif
|
||||||
if a:rxDesc != ""
|
if a:rxDesc != ""
|
||||||
let lnk = substitute(lnk, '__LinkDescription__', '\='."'".a:rxDesc."'", '')
|
let lnk = substitute(lnk, '__LinkDescription__', '\='."'".a:rxDesc."'", 'g')
|
||||||
endif
|
endif
|
||||||
if a:rxStyle != ""
|
if a:rxStyle != ""
|
||||||
let lnk = substitute(lnk, '__LinkStyle__', '\='."'".a:rxStyle."'", '')
|
let lnk = substitute(lnk, '__LinkStyle__', '\='."'".a:rxStyle."'", 'g')
|
||||||
endif
|
endif
|
||||||
return lnk
|
return lnk
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
@ -51,8 +51,8 @@ let s:time0 = vimwiki#u#time(g:starttime) "XXX
|
|||||||
" LINKS: setup of larger regexes {{{
|
" LINKS: setup of larger regexes {{{
|
||||||
|
|
||||||
" LINKS: setup wikilink regexps {{{
|
" LINKS: setup wikilink regexps {{{
|
||||||
let g:vimwiki_rxWikiLinkPrefix = '[['
|
let g:vimwiki_rxWikiLinkPrefix = '\[\['
|
||||||
let g:vimwiki_rxWikiLinkSuffix = ']]'
|
let g:vimwiki_rxWikiLinkSuffix = '\]\]'
|
||||||
let g:vimwiki_rxWikiLinkSeparator = '|'
|
let g:vimwiki_rxWikiLinkSeparator = '|'
|
||||||
" [[URL]]
|
" [[URL]]
|
||||||
let g:vimwiki_WikiLinkTemplate1 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
let g:vimwiki_WikiLinkTemplate1 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
||||||
@ -61,12 +61,20 @@ let g:vimwiki_WikiLinkTemplate1 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
|||||||
let g:vimwiki_WikiLinkTemplate2 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
let g:vimwiki_WikiLinkTemplate2 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
||||||
\ g:vimwiki_rxWikiLinkSeparator. '__LinkDescription__'.
|
\ g:vimwiki_rxWikiLinkSeparator. '__LinkDescription__'.
|
||||||
\ g:vimwiki_rxWikiLinkSuffix
|
\ g:vimwiki_rxWikiLinkSuffix
|
||||||
"
|
|
||||||
let s:valid_chars = '[^\\\]]'
|
|
||||||
|
|
||||||
let g:vimwiki_rxWikiLinkPrefix = vimwiki#u#escape(g:vimwiki_rxWikiLinkPrefix)
|
" match every Wikilink with a given URL
|
||||||
let g:vimwiki_rxWikiLinkSuffix = vimwiki#u#escape(g:vimwiki_rxWikiLinkSuffix)
|
let g:vimwiki_WikiLinkMatchUrlTemplate =
|
||||||
let g:vimwiki_rxWikiLinkSeparator = vimwiki#u#escape(g:vimwiki_rxWikiLinkSeparator)
|
\ g:vimwiki_rxWikiLinkPrefix .
|
||||||
|
\ '\zs__LinkUrl__\ze\%(#.*\)\?' .
|
||||||
|
\ g:vimwiki_rxWikiLinkSuffix .
|
||||||
|
\ '\|' .
|
||||||
|
\ g:vimwiki_rxWikiLinkPrefix .
|
||||||
|
\ '\zs__LinkUrl__\ze\%(#.*\)\?' .
|
||||||
|
\ g:vimwiki_rxWikiLinkSeparator .
|
||||||
|
\ '.*' .
|
||||||
|
\ g:vimwiki_rxWikiLinkSuffix
|
||||||
|
|
||||||
|
let s:valid_chars = '[^\\\]]'
|
||||||
let g:vimwiki_rxWikiLinkUrl = s:valid_chars.'\{-}'
|
let g:vimwiki_rxWikiLinkUrl = s:valid_chars.'\{-}'
|
||||||
let g:vimwiki_rxWikiLinkDescr = s:valid_chars.'\{-}'
|
let g:vimwiki_rxWikiLinkDescr = s:valid_chars.'\{-}'
|
||||||
|
|
||||||
@ -108,11 +116,8 @@ let g:vimwiki_WikiInclTemplate2 = g:vimwiki_rxWikiInclPrefix . '__LinkUrl__'.
|
|||||||
\ '__LinkDescription__'.
|
\ '__LinkDescription__'.
|
||||||
\ g:vimwiki_rxWikiInclSuffix
|
\ g:vimwiki_rxWikiInclSuffix
|
||||||
|
|
||||||
let s:valid_chars = '[^\\\}]'
|
|
||||||
|
|
||||||
let g:vimwiki_rxWikiInclPrefix = vimwiki#u#escape(g:vimwiki_rxWikiInclPrefix)
|
let s:valid_chars = '[^\\\}]'
|
||||||
let g:vimwiki_rxWikiInclSuffix = vimwiki#u#escape(g:vimwiki_rxWikiInclSuffix)
|
|
||||||
let g:vimwiki_rxWikiInclSeparator = vimwiki#u#escape(g:vimwiki_rxWikiInclSeparator)
|
|
||||||
let g:vimwiki_rxWikiInclUrl = s:valid_chars.'\{-}'
|
let g:vimwiki_rxWikiInclUrl = s:valid_chars.'\{-}'
|
||||||
let g:vimwiki_rxWikiInclArg = s:valid_chars.'\{-}'
|
let g:vimwiki_rxWikiInclArg = s:valid_chars.'\{-}'
|
||||||
let g:vimwiki_rxWikiInclArgs = '\%('. g:vimwiki_rxWikiInclSeparator. g:vimwiki_rxWikiInclArg. '\)'.'\{-}'
|
let g:vimwiki_rxWikiInclArgs = '\%('. g:vimwiki_rxWikiInclSeparator. g:vimwiki_rxWikiInclArg. '\)'.'\{-}'
|
||||||
|
@ -30,9 +30,9 @@ let g:vimwiki_rxWikiLink0MatchDescr = g:vimwiki_rxWikiLinkMatchDescr
|
|||||||
" LINKS: setup wikilink1 regexps {{{
|
" LINKS: setup wikilink1 regexps {{{
|
||||||
" 1. [URL][], or [DESCRIPTION][URL]
|
" 1. [URL][], or [DESCRIPTION][URL]
|
||||||
|
|
||||||
let g:vimwiki_rxWikiLink1Prefix = '['
|
let g:vimwiki_rxWikiLink1Prefix = '\['
|
||||||
let g:vimwiki_rxWikiLink1Suffix = ']'
|
let g:vimwiki_rxWikiLink1Suffix = '\]'
|
||||||
let g:vimwiki_rxWikiLink1Separator = ']['
|
let g:vimwiki_rxWikiLink1Separator = '\]\['
|
||||||
|
|
||||||
" [URL][]
|
" [URL][]
|
||||||
let g:vimwiki_WikiLink1Template1 = g:vimwiki_rxWikiLink1Prefix . '__LinkUrl__'.
|
let g:vimwiki_WikiLink1Template1 = g:vimwiki_rxWikiLink1Prefix . '__LinkUrl__'.
|
||||||
@ -42,11 +42,20 @@ let g:vimwiki_WikiLink1Template2 = g:vimwiki_rxWikiLink1Prefix . '__LinkDescript
|
|||||||
\ g:vimwiki_rxWikiLink1Separator. '__LinkUrl__'.
|
\ g:vimwiki_rxWikiLink1Separator. '__LinkUrl__'.
|
||||||
\ g:vimwiki_rxWikiLink1Suffix
|
\ g:vimwiki_rxWikiLink1Suffix
|
||||||
"
|
"
|
||||||
let s:valid_chars = '[^\\\[\]]'
|
let g:vimwiki_WikiLinkMatchUrlTemplate .=
|
||||||
|
\ '\|' .
|
||||||
|
\ g:vimwiki_rxWikiLink1Prefix .
|
||||||
|
\ '.*' .
|
||||||
|
\ g:vimwiki_rxWikiLink1Separator .
|
||||||
|
\ '\zs__LinkUrl__\ze\%(#.*\)\?' .
|
||||||
|
\ g:vimwiki_rxWikiLink1Suffix .
|
||||||
|
\ '\|' .
|
||||||
|
\ g:vimwiki_rxWikiLink1Prefix .
|
||||||
|
\ '\zs__LinkUrl__\ze\%(#.*\)\?' .
|
||||||
|
\ g:vimwiki_rxWikiLink1Separator .
|
||||||
|
\ g:vimwiki_rxWikiLink1Suffix
|
||||||
|
|
||||||
let g:vimwiki_rxWikiLink1Prefix = vimwiki#u#escape(g:vimwiki_rxWikiLink1Prefix)
|
let s:valid_chars = '[^\\\[\]]'
|
||||||
let g:vimwiki_rxWikiLink1Suffix = vimwiki#u#escape(g:vimwiki_rxWikiLink1Suffix)
|
|
||||||
let g:vimwiki_rxWikiLink1Separator = vimwiki#u#escape(g:vimwiki_rxWikiLink1Separator)
|
|
||||||
let g:vimwiki_rxWikiLink1Url = s:valid_chars.'\{-}'
|
let g:vimwiki_rxWikiLink1Url = s:valid_chars.'\{-}'
|
||||||
let g:vimwiki_rxWikiLink1Descr = s:valid_chars.'\{-}'
|
let g:vimwiki_rxWikiLink1Descr = s:valid_chars.'\{-}'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user