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 8617e044b706c4585e8fcfb3985a93ab2460ecb8
parent 91cfe22c4050e5115d1f9401e672e4873831f5cc
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Fri, 22 Dec 2017 08:38:04 -0500

Fix location of preview buffer for QuickFix

Fix #11 by opening the preview buffer at the bottom-right of the current
tab, the same location where the quickfix window appears. This
(hopefully) solves issues of the window arrangement bouncing around
during quickfix operations when there are multiple windows in the
current tab. Location Window operations still open the preview buffer
below the current window.

Diffstat:
Mplugin/makejob.vim | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/plugin/makejob.vim b/plugin/makejob.vim @@ -110,7 +110,12 @@ function! s:JobHandler(channel) abort echomsg l:job['prog']." returned ".l:exitval." with ".l:makeoutput." findings" endfunction -function! s:CreateMakeJobBuffer(prog) +function! s:CreateMakeJobBuffer(prog, lmake) + let l:winct = winnr('$') + let l:curwinnr = winnr() + if !a:lmake + execute l:winct.'wincmd w' + endif silent execute 'belowright 10split '.a:prog setlocal bufhidden=hide buftype=nofile buflisted nolist setlocal noswapfile nowrap nomodifiable @@ -119,7 +124,7 @@ function! s:CreateMakeJobBuffer(prog) if g:makejob_hide_preview_window hide else - wincmd p + execute l:curwinnr.'wincmd w' end return l:bufnum endfunction @@ -191,7 +196,7 @@ function! s:MakeJob(grep, lmake, grepadd, bang, ...) abort execute l:make return else - let l:outbufnr = s:CreateMakeJobBuffer(prog) + let l:outbufnr = s:CreateMakeJobBuffer(prog, a:lmake) let l:makejob = job_start(l:make, l:opts) let b:makejob = l:makejob