From b1362ac16116bcdb42c15b7719eb061c5c49173e Mon Sep 17 00:00:00 2001 From: EinfachToll Date: Tue, 18 Feb 2014 14:52:35 +0100 Subject: [PATCH] VimwikiBacklinks finds only links to the current file But doesn't take into account markdown style links Ref #25 --- autoload/vimwiki/base.vim | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 9a89be6..45790f2 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -581,10 +581,13 @@ endfunction "}}} " vimwiki#base#backlinks function! vimwiki#base#backlinks() "{{{ - execute 'lvimgrep "\%(^\|[[:blank:][:punct:]]\)'. - \ expand("%:t:r"). - \ '\([[:blank:][:punct:]]\|$\)\C" '. - \ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ') + let filename = expand("%:t:r") + let rx_wikilink = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate1, + \ '\zs'.filename.'\ze\%(#.*\)\?', '.*', ''). + \ '\|'. vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate2, + \ '\zs'.filename.'\ze\%(#.*\)\?', '.*', '') + execute 'lvimgrep "\C'.rx_wikilink.'" '. + \ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ') endfunction "}}} " vimwiki#base#get_links