Skip to content

Commit d2a8b23

Browse files
committed
2 parents ae7b41b + d7b3e0c commit d2a8b23

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

autoload/xolox/misc/escape.vim

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" Vim auto-load script
22
" Author: Peter Odding <[email protected]>
3-
" Last Change: March 15, 2011
3+
" Last Change: November 21, 2011
44
" URL: http://peterodding.com/code/vim/misc/
55

66
" Convert a string into a :substitute pattern that matches the string literally.
@@ -23,4 +23,24 @@ function! xolox#misc#escape#substitute(string)
2323
return ''
2424
endfunction
2525

26+
" Convert a string into a quoted command line argument. I was going to add a
27+
" long rant here about &shellslash, but really, it won't make any difference.
28+
" Let's just suffice to say that I have yet to encounter a single person out
29+
" there who uses this option for its intended purpose (running a UNIX-style
30+
" shell on Windows).
31+
32+
function! xolox#misc#escape#shell(string)
33+
if xolox#misc#os#is_win()
34+
try
35+
let ssl_save = &shellslash
36+
set noshellslash
37+
return shellescape(a:string)
38+
finally
39+
let &shellslash = ssl_save
40+
endtry
41+
else
42+
return shellescape(a:string)
43+
endif
44+
endfunction
45+
2646
" vim: ts=2 sw=2 et

autoload/xolox/misc/open.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
" Vim auto-load script
22
" Author: Peter Odding <[email protected]>
3-
" Last Change: June 18, 2011
3+
" Last Change: November 21, 2011
44
" URL: http://peterodding.com/code/vim/misc/
55

66
if !exists('s:version')
7-
let s:version = '1.0'
7+
let s:version = '1.1'
88
let s:enoimpl = "open.vim %s: %s() hasn't been implemented for your platform! If you have suggestions, please contact [email protected]."
99
let s:handlers = ['gnome-open', 'kde-open', 'exo-open', 'xdg-open']
1010
endif
@@ -15,7 +15,7 @@ function! xolox#misc#open#file(path, ...)
1515
call xolox#shell#open_with_windows_shell(a:path)
1616
catch /^Vim\%((\a\+)\)\=:E117/
1717
let command = '!start CMD /C START "" %s'
18-
silent execute printf(command, shellescape(a:path))
18+
silent execute printf(command, xolox#misc#escape#shell(a:path))
1919
endtry
2020
return
2121
elseif has('macunix')

0 commit comments

Comments
 (0)