Context doesn't update when switching buffers with fzf.vim
As the video below demonstrates, context doesn't update when switching buffers with fzf.vim. The video also demonstrates some other things:
- Context updates as soon as a scroll action is taken, as expected.
- Context does update if we use
bufferto switch. This is strange, because fzf.vim appears to also usebufferto switch when that's the correct thing to do. - I put
fat the top ofcontext#updateto see if it's being executed, and indeed, you'll notice that the command-line updates even though context does not.
Since it appears to me that context#update is exactly the function that is supposed to be updating context but is somehow not doing so even though it's being called, I'm currently stumped as to what the problem is. Help would be much appreciated.
I had some time to dig in a little more. The problem is at line 112 of context.vim, which declines to update if mode() != n. When the call is made to context#update after fzf.vim selects a buffer, mode() == 't'. I'm not sure precisely why this is, but fzf.vim runs out of a terminal window, so I guess the mode remains t even after the selected buffer has been entered.
Line 114 separately checks that the buffer isn't a terminal, so I don't see any problem with checking that the mode isn't n and isn't t to fix this. I'll submit a PR and let you tell me there if that idea has any unforeseen consequences.