timbrel / GitSavvy

Full git and GitHub integration with Sublime Text
MIT License
1.9k stars 137 forks source link

Feature: Prevent `INLINE` tabs sticking #1947

Open IPWright83 opened 2 weeks ago

IPWright83 commented 2 weeks ago

I'm terrible at closing tabs/windows/terminals (pretty much anything!). In GitSavvy I tend to use the inline diff to view and stage changes... but then I have a habit of forgetting to close them. Then they often appear in search results or file navigation and generally get in the way because you can't edit/interact with the code there properly.

I was wondering about adding a "sticky: false" option, then finding a way to make Sublime auto-close when you navigate away from them so they essentially tidy themselves up as they're a little ephemeral compared to other tabs. But I thought before trying to put together a PR?

kaste commented 2 weeks ago

I have dangling views from GitSavvy all over the place. Actually seldomly the INLINE DIFF tabs but the SHOW-COMMIT and FILE tabs and specialized pick-axe, line history graphs. But I don't have a proper solution idea. For the standard DIFF views I have actually code that closes them after committing.

I don't expect the simple "on navigate away" would be satisfactory, but I think you should just try this not as a PR but a simple user plugin/addon. "on navigate away" is in fact Sublime's "on_deactivated" event where you could probably just check for inline views and close them. Try it, tune it and report back. 😀

IPWright83 commented 2 weeks ago

No worries @kaste, I did think about a custom plugin too but thought I'd ask here first in-case it's useful for others. I'll let you know if/when I've something working.

IPWright83 commented 19 hours ago

Still waiting to get into the official Sublime package repository but I created this: https://github.com/IPWright83/sublime-AutoTabClose