Weird behavior of `autocmd BufEnter * call ncm2#enable_for_buffer()` after updating plugin
See original GitHub issueOS
MacOS 10.13.4
neovim :version output
0.3.1
Minimal vimrc for reproducing the issue
Plug 'roxma/nvim-yarp'
Plug 'ncm2/ncm2-tagprefix'
Plug 'scrooloose/nerdtree'
autocmd BufEnter * call ncm2#enable_for_buffer()
reproduce the issue
With the recently commits of ncm2, it seems like autocmd BufEnter * call ncm2#enable_for_buffer() cause some quirks in vim quickfix: whenever I open fzf, ag or perform :PlugUpdate, vim window doesn’t show the result until I hit some keys to get it to update:

the status will display updating... forever, when I hit j or k it gets updated like this:

The same happen for ag and fzf window, they all show blank window:

I have to hit a random key to get this:

Remove autocmd BufEnter * call ncm2#enable_for_buffer() results with no weird errors.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Behaviour of BufEnter - Vi and Vim Stack Exchange
feedkeys are queued for processing, it doesn't have to be applied to the buffer that triggered BufEnter . What really weird here is...
Read more >Remote plugin autocmds don't load initially #5821 - GitHub
Expected behaviour. The autocmd triggers even when no other remote plugin commands or functions have yet been called. Steps to reproduce using ...
Read more >autocmd behaviour not as expected - Super User
I'm on Vim 7.4, 'huge' version, acquired with homebrew. Here are the contents of my .vimrc when I tested the call AutoHighlightToggle() option....
Read more >Vimscript autocmd function fail - Stack Overflow
It seems BufEnter runs before VimEnter. This is a problem since SnipMate puts up its mappings in VimEnter. So the very first buffer...
Read more >autocmd.txt - Vim
Example: :verbose autocmd BufEnter FileExplorer BufEnter * call s:LocalBrowse(expand("<amatch>")) Last set from /usr/share/vim/vim-7.0/plugin/NetrwPlugin.vim ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I get the same behavior also on macOS 10.13.6 and Linux. Bisecting shows that 6f1e1e9ad80a48b6fa67fa565756518ec95e6670 broke this. (Probably some special casing of quickfix-like buffers is required in the python core.)
Workaround (at least for the plugin updating; I don’t use
agorfzf) from https://github.com/ncm2/ncm2/issues/39#issuecomment-409692887: ReplaceBufEnterwithInsertEnterin yourinit.vim(which seems like a reasonable default configuration, by the way, since you don’t need autocomplete before you start typing).@roxma Yes it is, thanks so much.