timbrel/GitSavvy

Feature: Prevent `INLINE` tabs sticking

Opened this issue · 5 comments

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?

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. 😀

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.

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

Not sure, but doesn't on_deactivated trigger just by opening the Command Palette. Basically when on the INLINE diff, it would close just by ctrrl+shit+p. Other than that it looks useful for the INLINE views.

I don't see it fit the e.g. "FILE" case as it is natural to have a "live" version of a file and its historical variant ("FILE: ") side by side for comparison, and to switch between them.

on_deactivated seemed to work fine, upon losing focus the tab will get closed.

It doesn't work for all views, as some pop up some UI's which then cause the tab to close.