blueyed / vim-diminactive

Vim plugin to dim inactive windows
336 stars 12 forks source link

fugitive's Gdiff keeps the current version's window dimmed, when ending the diff process (fugitive issue) #4

Closed futile closed 9 years ago

futile commented 10 years ago

I don't know if this is a problem with fugitive or vim-diminactive, but here is how to reproduce the problem:

  1. Open a file which is under git version control
  2. If the file is currently unsaved, make some changes to it
  3. Run :Gdiff (requires fugitive)
  4. Close the split with the indexed version, leaving only the current version
  5. Now this split is inactive, even though it is the only split. DimInactiveOff does not make the window active again.

I think step 2 is optional. I actually had to close and reopen vim to get to a non-dimmed version of my file again.

blueyed commented 10 years ago

Confirmed. This is caused, because somehow no autocommand is triggered when going back to the current version. I have reported it in https://github.com/tpope/vim-fugitive/issues/421 - maybe you can help there to fix this?

To work around this, you can use :DimInactiveRefresh. With the latest changes to restore custom &colorcolumn settings this might fail, but then :set colorcolumn= usually should work.

Apart from that, I am using :Gdiff very often, but am not affected: I use the following to keep the cursor in the current version's window: https://github.com/tpope/vim-fugitive/pull/429 and a custom mapping to toggle the diff, which might be involved in the workaround also: https://github.com/blueyed/dotfiles/blob/d2f75a3c847d57885bed8f477fb6a65db27da542/vimrc#L1705-L1736

futile commented 10 years ago

I thought I had tried :DimInactiveRefresh earlier and it didn't work, but now it does, so that is a good quickfix.

I reported the missing WinEnter/BufEnter events in fugitive issue 421. Your custom mapping seems to do a diffoff before closing the window, which then to correctly trigger the *Enter events. That might be why your mapping does not prevent the events.

blueyed commented 9 years ago

This should be fixed in the meantime.

blueyed commented 9 years ago

Re-opening: this is a bug in fugitive: https://github.com/tpope/vim-fugitive/issues/421 (PR is pending)

blueyed commented 9 years ago

btw: diff windows are excluded since a while from getting dimmed already - added shortly after you've created this issue (11e4d8b).

blueyed commented 9 years ago

Should be fixed in fugitive now, via https://github.com/tpope/vim-fugitive/commit/e065e4f841f4a033ac9a6156573a446007617b1d.