-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a configuration option, g:makejob_hide_preview_window, to do pretty much what it says. If set to 1, the preview window is hidden during execution. This option does not affect configured autocmds, which might open the quickfix or location windows upon job completion if there are errors.
- Loading branch information
Showing
3 changed files
with
59 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,57 +3,76 @@ | |
Author: Daniel Moch <[email protected]> | ||
License: MIT (see LICENSE file for details) | ||
|
||
INTRODUCTION *makejob* *vim-makejob* | ||
MakeJob *makejob* *vim-makejob* | ||
|
||
This is a plugin for folks who think that Vim's quickfix feature is | ||
great, but who don't like how calls to |:make| and |:grep| freeze the | ||
editor. MakeJob implements asynchronous versions of the builtin | ||
commands in just over 150 lines of Vimscript. | ||
|
||
1. Commands |makejob-commands| | ||
2. Configuration |makejob-configuration| | ||
3. About |makejob-about| | ||
|
||
{only when compiled with the |channel|, |job|, and |quickfix| features} | ||
|
||
============================================================================= | ||
1. MakeJob Commands *makejob-commands* | ||
|
||
Here are your new quickfix commands. | ||
|
||
*makejob-MakeJob* | ||
*makejob-MakeJob* *:MakeJob* | ||
MakeJob[!] [{filename}] Start a makejob on the specified buffer, | ||
populating findings in the quickfix list. | ||
|makeprg| and |errorformat| must be set before | ||
MakeJob is called. {filename}, if specified, is the | ||
name of the file to make, and is appended to the | ||
end of |makeprg|. Ex special characters are | ||
MakeJob is called. {filename}, if specified, is | ||
the name of the file to make, and is appended to | ||
the end of |makeprg|. Ex special characters are | ||
expanded (see |cmdline-special|). |autowrite|, | ||
|QuickFixCmdPre|, and |QuickFixCmdPost| all | ||
work as expected. While the job runs, output | ||
will be directed to a preview buffer below | ||
the active buffer. If [!] is not given, the | ||
first error is jumped to. | ||
|QuickFixCmdPre|, and |QuickFixCmdPost| all work | ||
as expected. While the job runs, output will be | ||
directed to a preview buffer below the active | ||
buffer. If [!] is not given, the first error is | ||
jumped to. | ||
|
||
*makejob-LmakeJob* | ||
*makejob-LmakeJob* *:LmakeJob* | ||
LmakeJob[!] [{filename}] Same as ":MakeJob", except the location list for | ||
the current window is used instead of the quickfix | ||
list. | ||
|
||
*makejob-GrepJob* | ||
GrepJob[!] {filename} Run the grep command specified in |grepprg| | ||
and read into the quickfix list using | ||
|grepformat|. {filename} must be specified, | ||
but can contain wildcards. | ||
*makejob-GrepJob* *:GrepJob* | ||
GrepJob[!] {filename} Run the grep command specified in |grepprg| and | ||
read into the quickfix list using |grepformat|. | ||
{filename} must be specified, but can contain | ||
wildcards. | ||
|
||
*makejob-LgrepJob* | ||
*makejob-LgrepJob* *:LgrepJob* | ||
LgrepJob[!] {filename} Same as ":GrepJob", except the location list for | ||
the current window is used instead of the quickfix | ||
list. | ||
|
||
*makejob-GrepaddJob* | ||
*makejob-GrepaddJob* *:GrepaddJob* | ||
GrepaddJob[!] {filename} Same as ":GrepJob", but add findings to the | ||
quickfix list without clearing it first. | ||
|
||
*makejob-LgrepaddJob* | ||
*makejob-LgrepaddJob* *:LgrepaddJob* | ||
LgrepaddJob[!] {filename} Same as ":GrepaddJob", but add findings to the | ||
location list without clearing it first. | ||
|
||
ABOUT *makejob-about* | ||
============================================================================= | ||
2. CONFIGURATION *makejob-configuration* | ||
|
||
*g:makejob_hide_preview_window* | ||
number (default 0) | ||
g:makejob_hide_preview_window Hide the preview window during execution. | ||
Default (0) is to show the preview window. | ||
Set to 1 to hide it. | ||
|
||
============================================================================= | ||
3. ABOUT *makejob-about* | ||
|
||
More details can be found in README.md or by navigating to: | ||
|
||
https://github.com/djmoch/vim-makejob | ||
|
||
vim:tw=78:ts=8:ft=help:norl: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
" | ||
" TITLE: VIM-MAKEJOB | ||
" AUTHOR: Daniel Moch <[email protected]> | ||
" VERSION: 1.2-dev | ||
" VERSION: 1.2 | ||
" | ||
if exists('g:loaded_makejob') || &cp | ||
finish | ||
|
@@ -14,6 +14,10 @@ let s:save_cpo = &cpo | |
set cpo&vim | ||
let s:jobinfo = {} | ||
|
||
if !exists('g:makejob_hide_preview_window') | ||
let g:makejob_hide_preview_window = 0 | ||
endif | ||
|
||
function! s:InitAutocmd(lmake, grep, cmd) | ||
let l:returnval = 'doautocmd QuickFixCmd'.a:cmd.' ' | ||
if a:grep | ||
|
@@ -44,7 +48,7 @@ function! s:JobHandler(channel) abort | |
let l:qfcmd = l:job['grepadd'] ? 'caddbuffer' : 'cgetbuffer' | ||
endif | ||
|
||
if bufwinnr(l:job['outbufnr']) | ||
if bufwinnr(l:job['outbufnr']) && l:job['outbufhidden'] == 0 | ||
silent execute bufwinnr(l:job['outbufnr']).'close' | ||
endif | ||
silent execute l:qfcmd.' '.l:job['outbufnr'] | ||
|
@@ -77,7 +81,11 @@ function! s:CreateMakeJobWindow(prog) | |
setlocal bufhidden=hide buftype=nofile nobuflisted nolist | ||
setlocal noswapfile nowrap nomodifiable | ||
let l:bufnum = winbufnr(0) | ||
wincmd p | ||
if g:makejob_hide_preview_window | ||
hide | ||
else | ||
wincmd p | ||
end | ||
return l:bufnum | ||
endfunction | ||
|
||
|
@@ -156,7 +164,8 @@ function! s:MakeJob(grep, lmake, grepadd, bang, ...) | |
\ 'outbufnr': l:outbufnr, | ||
\ 'srcbufnr': winbufnr(0), | ||
\ 'cfirst': !a:bang, 'grep': a:grep, | ||
\ 'grepadd': a:grepadd } | ||
\ 'grepadd': a:grepadd, | ||
\ 'outbufhidden': g:makejob_hide_preview_window } | ||
echomsg s:jobinfo[split(job_getchannel(l:job))[1]]['prog'] | ||
\ .' started' | ||
end | ||
|