From b0cc6ff0de49820acc4b385b41726b213d474087 Mon Sep 17 00:00:00 2001 From: zhang_ji Date: Mon, 18 Jan 2016 16:51:08 +0800 Subject: [PATCH] fix #64: markdown style link support --- autoload/vimwiki/markdown_base.vim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/autoload/vimwiki/markdown_base.vim b/autoload/vimwiki/markdown_base.vim index 9301a1e..3053629 100644 --- a/autoload/vimwiki/markdown_base.vim +++ b/autoload/vimwiki/markdown_base.vim @@ -108,6 +108,8 @@ function! vimwiki#markdown_base#follow_link(split, ...) "{{{ Parse link at curso if lnk != "" if !VimwikiLinkHandler(lnk) if !vimwiki#markdown_base#open_reflink(lnk) + " remove the extension from the filename if exists + let lnk = substitute(lnk, VimwikiGet('ext').'$', '', '') call vimwiki#base#open_link(cmd, lnk) endif endif @@ -173,7 +175,7 @@ function! s:normalize_link_syntax_n() " {{{ if !empty(lnk) let sub = vimwiki#base#normalize_link_helper(lnk, \ g:vimwiki_rxWord, '', - \ g:vimwiki_WikiLinkTemplate1) + \ g:vimwiki_Weblink1Template) call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub) return endif @@ -192,9 +194,10 @@ function! s:normalize_link_syntax_v() " {{{ try norm! gvy let visual_selection = @" - let visual_selection = substitute(g:vimwiki_WikiLinkTemplate1, '__LinkUrl__', '\='."'".visual_selection."'", '') + let link = substitute(g:vimwiki_Weblink1Template, '__LinkUrl__', '\='."'".visual_selection."'", '') + let link = substitute(link, '__LinkDescription__', '\='."''", '') - call setreg('"', visual_selection, 'v') + call setreg('"', link, 'v') " paste result norm! `>pgvd