← Back to Upcase

Closing Fugitive diff buffers

I’m new to upcase. I joined specifically to become more proficient with Vim. I’m coming from an (pretty much exclusive) emacs background.

Anyway, after finishing the Vim course, I noticed a Vim segment in the git course, so I checked it out. There, I learned about the fugitive plugin. I’ve been using fugitive to stay out of the command line for my git needs while using Vim. However, something has been very annoying with fugitive and that is the diff buffers. While I’m inside the status buffer, I select D to check out my diff. After applying my commit the diff buffers remain. I end up having to close out both diff buffers manually, fugitive is not closing them out after :Gwrite.

Am I missing something with closing the diff buffers? Is this the way it is with fugitive? Is there a better workflow I’m missing here?

Thanks for any direction!

Matt

I’ve been playing around a little bit, and while I haven’t used fugitive too much, I noticed in the github there were some issues surrounding this very thing going back to 2011.

Steps I took:

  1. vim app/models/user.rb
  2. :Gdiff

I opted to now to do a partial commit. So, I went into figuring out how to close.

Obviously, :q works on it quite well.

Option 2:
windo diffoff then <C-w><C-o> if you have you started with splits, this is bad. For single file, it works great.

Option 3:
diffoff then :q – less than optimal, but we could map this to our own command easily enough.

Long story short, I’ve found about 30 different solutions to the same problem. But they’re all ‘hacks’ to make fugitive behave when doing diffs. I’ll personally probably continue to do all my cherry picking and git from the shell instead of within vim itself.

Thanks for the reply. Okay, I’m not alone :slight_smile: I did find that issue on github, noticed it was quite old. I had a glimmer of hope some movement had happened. It’s not a big deal, !git diff still works well and doesn’t leave a mess.