Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' of https://github.com/xolox/vim-misc

  • Loading branch information...
commit ca5f8f42dd1ad43366c5bc1030cfe3eb568db8ec 2 parents a33b8a7 + d7b3e0c
Peter Odding authored November 21, 2011
22  autoload/xolox/misc/escape.vim
... ...
@@ -1,6 +1,6 @@
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
6  autoload/xolox/misc/open.vim
... ...
@@ -1,10 +1,10 @@
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')

0 notes on commit ca5f8f4

Please sign in to comment.
Something went wrong with that request. Please try again.