Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress autocmds less aggressively #61

Merged
merged 1 commit into from
May 5, 2016
Merged

Suppress autocmds less aggressively #61

merged 1 commit into from
May 5, 2016

Conversation

wincent
Copy link
Contributor

@wincent wincent commented May 5, 2016

I noticed that my statusline doesn't update properly when using undotree to move between revisions of a file (wincent/wincent#16). I established that this was because it was using 'eventignore' to suppress all autocmds, which in turn prevents the statusline from updating.

Commenting out the set eventignore=all line makes the failure to update go away, at the cost of firing more autocmds.

I considered adding an option for opting out of this behavior (eg. let g:Undotree_Eventignore=0 or something), or rearchitecting my statusline to use an approach like vim-airline does based on CursorMoved autocmds (see vim-airline/vim-airline#82; see also https://github.com/vim-airline/vim-airline/blob/30f078daf569e7d5e4f7829e39316387af349b41/plugin/airline.vim#L36-L50 for current implementation), but then realized that a simpler fix is to have undotree just disable only the autocmds that it uses instead of disabling all of them.

This is probably not enough to unbreak every bit of code in the world that depends on those autocmds, but it does at least unbreak my use case, because it allows my WinLeave autocmd to run and update the statusline.

I noticed that my statusline doesn't update properly when using undotree to move
between revisions of a file (wincent/wincent#16). I
established that this was because it was using `'eventignore'` to suppress all
autocmds, which in turn prevents the statusline from updating.

Commenting out the `set eventignore=all` line makes the failure to update go
away, at the cost of firing more autocmds.

I considered adding an option for opting out of this behavior (eg. `let
g:Undotree_Eventignore=0` or something), or rearchitecting my statusline to use
an approach like vim-airline does based on CursorMoved autocmds (see
vim-airline/vim-airline#82; see also
https://github.com/vim-airline/vim-airline/blob/30f078daf569e7d5e4f7829e39316387af349b41/plugin/airline.vim#L36-L50
for current implementation), but then realized that a simpler fix is to have
undotree just disable only the autocmds that it uses instead of disabling all of
them.

This is probably not enough to unbreak every bit of code in the world that
depends on those autocmds, but it does at least unbreak my use case, because it
allows my `WinLeave` autocmd to run and update the statusline.
@mbbill
Copy link
Owner

mbbill commented May 5, 2016

Looks good, thanks for the patch!

@mbbill mbbill merged commit 80b38e6 into mbbill:master May 5, 2016
@wincent
Copy link
Contributor Author

wincent commented May 5, 2016

Thanks for the fast response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants