Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Workaround &shellslash option on Windows (issue #6)

I'm not sure if this is the right thing to do but I've had several
"bug reports" about this option breaking my plug-ins. What I'm not
sure about is whether this option has a legitimate use case that
I'm breaking with this change...

TODO If I don't get any complaints about this change I may have to
move xolox#shell#escape() to xolox#misc#os#shellescape() and use it
in my other plug-ins as well?
  • Loading branch information...
commit 942e75abf9ed45f372d9d68a72e3bdb6aced648e 1 parent d530837
Peter Odding authored
Showing with 18 additions and 4 deletions.
  1. +18 −4 autoload/xolox/shell.vim
22 autoload/xolox/shell.vim
View
@@ -1,9 +1,9 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: October 28, 2011
+" Last Change: October 29, 2011
" URL: http://peterodding.com/code/vim/shell/
-let g:xolox#shell#version = '0.9.18'
+let g:xolox#shell#version = '0.9.20'
if !exists('s:fullscreen_enabled')
let s:enoimpl = "%s() hasn't been implemented on your platform! %s"
@@ -122,11 +122,11 @@ function! xolox#shell#execute(command, synchronous, ...) " -- execute external c
if has_input
let tempin = tempname()
call writefile(type(a:1) == type([]) ? a:1 : split(a:1, "\n"), tempin)
- let cmd .= ' < ' . shellescape(tempin)
+ let cmd .= ' < ' . xolox#shell#escape(tempin)
endif
if a:synchronous
let tempout = tempname()
- let cmd .= ' > ' . shellescape(tempout) . ' 2>&1'
+ let cmd .= ' > ' . xolox#shell#escape(tempout) . ' 2>&1'
endif
if xolox#misc#os#is_win() && s:has_dll()
let fn = 'execute_' . (a:synchronous ? '' : 'a') . 'synchronous'
@@ -162,6 +162,20 @@ function! xolox#shell#execute(command, synchronous, ...) " -- execute external c
endtry
endfunction
+function! xolox#shell#escape(argument) " -- quote command line arguments {{{1
+ if xolox#misc#os#is_win()
+ try
+ let ssl_save = &shellslash
+ set noshellslash
+ return shellescape(a:argument)
+ finally
+ let &shellslash = ssl_save
+ endtry
+ else
+ return shellescape(a:argument)
+ endif
+endfunction
+
function! xolox#shell#maximize(...) " -- show/hide Vim's menu, tool bar and/or tab line {{{1
let new_state = a:0 == 0 ? !s:maximized : a:1
if new_state && !s:maximized
Please sign in to comment.
Something went wrong with that request. Please try again.