question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Weird behavior of `autocmd BufEnter * call ncm2#enable_for_buffer()` after updating plugin

See original GitHub issue

OS

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:

screen shot 2018-08-02 at 1 19 09 pm

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

screen shot 2018-08-02 at 1 19 31 pm

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

screen shot 2018-08-02 at 1 23 11 pm screen shot 2018-08-02 at 1 23 43 pm

I have to hit a random key to get this:

screen shot 2018-08-02 at 1 24 06 pm

screen shot 2018-08-02 at 1 23 32 pm

Remove autocmd BufEnter * call ncm2#enable_for_buffer() results with no weird errors.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
clasoncommented, Aug 2, 2018

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 ag or fzf) from https://github.com/ncm2/ncm2/issues/39#issuecomment-409692887: Replace BufEnter with InsertEnter in your init.vim (which seems like a reasonable default configuration, by the way, since you don’t need autocomplete before you start typing).

0reactions
huyvohcmccommented, Aug 2, 2018

@roxma Yes it is, thanks so much.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found