X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/64148cf1095569fb03b57f3842d941727a2a5812..5f770c34d3e1d23b4715f79fb67892d0263e1ae6:/ftplugin/markdown.vim diff --git a/ftplugin/markdown.vim b/ftplugin/markdown.vim index d7c3777..1aa3494 100644 --- a/ftplugin/markdown.vim +++ b/ftplugin/markdown.vim @@ -599,10 +599,16 @@ if !exists('*s:EditUrlUnderCursor') endif endif if l:url != '' + let l:ext = '' if get(g:, 'vim_markdown_no_extensions_in_markdown', 0) - let l:url .= '.md' + " use another file extension if preferred + if exists('g:vim_markdown_auto_extension_ext') + let l:ext = '.'.g:vim_markdown_auto_extension_ext + else + let l:ext = '.md' + endif endif - let l:url = fnamemodify(expand('%:h').'/'.l:url, ':.') + let l:url = fnameescape(fnamemodify(expand('%:h').'/'.l:url.l:ext, ':.')) execute 'edit' l:url endif if l:anchor != '' @@ -758,10 +764,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