File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11" Vim auto-load script
22" Author: Peter Odding <peter@peterodding.com>
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 ' '
2424endfunction
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
Original file line number Diff line number Diff line change 11" Vim auto-load script
22" Author: Peter Odding <peter@peterodding.com>
3- " Last Change: June 18 , 2011
3+ " Last Change: November 21 , 2011
44" URL: http://peterodding.com/code/vim/misc/
55
66if ! 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 peter@peterodding.com."
99 let s: handlers = [' gnome-open' , ' kde-open' , ' exo-open' , ' xdg-open' ]
1010endif
@@ -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' )
You can’t perform that action at this time.
0 commit comments