diff options
author | Peter Odding <peter@peterodding.com> | 2011-11-21 22:05:32 +0100 |
---|---|---|
committer | Peter Odding <peter@peterodding.com> | 2011-11-21 22:05:32 +0100 |
commit | ef35a596660a5202f47eeac5988023c9b8bd4eb0 (patch) | |
tree | a4631391bf9b2c302509f231328b0027cbe12abc /autoload | |
parent | 4b4cd4db5e452305082e151b1bd6605509feff22 (diff) | |
parent | d7b3e0cb4d4343316d53346b1cf7b77b32ed58a9 (diff) | |
download | vim-easytags-ef35a596660a5202f47eeac5988023c9b8bd4eb0.tar.gz |
Merge branch 'master' of https://github.com/xolox/vim-misc
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/xolox/misc/escape.vim | 22 | ||||
-rw-r--r-- | autoload/xolox/misc/open.vim | 6 |
2 files changed, 24 insertions, 4 deletions
diff --git a/autoload/xolox/misc/escape.vim b/autoload/xolox/misc/escape.vim index a698ae0..1dd1838 100644 --- a/autoload/xolox/misc/escape.vim +++ b/autoload/xolox/misc/escape.vim @@ -1,6 +1,6 @@ " Vim auto-load script " Author: Peter Odding <peter@peterodding.com> -" Last Change: March 15, 2011 +" Last Change: November 21, 2011 " URL: http://peterodding.com/code/vim/misc/ " Convert a string into a :substitute pattern that matches the string literally. @@ -23,4 +23,24 @@ function! xolox#misc#escape#substitute(string) return '' endfunction +" Convert a string into a quoted command line argument. I was going to add a +" long rant here about &shellslash, but really, it won't make any difference. +" Let's just suffice to say that I have yet to encounter a single person out +" there who uses this option for its intended purpose (running a UNIX-style +" shell on Windows). + +function! xolox#misc#escape#shell(string) + if xolox#misc#os#is_win() + try + let ssl_save = &shellslash + set noshellslash + return shellescape(a:string) + finally + let &shellslash = ssl_save + endtry + else + return shellescape(a:string) + endif +endfunction + " vim: ts=2 sw=2 et diff --git a/autoload/xolox/misc/open.vim b/autoload/xolox/misc/open.vim index 30d2aa3..1fb24e0 100644 --- a/autoload/xolox/misc/open.vim +++ b/autoload/xolox/misc/open.vim @@ -1,10 +1,10 @@ " Vim auto-load script " Author: Peter Odding <peter@peterodding.com> -" Last Change: June 18, 2011 +" Last Change: November 21, 2011 " URL: http://peterodding.com/code/vim/misc/ if !exists('s:version') - let s:version = '1.0' + let s:version = '1.1' let s:enoimpl = "open.vim %s: %s() hasn't been implemented for your platform! If you have suggestions, please contact peter@peterodding.com." let s:handlers = ['gnome-open', 'kde-open', 'exo-open', 'xdg-open'] endif @@ -15,7 +15,7 @@ function! xolox#misc#open#file(path, ...) call xolox#shell#open_with_windows_shell(a:path) catch /^Vim\%((\a\+)\)\=:E117/ let command = '!start CMD /C START "" %s' - silent execute printf(command, shellescape(a:path)) + silent execute printf(command, xolox#misc#escape#shell(a:path)) endtry return elseif has('macunix') |