vim-makejob

Minimal, asynchronous quickfix commands for Vim 8.0
git clone git://git.danielmoch.com/vim-makejob.git
Log | Files | Refs | README | LICENSE

commit 7b427116f59eaf58f0a8eb2adb609e34308a6ac0
parent 9f73945445bbe11f6da0e45cc256622220d57e17
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Tue,  8 Nov 2016 18:11:23 -0500

v0.3 release - Complete feature parity with :make

Add support for QuickFixCmdPre and QuickFixCmdPost autocmds. Also add
support for autowrite boolean.

Diffstat:
MREADME.md | 4++--
Mdoc/makejob.txt | 2++
Mplugin/makejob.vim | 18++++++++++++++++--
3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md @@ -14,8 +14,8 @@ just over 100 lines of Vimscript. `errorformat`. Use the Quickfix or Location List window to view findings. 3. Complete feature parity with `:make` and `:lmake` per the steps - outlined in `:help make`. Still todo are `autowrite`, - `QuickFixCmdPre` and `QuickFixCmdPost`. + outlined in `:help make`. `autowrite`, `QuickFixCmdPre` and + `QuickFixCmdPost` work as expected. ## Installation ### Pathogen diff --git a/doc/makejob.txt b/doc/makejob.txt @@ -20,6 +20,8 @@ MakeJob [{bufname}] Start a makejob on the specified buffer, name of the file to make, and is appended to the end of |makeprg|. MakeJob currently only expands the special character % (see |_%|). + |autowrite|, |QuickFixCmdPre|, and + |QuickFixCmdPost| all work as expected. *makejob-LmakeJob* LmakeJob [{bufname}] Same as ":MakeJob", except the location list for diff --git a/plugin/makejob.vim b/plugin/makejob.vim @@ -1,9 +1,10 @@ " " TITLE: VIM-MAKEJOB " AUTHOR: Daniel Moch <daniel@danielmoch.com> -" VERSION: 0.2 +" VERSION: 0.3 " -if exists('g:loaded_makejob') || version < 800 +if exists('g:loaded_makejob') || version < 800 || !has('job') || + \ !has('channel') finish endif let g:loaded_makejob = 1 @@ -46,8 +47,10 @@ function! s:JobHandler(channel) abort if is_lmake call setloclist(winnr(), makeoutput, 'r') + silent doautocmd QuickFixCmdPost lmake else call setqflist(makeoutput, 'r') + silent doautocmd QuickFixCmdPost make endif echo s:jobinfo[split(a:channel)[1]]['prog']." ended with " @@ -102,6 +105,17 @@ function! s:MakeJob(lmake, ...) endif endif let opts = { 'close_cb' : s:Function('s:JobHandler') } + + if a:lmake + silent doautocmd QuickFixCmdPre lmake + else + silent doautocmd QuickFixCmdPre make + endif + + if &autowrite + silent write + endif + let job = job_start(joblist, opts) let s:jobinfo[split(job_getchannel(job))[1]] = {'prog': joblist[0],'lmake': a:lmake} echo s:jobinfo[split(job_getchannel(job))[1]]['prog'].' started'