Permalink
Browse files

Make integration (:make without console window, closes issue #8)

Issue #8 on GitHub: #8
  • Loading branch information...
1 parent 614fbf0 commit 52c9b245caa879f1ec2357d3fa9ee22fe3a1fe74 @xolox committed May 1, 2013
Showing with 41 additions and 9 deletions.
  1. +5 −0 README.md
  2. +16 −2 autoload/xolox/shell.vim
  3. +18 −6 doc/shell.txt
  4. +2 −1 plugin/shell.vim
View
@@ -36,6 +36,10 @@ This will launch your preferred (or the best available) web browser. Likewise th
Note that on UNIX if the environment variable `$DISPLAY` is empty the plug-in will fall back to a command-line web browser. Because such web browsers are executed in front of Vim you have to quit the web browser to return to Vim.
+### The `:MakeWithShell` command
+
+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.
+
### The `xolox#shell#execute()` 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):
@@ -117,6 +121,7 @@ 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()
+[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
[system]: http://vimdoc.sourceforge.net/htmldoc/eval.html#system()
View
@@ -1,9 +1,9 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: April 30, 2013
+" Last Change: May 2, 2013
" URL: http://peterodding.com/code/vim/shell/
-let g:xolox#shell#version = '0.9.26'
+let g:xolox#shell#version = '0.10'
call xolox#misc#compat#check('shell', 2)
@@ -164,6 +164,20 @@ function! xolox#shell#execute(command, synchronous, ...) " -- execute external c
endtry
endfunction
+function! xolox#shell#make(bang, args) " -- run :make silent (without a console window) {{{1
+ let command = &makeprg
+ if a:args =~ '\S'
+ let command .= ' ' . a:args
+ endif
+ call xolox#misc#msg#info("shell.vim %s: Running make command %s ..", g:xolox#shell#version, command)
+ if a:bang == '!'
+ cgetexpr xolox#shell#execute(command, 1)
+ else
+ cexpr xolox#shell#execute(command, 1)
+ endif
+ cwindow
+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
View
@@ -9,12 +9,14 @@ Contents ~
1. The |:Maximize| command
2. The |:Fullscreen| command
3. The |:Open| command
- 4. The |xolox#shell#execute()| function
- 5. The |xolox#shell#fullscreen()| function
- 6. The |xolox#shell#is_fullscreen()| function
- 7. The |g:shell_fullscreen_items| option
- 8. The |g:shell_mappings_enabled| option
- 9. The |g:shell_verify_urls| option
+ 4. The |:MakeWithShell| command
+ 5. The |xolox#shell#execute()| function
+ 6. The |xolox#shell#fullscreen()| function
+ 7. The |xolox#shell#is_fullscreen()| function
+ 8. The |g:shell_fullscreen_items| option
+ 9. The |g:shell_mappings_enabled| option
+ 10. The |g:shell_make_override| option
+ 11. The |g:shell_verify_urls| option
3. Background |shell-background|
4. Other full-screen implementations |shell-other-full-screen-implementations|
5. Contact |shell-contact|
@@ -98,6 +100,13 @@ Note that on UNIX if the environment variable '$DISPLAY' is empty the plug-in
will fall back to a command-line web browser. Because such web browsers are
executed in front of Vim you have to quit the web browser to return to Vim.
+-------------------------------------------------------------------------------
+The *:MakeWithShell* command
+
+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.
+
-------------------------------------------------------------------------------
The *xolox#shell#execute()* function
@@ -179,6 +188,9 @@ to your |vimrc| script:
:inoremap <Leader>op <C-o>:Open<CR>
:nnoremap <Leader>op :Open<CR>
+-------------------------------------------------------------------------------
+The *g:shell_make_override* option
+
-------------------------------------------------------------------------------
The *g:shell_verify_urls* option
View
@@ -1,6 +1,6 @@
" Vim plug-in
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: October 28, 2011
+" Last Change: May 2, 2013
" URL: http://peterodding.com/code/vim/shell/
" Support for automatic update using the GLVS plug-in.
@@ -37,6 +37,7 @@ augroup END
command! -bar -nargs=? -complete=file Open call xolox#shell#open_cmd(<q-args>)
command! -bar Maximize call xolox#shell#maximize()
command! -bar Fullscreen call xolox#shell#fullscreen()
+command! -bar -bang -nargs=? MakeWithShell :call xolox#shell#make(<q-bang>, <q-args>)
" Default key mappings. {{{1

0 comments on commit 52c9b24

Please sign in to comment.