File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 1
1
" Vim auto-load script
2
2
" Author: Peter Odding <peter@peterodding.com>
3
- " Last Change: March 15 , 2011
3
+ " Last Change: November 21 , 2011
4
4
" URL: http://peterodding.com/code/vim/misc/
5
5
6
6
" Convert a string into a :substitute pattern that matches the string literally.
@@ -23,4 +23,24 @@ function! xolox#misc#escape#substitute(string)
23
23
return ' '
24
24
endfunction
25
25
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
+
26
46
" vim: ts = 2 sw = 2 et
Original file line number Diff line number Diff line change 1
1
" Vim auto-load script
2
2
" Author: Peter Odding <peter@peterodding.com>
3
- " Last Change: June 18 , 2011
3
+ " Last Change: November 21 , 2011
4
4
" URL: http://peterodding.com/code/vim/misc/
5
5
6
6
if ! exists (' s:version' )
7
- let s: version = ' 1.0 '
7
+ let s: version = ' 1.1 '
8
8
let s: enoimpl = " open.vim %s: %s() hasn't been implemented for your platform! If you have suggestions, please contact peter@peterodding.com."
9
9
let s: handlers = [' gnome-open' , ' kde-open' , ' exo-open' , ' xdg-open' ]
10
10
endif
@@ -15,7 +15,7 @@ function! xolox#misc#open#file(path, ...)
15
15
call xolox#shell#open_with_windows_shell (a: path )
16
16
catch /^Vim\%((\a\+)\)\=:E117/
17
17
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 ))
19
19
endtry
20
20
return
21
21
elseif has (' macunix' )
You can’t perform that action at this time.
0 commit comments