Hi,
On Tue, Aug 22, 2017 at 2:22 AM, FocusedWolf <[email protected]> wrote:
> The following auto-command is giving me much grief:
>
> augroup Open_QuickFix_On_Every_Tab
> au!
> autocmd TabEnter * cwindow
> augroup END
>
> The issue exists on Gvim for windows and on Linux. Untested on macvim, but
> later i can test this if relevant.
>
> Attached is a minimal .vimrc to demonstrate the issue (read the top of the
> .vimrc for bug-recreation instructions). Also attached is a set of text
> files which can be used to demonstrate the issue but you can use any
> directory with multiple text files which you have viewing privileges for.
>
> Summary of the issue:
>
> You will be executing a ":GrepFiles" command (defined in the .vimrc) which
> will run vimgrep on the test files and when you hold down the arrow keys
> (which will be mapped to cycle through the QuickFix-window-vimgrep search
> results) that the TabEnter autocommand will get triggered everytime a search
> result gets opened in a new tab.
>
>
> The :cwindow command that gets executed during the TabEnter event will
> strangely open an additional window on every tab, in addition to the
> QuickFix window. This oddly created window seems to like displaying the
> previous-tabs-buffer.
>
When a new tab is created, the TabEnter autocmd is executed after creating
a new window. It is not expected that the autocmd will change the current
window. As the ":cwindow" command creates a new window (quickfix) and
changes the current window, you are seeing the above problem.
You can fix this problem, by using the following function:
function! s:OpenQfWindow()
cwindow
if &buftype == 'quickfix'
wincmd p
endif
endfunction
augroup Open_QuickFix_On_Every_Tab
au!
autocmd TabEnter * call s:OpenQfWindow()
augroup END
- Yegappan
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.