Skip to content

Commit 52c9b24

Browse files
committed
Make integration (:make without console window, closes issue #8)
Issue #8 on GitHub: #8
1 parent 614fbf0 commit 52c9b24

File tree

4 files changed

+41
-9
lines changed

4 files changed

+41
-9
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ This will launch your preferred (or the best available) web browser. Likewise th
3636

3737
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.
3838

39+
### The `:MakeWithShell` command
40+
41+
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.
42+
3943
### The `xolox#shell#execute()` function
4044

4145
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
117121
[easytags]: http://peterodding.com/code/vim/easytags/
118122
[gui]: http://vimdoc.sourceforge.net/htmldoc/gui.html#GUI
119123
[libcall]: http://vimdoc.sourceforge.net/htmldoc/eval.html#libcall()
124+
[make]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:make
120125
[sh_opt]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27shell%27
121126
[shcf_opt]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27shellcmdflag%27
122127
[system]: http://vimdoc.sourceforge.net/htmldoc/eval.html#system()

autoload/xolox/shell.vim

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
" Vim auto-load script
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: April 30, 2013
3+
" Last Change: May 2, 2013
44
" URL: http://peterodding.com/code/vim/shell/
55

6-
let g:xolox#shell#version = '0.9.26'
6+
let g:xolox#shell#version = '0.10'
77

88
call xolox#misc#compat#check('shell', 2)
99

@@ -164,6 +164,20 @@ function! xolox#shell#execute(command, synchronous, ...) " -- execute external c
164164
endtry
165165
endfunction
166166

167+
function! xolox#shell#make(bang, args) " -- run :make silent (without a console window) {{{1
168+
let command = &makeprg
169+
if a:args =~ '\S'
170+
let command .= ' ' . a:args
171+
endif
172+
call xolox#misc#msg#info("shell.vim %s: Running make command %s ..", g:xolox#shell#version, command)
173+
if a:bang == '!'
174+
cgetexpr xolox#shell#execute(command, 1)
175+
else
176+
cexpr xolox#shell#execute(command, 1)
177+
endif
178+
cwindow
179+
endfunction
180+
167181
function! xolox#shell#maximize(...) " -- show/hide Vim's menu, tool bar and/or tab line {{{1
168182
let new_state = a:0 == 0 ? !s:maximized : a:1
169183
if new_state && !s:maximized

doc/shell.txt

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ Contents ~
99
1. The |:Maximize| command
1010
2. The |:Fullscreen| command
1111
3. The |:Open| command
12-
4. The |xolox#shell#execute()| function
13-
5. The |xolox#shell#fullscreen()| function
14-
6. The |xolox#shell#is_fullscreen()| function
15-
7. The |g:shell_fullscreen_items| option
16-
8. The |g:shell_mappings_enabled| option
17-
9. The |g:shell_verify_urls| option
12+
4. The |:MakeWithShell| command
13+
5. The |xolox#shell#execute()| function
14+
6. The |xolox#shell#fullscreen()| function
15+
7. The |xolox#shell#is_fullscreen()| function
16+
8. The |g:shell_fullscreen_items| option
17+
9. The |g:shell_mappings_enabled| option
18+
10. The |g:shell_make_override| option
19+
11. The |g:shell_verify_urls| option
1820
3. Background |shell-background|
1921
4. Other full-screen implementations |shell-other-full-screen-implementations|
2022
5. Contact |shell-contact|
@@ -98,6 +100,13 @@ Note that on UNIX if the environment variable '$DISPLAY' is empty the plug-in
98100
will fall back to a command-line web browser. Because such web browsers are
99101
executed in front of Vim you have to quit the web browser to return to Vim.
100102

103+
-------------------------------------------------------------------------------
104+
The *:MakeWithShell* command
105+
106+
This command is a very simple replacement for the |:make| command that does not
107+
pop up a console window on Windows. It doesn't come with all of the bells and
108+
whistles that Vim's built-in make command does but it should work.
109+
101110
-------------------------------------------------------------------------------
102111
The *xolox#shell#execute()* function
103112

@@ -179,6 +188,9 @@ to your |vimrc| script:
179188
:inoremap <Leader>op <C-o>:Open<CR>
180189
:nnoremap <Leader>op :Open<CR>
181190
191+
-------------------------------------------------------------------------------
192+
The *g:shell_make_override* option
193+
182194
-------------------------------------------------------------------------------
183195
The *g:shell_verify_urls* option
184196

plugin/shell.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" Vim plug-in
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: October 28, 2011
3+
" Last Change: May 2, 2013
44
" URL: http://peterodding.com/code/vim/shell/
55

66
" Support for automatic update using the GLVS plug-in.
@@ -37,6 +37,7 @@ augroup END
3737
command! -bar -nargs=? -complete=file Open call xolox#shell#open_cmd(<q-args>)
3838
command! -bar Maximize call xolox#shell#maximize()
3939
command! -bar Fullscreen call xolox#shell#fullscreen()
40+
command! -bar -bang -nargs=? MakeWithShell :call xolox#shell#make(<q-bang>, <q-args>)
4041

4142
" Default key mappings. {{{1
4243

0 commit comments

Comments
 (0)