165

How do you remove a project from Sublime Text 2 and 3's project windows (Ctrl+Alt+P) ?

Delete has no effect, there is no contextual menu, and deleting the associated files *.sublime-project and *.sublime-workspace doesn't remove the project from the list either.

Any idea? Because this window begins to be cluttered...

Valjas
  • 4,994
  • 1
  • 21
  • 32
Anto
  • 6,806
  • 8
  • 43
  • 65
  • 1
    For users using Sublime Text 4, you can delete the project config file and navigate the menu to `Project > Open Recent > Remove Deleted`, to remove deleted projects. – unifreak Jan 21 '23 at 07:17

6 Answers6

348

It would be nice if Sublime Text removed projects you've deleted from the recent projects list. Unfortunately, it does not and the list can become littered with projects that no longer exist.

Until Sublime Text offers this feature there are a couple of manual ways you can remove projects.

Option 1: The quick way (Clear All):

If you're just looking for the fastest way to clean up your list this option is for you.

Please be aware that this will clear out all projects in the recent list. This includes ones you have not deleted.

In the Sublime Text menu goto:

Project > Open Recent > Clear Items

enter image description here

Option 2: The manual way (but with control of which projects are removed):

  1. Close Sublime Text
  2. Locate the Session.sublime_session file using the paths below and open it with another code editor. * DO NOT open it with Sublime Text as any changes you make will be overwritten. *

    Paths to Session.sublime_session file listed by OS and ST version:

    Windows x64:

    Sublime Text 2

    C:\Users\[Username]\AppData\Roaming\Sublime Text 2\Settings\Session.sublime_session

    Sublime Text 3

    C:\Program Files\Sublime Text 3\Data\Local\Session.sublime_session

    Mac OSX:

    Sublime Text 2

    ~/Library/Application Support/Sublime Text 2/Settings/Session.sublime_session

    Sublime Text 3

    ~/Library/Application Support/Sublime Text 3/Local/Session.sublime_session

    Linux (Ubuntu):

    Sublime Text 2

    ~/.config/sublime-text-2/Settings/Session.sublime_session

    Sublime Text 3

    ~/.config/sublime-text-3/Local/Session.sublime_session

    What to expect to see:

    You should see something like the following at the bottom of this file:

    enter image description here

  3. Remove the unwanted project(s) from this file

    What the file would look like after deleting project3:

    enter image description here

  4. Save and re-launch Sublime Text 2/3

Option 3: The plugin way

You can check out the Sublime Text plugin Project Manager.

Option 4: The Node.js way

You can check out: clean-sublime-text-project-history

Valjas
  • 4,994
  • 1
  • 21
  • 32
  • Weird; this window is actually a view on *recent* projects ?! Because when I tried it "the quick way", it completely cleared the window. Anyway, thanks for the anwser, I voted up the feature request ! – Anto Aug 01 '12 at 08:39
  • Yeah, it is a bit odd for sure the tie in and the behavior overall. I was slightly puzzled the first time I did it too. – Valjas Aug 01 '12 at 14:59
  • 3
    ST3 -> c:\Program Files\Sublime Text 3\Data\Local\Session.sublime_session – psycho brm Aug 29 '13 at 22:23
  • You can't seem to do this from within Sublime. You need to use another editor as when Sublime is open, this data is kept in memory and dumped into the file when you close it (so it overwrites your changes). Be sure to write valid JSON (hard in e.g. Notepad) as the file gets completely cleared otherwise! – smhg Sep 08 '13 at 09:55
  • 8
    For ST3 / Windows / Build 3047 I am seeing the session info in C:\Users\{user}\AppData\Roaming\Sublime Text 3\Local\Session.sublime_session – phirschybar Oct 20 '13 at 11:10
  • 9
    For ST3 / Linux (Ubuntu) / Build 3047 session info file is stored in ~/.config/sublime-text-3/Local/Session.sublime_session – ezpn Nov 05 '13 at 10:27
  • Editing this file killed my session altogether. – Joseph Leedy Nov 05 '13 at 18:20
  • @Joseph did you edit it with Sublime Text running? If so, you should NOT. – Valjas Nov 06 '13 at 01:25
  • No, I used ST3 to edit ST2's file because I did not think that ST3 would touch it. – Joseph Leedy Nov 06 '13 at 14:48
  • I have the problem that when starting Sublime, it always popup a message says "Unable to read project XXX". Option 1 doesn't work on my Windows 7 64bit for Sublime2, option 2 does. – Aidy Feb 17 '15 at 00:57
  • Thanks @СашаЧерных for letting me know. It appears they deleted that feature request and I was unable to find an updated URL or topic related to it. So I've removed the link from my answer. – Valjas Apr 21 '17 at 22:04
