Permalink
Browse files

Provide v:shell_error equivalent (g:xolox#shell#make_exit_code)

See issue #8 on GitHub:
  #8
  • Loading branch information...
1 parent f8ee02d commit e0a301af910c5f70a6d15cedf7896c530c8f2b83 @xolox committed May 14, 2013
Showing with 16 additions and 2 deletions.
  1. +3 −0 README.md
  2. +7 −2 autoload/xolox/shell.vim
  3. +6 −0 doc/shell.txt
View
@@ -40,6 +40,8 @@ Note that on UNIX if the environment variable `$DISPLAY` is empty the plug-in wi
This command is a very simple replacement for the [:make][make] command that does not pop up a console window on Windows. It doesn't come with all of the bells and whistles that Vim's built-in make command does but it should work.
+Because Vim's [v:shell_error][shell_error] variable is read only (which means it cannot be set by a Vim plug-in) the vim-shell plug-in defines its own variable with the exit code of the `make` process executed by `:MakeWithShell`. This variable is called `g:xolox#shell#make_exit_code`. The semantics are exactly the same as for [v:shell_error][shell_error].
+
### The `xolox#misc#os#exec()` function
This function enables other Vim plug-ins to execute external commands in the background (i.e. asynchronously) *without opening a command prompt window on Windows*. For example try to execute the following command on Windows ([vimrun.exe][vimrun] is only included with Vim for Windows because it isn't needed on other platforms):
@@ -135,6 +137,7 @@ This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/M
[make]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:make
[sh_opt]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27shell%27
[shcf_opt]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27shellcmdflag%27
+[shell_error]: http://vimdoc.sourceforge.net/htmldoc/eval.html#v:shell_error
[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,9 +1,9 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: May 13, 2013
+" Last Change: May 14, 2013
" URL: http://peterodding.com/code/vim/shell/
-let g:xolox#shell#version = '0.12.1'
+let g:xolox#shell#version = '0.12.2'
call xolox#misc#compat#check('shell', 3)
@@ -154,9 +154,14 @@ endfunction
function! s:make_cmd(command)
let command = a:command . ' 2>&1'
let result = xolox#misc#os#exec({'command': command, 'check': 0})
+ let g:xolox#shell#make_exit_code = result['exit_code']
return join(result['stdout'], "\n")
endfunction
+if !exists('g:xolox#shell#make_exit_code')
+ let g:xolox#shell#make_exit_code = 0
+endif
+
function! xolox#shell#maximize(...) " {{{1
" Show/hide Vim's menu, tool bar and/or tab line.
let new_state = a:0 == 0 ? !s:maximized : a:1
View
@@ -107,6 +107,12 @@ This command is a very simple replacement for the |:make| command that does not
pop up a console window on Windows. It doesn't come with all of the bells and
whistles that Vim's built-in make command does but it should work.
+Because Vim's |v:shell_error| variable is read only (which means it cannot be
+set by a Vim plug-in) the vim-shell plug-in defines its own variable with the
+exit code of the 'make' process executed by |:MakeWithShell|. This variable is
+called 'g:xolox#shell#make_exit_code'. The semantics are exactly the same as
+for |v:shell_error|.
+
-------------------------------------------------------------------------------
The *xolox#misc#os#exec()* function

0 comments on commit e0a301a

Please sign in to comment.