Merge pull request #186 from lotabout/master
fix #64: markdown style link support
This commit is contained in:
commit
6f579711ab
@ -108,6 +108,8 @@ function! vimwiki#markdown_base#follow_link(split, ...) "{{{ Parse link at curso
|
|||||||
if lnk != ""
|
if lnk != ""
|
||||||
if !VimwikiLinkHandler(lnk)
|
if !VimwikiLinkHandler(lnk)
|
||||||
if !vimwiki#markdown_base#open_reflink(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)
|
call vimwiki#base#open_link(cmd, lnk)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -173,7 +175,7 @@ function! s:normalize_link_syntax_n() " {{{
|
|||||||
if !empty(lnk)
|
if !empty(lnk)
|
||||||
let sub = vimwiki#base#normalize_link_helper(lnk,
|
let sub = vimwiki#base#normalize_link_helper(lnk,
|
||||||
\ g:vimwiki_rxWord, '',
|
\ g:vimwiki_rxWord, '',
|
||||||
\ g:vimwiki_WikiLinkTemplate1)
|
\ g:vimwiki_Weblink1Template)
|
||||||
call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
|
call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@ -192,9 +194,10 @@ function! s:normalize_link_syntax_v() " {{{
|
|||||||
try
|
try
|
||||||
norm! gvy
|
norm! gvy
|
||||||
let visual_selection = @"
|
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__', '\='."'".visual_selection."'", '')
|
||||||
|
|
||||||
call setreg('"', visual_selection, 'v')
|
call setreg('"', link, 'v')
|
||||||
|
|
||||||
" paste result
|
" paste result
|
||||||
norm! `>pgvd
|
norm! `>pgvd
|
||||||
|
Loading…
Reference in New Issue
Block a user