X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/da4f9691597928065d849fe9c0863ed3a756b52d..be76911c18d7d43faa9d18ec69e9d16dba7ada84:/ftplugin/markdown.vim diff --git a/ftplugin/markdown.vim b/ftplugin/markdown.vim index 067643d..68d1d3d 100644 --- a/ftplugin/markdown.vim +++ b/ftplugin/markdown.vim @@ -599,16 +599,33 @@ if !exists('*s:EditUrlUnderCursor') endif endif if l:url != '' + let l:ext = '' if get(g:, 'vim_markdown_no_extensions_in_markdown', 0) " use another file extension if preferred if exists('g:vim_markdown_auto_extension_ext') - let l:url = '.'.g:vim_markdown_auto_extension_ext + let l:ext = '.'.g:vim_markdown_auto_extension_ext else - let l:url = '.md' + let l:ext = '.md' endif endif - let l:url = fnamemodify(expand('%:h').'/'.l:url, ':.') - execute 'edit' l:url + let l:url = fnameescape(fnamemodify(expand('%:h').'/'.l:url.l:ext, ':.')) + let l:editmethod = '' + " determine how to open the linked file (split, tab, etc) + if exists('g:vim_markdown_edit_url_in') + if g:vim_markdown_edit_url_in == 'tab' + let l:editmethod = 'tabnew' + elseif g:vim_markdown_edit_url_in == 'vsplit' + let l:editmethod = 'vsp' + elseif g:vim_markdown_edit_url_in == 'hsplit' + let l:editmethod = 'sp' + else + let l:editmethod = 'edit' + endif + else + " default to current buffer + let l:editmethod = 'edit' + endif + execute l:editmethod l:url endif if l:anchor != '' silent! execute '/'.l:anchor @@ -763,10 +780,10 @@ function! s:MarkdownClearSyntaxVariables() endfunction augroup Mkd - autocmd! - au BufWinEnter * call s:MarkdownRefreshSyntax(1) - au BufUnload * call s:MarkdownClearSyntaxVariables() - au BufWritePost * call s:MarkdownRefreshSyntax(0) - au InsertEnter,InsertLeave * call s:MarkdownRefreshSyntax(0) - au CursorHold,CursorHoldI * call s:MarkdownRefreshSyntax(0) + autocmd! * + autocmd BufWinEnter call s:MarkdownRefreshSyntax(1) + autocmd BufUnload call s:MarkdownClearSyntaxVariables() + autocmd BufWritePost call s:MarkdownRefreshSyntax(0) + autocmd InsertEnter,InsertLeave call s:MarkdownRefreshSyntax(0) + autocmd CursorHold,CursorHoldI call s:MarkdownRefreshSyntax(0) augroup END