Skip to content

Commit

Permalink
Force noshellslash when shellescaping args in vim script.
Browse files Browse the repository at this point in the history
If shellslash is set, it fails on windows. Closes #103.
  • Loading branch information
nsf committed Oct 18, 2012
1 parent 64791d9 commit d4c28a0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions vim/autoload/gocomplete.vim
Expand Up @@ -19,12 +19,22 @@ fu! s:system(str, ...)
return (a:0 == 0 ? system(a:str) : system(a:str, join(a:000))) return (a:0 == 0 ? system(a:str) : system(a:str, join(a:000)))
endf endf


fu! s:gocodeShellescape(arg)
try
let ssl_save = &shellslash
set noshellslash
return shellescape(a:arg)
finally
let &shellslash = ssl_save
endtry
endf

fu! s:gocodeCommand(cmd, preargs, args) fu! s:gocodeCommand(cmd, preargs, args)
for i in range(0, len(a:args) - 1) for i in range(0, len(a:args) - 1)
let a:args[i] = shellescape(a:args[i]) let a:args[i] = s:gocodeShellescape(a:args[i])
endfor endfor
for i in range(0, len(a:preargs) - 1) for i in range(0, len(a:preargs) - 1)
let a:preargs[i] = shellescape(a:preargs[i]) let a:preargs[i] = s:gocodeShellescape(a:preargs[i])
endfor endfor
let result = s:system(printf('gocode %s %s %s', join(a:preargs), a:cmd, join(a:args))) let result = s:system(printf('gocode %s %s %s', join(a:preargs), a:cmd, join(a:args)))
if v:shell_error != 0 if v:shell_error != 0
Expand Down

0 comments on commit d4c28a0

Please sign in to comment.