From 12367470eeba432b4020f31649295126fedcb238 Mon Sep 17 00:00:00 2001 From: Christian Höltje Date: Wed, 21 Mar 2018 00:17:01 -0400 Subject: don't change focus to the quicklist Add an option to restore the cursor's window & position after calling `setqflist()`. --- autoload/prettier.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'autoload/prettier.vim') diff --git a/autoload/prettier.vim b/autoload/prettier.vim index bda5b66..54cce8d 100644 --- a/autoload/prettier.vim +++ b/autoload/prettier.vim @@ -48,7 +48,7 @@ function! prettier#Prettier(...) abort " close quickfix if it is opened if s:prettier_quickfix_open - call setqflist([]) + call setqflist([], 'r') cclose let s:prettier_quickfix_open = 0 endif @@ -248,8 +248,13 @@ function! s:Handle_Parsing_Errors(out) abort endfor if len(l:errors) - call setqflist(l:errors) + let l:winnr = winnr() + call setqflist(l:errors, 'r') botright copen + if !g:prettier#no_focus_quicklist + " Return the cursor back to the main buffer. + exe l:winnr . 'wincmd w' + endif let s:prettier_quickfix_open = 1 endif endfunction -- cgit v1.3