-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[vim-8.0] quickfix or locationlist steal focus after save #1073
Comments
Hi @achilleas-k I agree, but I couldn't find a solution for that. Even though I say don't jump, Vim still jumps :) If you find something let me know |
Not at all familiar with vimscript but I'll have a poke. |
Well, I managed to hack up a workaround, at least for the quickfix window (not sure about location list). augroup quickfix
autocmd!
autocmd Syntax qf wincmd p
augroup END The problem then becomes that the cursor jumps to the beginning of the file when qf opens. So after that, I wrapped function! s:callback(chan, msg) closure
let old_errorformat = &errorformat
let &errorformat = l:errformat
caddexpr a:msg
let &errorformat = old_errorformat
" TODO(arslan): cursor still jumps to first error even If I don't want
" it. Seems like there is a regression somewhere, but not sure where.
augroup quickfix
autocmd!
autocmd Syntax qf wincmd p
augroup END
let winview=winsaveview()
copen
call winrestview(winview)
endfunction and it works as expected. I suspect the |
Discovered now that for some reason (I guess from the opening of the qf window), the main buffer is set to This is definitely getting dirtier but I hope it points in the right direction. |
It seems to me, that instead of hooking an autocmd to function! s:callback(chan, msg) closure
let old_errorformat = &errorformat
let &errorformat = l:errformat
caddexpr a:msg
let &errorformat = old_errorformat
" TODO(arslan): cursor still jumps to first error even If I don't want
" it. Seems like there is a regression somewhere, but not sure where.
copen
wincmd p " the cursor jumped to qf: go back to the active window
endfunction In my quick local tests this seemed to work. It also preserves the cursor position and |
I can confirm that thsnr's one-line patch (wincmd p) fixes this issue for me in the following vim build: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 07 2017 03:33:23) |
This is fixed with #1293. Please pull the latest master branch to test it (note that master is development branch) or wait until the next stable release. Thanks for all the feedback. |
Related to issue fatih#1073.
Actual behavior
With the current vim-8.0 branch, after saving a file, linting begins in the background (async). If there are errors, the quickfix or location-list buffer appears and the cursor moves into the new split. This is especially bad with the new async feature, since the user is free to continue typing or move around the file while linting is running in the background (which can take a few seconds) and the focus stealing interrups flow.
Expected behavior
Quickfix or location list should appear and not steal focus (or it should be optional).
Steps to reproduce:
Reproducible with minimal vimrc file. Only vim-go installed. Just save a go file with an error that would be caught by an active linter.
Configuration
vim version: 8.0
vim-go version: vim-8.0 head (
29196e5cb81793983c6838fbf15871c9298c35ff
)Configuration:
The text was updated successfully, but these errors were encountered: