Permalink
Browse files

Use Vim's "shell" and "shellcmdflag" options

Thanks to SteP for suggesting this improvement!
  • Loading branch information...
1 parent 66f5bf5 commit 993f941c76e70f7f717c8e2d70b85cc24a7c3069 @xolox committed Feb 4, 2011
Showing with 8 additions and 4 deletions.
  1. +4 −0 README.md
  2. +2 −2 autoload.vim
  3. +2 −2 shell.vim
View
@@ -48,6 +48,8 @@ If you want to verify that this function works as described, open the Windows ta
Vim will be completely unresponsive until you "press any key to continue" in the command prompt window that's running [vimrun.exe][vimrun]. Now of course the [system()][system] function should only be used with non-interactive programs (the documentation says as much) but my point was to simulate an external command that takes a while to finish and blocks Vim while doing so.
+Note that on Windows this function uses Vim's ['shell'][sh_opt] and ['shellcmdflag'][shcf_opt] options to compose the command line passed to the DLL.
+
### The `g:shell_fullscreen_items` option
This variable is a string containing any combination of the following characters:
@@ -99,6 +101,8 @@ This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/M
[easytags]: http://peterodding.com/code/vim/easytags/
[gui]: http://vimdoc.sourceforge.net/htmldoc/gui.html#GUI
[libcall]: http://vimdoc.sourceforge.net/htmldoc/eval.html#libcall()
+[sh_opt]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27shell%27
+[shcf_opt]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27shellcmdflag%27
[system]: http://vimdoc.sourceforge.net/htmldoc/eval.html#system()
[vim]: http://www.vim.org/
[vim_scripts_entry]: http://www.vim.org/scripts/script.php?script_id=3123
View
@@ -1,6 +1,6 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: December 18, 2010
+" Last Change: January 27, 2011
" URL: http://peterodding.com/code/vim/shell/
if !exists('s:script')
@@ -105,7 +105,7 @@ function! xolox#shell#execute(command, synchronous, ...) " -- execute external c
endif
if xolox#is_windows() && s:has_dll()
let fn = 'execute_' . (a:synchronous ? '' : 'a') . 'synchronous'
- let cmd = ($COMSPEC != '' ? $COMSPEC : 'CMD.EXE') . ' /C ' . cmd
+ let cmd = &shell . ' ' . &shellcmdflag . ' ' . cmd
let error = s:library_call(fn, cmd)
if error != ''
let msg = '%s: %s(%s) failed! (error: %s)'
View
@@ -1,9 +1,9 @@
" Vim plug-in
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: December 18, 2010
+" Last Change: January 27, 2011
" URL: http://peterodding.com/code/vim/shell/
" License: MIT
-" Version: 0.9.1
+" Version: 0.9.2
" Support for automatic update using the GLVS plug-in.
" GetLatestVimScripts: 3123 1 :AutoInstall: shell.zip

0 comments on commit 993f941

Please sign in to comment.