40

Just to clarify something in Valjas' solution above.

When he says: "Go to Sublime Preferences folder..." he means: "Go to the USER folder", not the Program folder.


Attention: Use a different editor to modify the "Session.sublime_session" file:

Although obvious for many, it may not be for others:

You HAVE to edit the Session.sublime_session file with a different text editor, and Sublime Text itself has to be closed.

DO NOT use Sublime Text itself, or leave the program running while making the changes.

If you do it'll overwrite your changes when closing the app.


Sublime Text 3:

WINDOWS x64:

C:\Users\[Username]\AppData\Roaming\Sublime Text 3\Local\Session.sublime_session

Linux (Ubuntu):

~/.config/sublime-text-3/Local/Session.sublime_session

Mac OSX/Sierra:

~/Library/Application Support/Sublime Text 3/Local/Session.sublime_session

Portable Installation (It might work for ST2 as well but I haven't tested):

/folder-where-you-have-ST3-installed/Data/Local/Session.sublime_session

--

Sublime Text 2:

WINDOWS x64:

C:\Users\[Username]\AppData\Roaming\Sublime Text 2\Settings\Session.sublime_session

Mac OSX:

~/Library/Application Support/Sublime Text 2/Settings/Session.sublime_session" then find the section "recent_workspaces".

Linux (Ubuntu):

~/.config/sublime-text-2/Settings/Session.sublime_session


Where To Edit The File

Easy, look for the "recent_workspaces" section, it's usually at the bottom of the file.

It should look similar to this:

enter image description here


Credits

  1. ST3 Linux (Ubuntu) / Build 3047 path added from @ezrepotein4's comment.

  2. ST2 Linux (Ubuntu) path added from @0x4a6f4672's comment.

  3. Windows x64 and Mac paths taken from this post.

Community
  • 1
  • 1
Ricardo Zea
  • 10,053
  • 13
  • 76
  • 79
1

Sublime Text 2: To clean up sublime file history, project history, autocomplete history and find/replace history do the following

  1. Close all instances of sublime text 2.
  2. Delete the file Session.sublime-session in Settings directory.
  3. Start up sublime

When you close sublime again and look up the settings directory, it will still have a Session.sublime-session file because sublime re-created it but its size shall be smaller than the one you had earlier cos it doesn't contain any junk data from previous projects history etc.

I hope this shall improve startup times for sublime text 2. You may choose to take a backup of Session.sublime-session to a different folder incase you want to remember the project paths etc. and then copy paste the once you need using a file comparison software. Just remember to close sublime whenever you deal with Session.sublime-session i.e. if you need to make any changes in that file, you'd be making them in some other text editor like notepad++ etc.

Bharat
  • 152
  • 1
  • 9
0

for MacOS High Sierra

you need to modify Session.sublime_session file which can be found with 3 approaches

via terminal

cd ~/Library/Application Support/Sublime Text 3/Local/

via Sublime Text 3

click on the first menu

Sublime Text > Preferences > Browse Packages...

it will open the location in Finder which is

Macintosh HD > Users > username (with home icon) > Library > Application Support > Sublime Text 3 > Packages

move up to one folder up and click on Local folder

from Finder

Macintosh HD >> Users >> username ( with home icon ) > Library ( this will be hidden folder by default, click command + shift + . ) >> Aplication Support > Sublime Text 3 > Local

and edit the file Session.sublime_session in other than the sublime-text editor

 

xkeshav
  • 53,360
  • 44
  • 177
  • 245
0

Alone with run the command next from linux, will be clean the workspace of sublime text:

echo ''>$(locate Session.sublime_session)
Leonardo Pineda
  • 990
  • 8
  • 10
0
  1. Add Package Remove Workspace (still in PR)
  2. Press Ctrl+Alt+R
Smart Manoj
  • 5,230
  • 4
  • 34
  • 59