Search code examples
sublimetext3

Sublime Text: File remains in tab even after deleted


When I delete a file that I don't need anymore, but then I have to close the tab manually. It is irritating.

Every time, I have to delete the file and then close the tab by confirming the discard changes.

Is there a way to delete the file in one shot.

Please Note: This happens in my MacBook laptop.


Solution

  • I am not 100% clear on the details of your question. Apologies if this answer does not match what you are trying to ask.

    Assuming you do not already have the file open this behaviour is a side effect of the choice to preview the file on click.

    If this is the use case you are asking about then there is an answer.

    If you look in Preferences -> Settings - Default and search for preview you should find this:

    // Preview file contents when clicking on a file in the side bar. Double
    // clicking or editing the preview will open the file and assign it a tab.
    "preview_on_click": true,
    

    This means clicking on the file to delete it causes it to be opened for preview and after deleting the file you also need to close the preview tab.

    If you wish to change this behaviour open this file Preferences -> Settings - User and add this line:

    "preview_on_click": false,
    

    Then you should not open a preview and therefore will not need to close it after deleting the file.

    If you already have the file you are deleting open for editing this will not cause the behaviour you are looking for.