Skip to content

Commit 1367b0a

Browse files
committed
Shell escape URL argument to browsers
References tpope#439
1 parent b07208e commit 1367b0a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

autoload/rails.vim

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,19 +1461,19 @@ call s:add_methods('app', ['rake_command'])
14611461
function! s:initOpenURL() abort
14621462
if exists(":OpenURL") != 2
14631463
if exists(":Browse") == 2
1464-
command -bar -nargs=1 OpenURL :Browse <args>
1464+
command -bar -nargs=1 OpenURL Browse <args>
14651465
elseif has("gui_mac") || has("gui_macvim") || exists("$SECURITYSESSIONID")
1466-
command -bar -nargs=1 OpenURL :!open <args>
1466+
command -bar -nargs=1 OpenURL exe '!open' shellescape(<q-args>, 1)
14671467
elseif has("gui_win32")
1468-
command -bar -nargs=1 OpenURL :!start cmd /cstart /b <args>
1468+
command -bar -nargs=1 OpenURL exe '!start cmd /cstart /b' shellescape(<q-args>, 1)
14691469
elseif executable("xdg-open")
1470-
command -bar -nargs=1 OpenURL :!xdg-open <args> &
1470+
command -bar -nargs=1 OpenURL exe '!xdg-open' shellescape(<q-args>, 1) '&'
14711471
elseif executable("sensible-browser")
1472-
command -bar -nargs=1 OpenURL :!sensible-browser <args>
1472+
command -bar -nargs=1 OpenURL exe '!sensible-browser' shellescape(<q-args>, 1)
14731473
elseif executable('launchy')
1474-
command -bar -nargs=1 OpenURL :!launchy <args>
1474+
command -bar -nargs=1 OpenURL exe '!launchy' shellescape(<q-args>, 1)
14751475
elseif executable('git')
1476-
command -bar -nargs=1 OpenURL :!git web--browse <args>
1476+
command -bar -nargs=1 OpenURL exe '!git web--browse' shellescape(<q-args>, 1)
14771477
endif
14781478
endif
14791479
endfunction

0 commit comments

Comments
 (0)