Skip to content

Commit

Permalink
Workaround &shellslash option on Windows (issue #6)
Browse files Browse the repository at this point in the history
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
xolox committed Oct 28, 2011
1 parent d530837 commit 942e75a
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions autoload/xolox/shell.vim
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 942e75a

Please sign in to comment.