Fixed system file handlers for windows
Fixes #560 Opening external files containing spaces should now work on cmd and powershell.
This commit is contained in:
parent
bd88ea968b
commit
7668985b43
@ -220,22 +220,32 @@ endfunction
|
|||||||
function! vimwiki#base#system_open_link(url)
|
function! vimwiki#base#system_open_link(url)
|
||||||
" handlers
|
" handlers
|
||||||
function! s:win32_handler(url)
|
function! s:win32_handler(url)
|
||||||
"http://vim.wikia.com/wiki/Opening_current_Vim_file_in_your_Windows_browser
|
"Disable shellslash for cmd and command.com, but enable for all other shells
|
||||||
"disable 'shellslash', otherwise the url will be enclosed in single quotes,
|
"See Issue #560
|
||||||
"which is problematic
|
if (&shell =~? "cmd") || (&shell =~? "command.com")
|
||||||
"see https://github.com/vimwiki/vimwiki/issues/54#issuecomment-48011289
|
|
||||||
if exists('+shellslash')
|
if exists('+shellslash')
|
||||||
let old_ssl = &shellslash
|
let old_ssl = &shellslash
|
||||||
set noshellslash
|
set noshellslash
|
||||||
let url = shellescape(a:url, 1)
|
let url = shellescape(a:url, 1)
|
||||||
let &shellslash = old_ssl
|
let &shellslash = old_ssl
|
||||||
|
else
|
||||||
|
let url = shellescape(a:url, 1)
|
||||||
|
endif
|
||||||
|
execute 'silent ! start "Title" /B ' . url
|
||||||
|
|
||||||
else
|
else
|
||||||
let url = shellescape(a:url, 1)
|
|
||||||
endif
|
if exists('+shellslash')
|
||||||
if &l:shell ==? "powershell"
|
let old_ssl = &shellslash
|
||||||
execute 'silent ! start ' . a:url
|
set shellslash
|
||||||
else
|
let url = shellescape(a:url, 1)
|
||||||
execute 'silent ! start "Title" /B ' . a:url
|
let &shellslash = old_ssl
|
||||||
|
else
|
||||||
|
let url = shellescape(a:url, 1)
|
||||||
|
endif
|
||||||
|
execute 'silent ! start ' . url
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
function! s:macunix_handler(url)
|
function! s:macunix_handler(url)
|
||||||
|
Loading…
Reference in New Issue
Block a user