Sublime Forum

Project sessions plugin

#1

Wanted to share this simple plugin with those who wants it.
Saves me lots of frustration when switching between projects.

You can download and read more about what it does here: https://bitbucket.org/fuglesang/sublimetext-project-sessions/

A summary:

Hope people who wants this feature find it as useful as I do. :smile:

0 Likes

Virtual sessions
#2

NICE! That sounds like it will do just fine. Even something barebones like you’ve made is 100x better than nothing.

The only thing I see it missing is some way to open a temp session.

For instance, say you have a project open with a bunch of files and you get sidetracked. You need to work on a few other unrelated files, but you don’t care about the session. You don’t need it saved, it doesn’t have a project file, etc. It would be great if there was someway to open a temp session that closes and saves the current session / project and allows you to work on a clean slate. When you’re done, switching back to the original (or another) session would just close the files and not save the session and everything else.

Although it’s handy for switching between projects, I think my main desire for the feature was because I often need to edit a few files unrelated to the project and I just need a quick, temporary clean slate to work on.

Either way thanks a bunch for this. I’ll play around with it a bit later.

0 Likes

#3

If you think of having no project open as a “temp” session, you can already do what you want.

When you have a project open and then go to Project > Close project from the menu, the session for the project will be saved and you get your “temp” session (no project, session doesn’t get saved). Once you’re done and want to go back to your project, you can open it and your project session will be restored (though you have to manually close your files from the temp session).

I’m gonna add some configuration options for the open/close behavior so people can make it behave like they want.

When I get the time I was planing on making “task” sessions as shown here: https://forum.sublimetext.com/t/group-files-as-task-sets/914/1

I’m glad it came to use for you. Your post was actually what made me man up, learn python and fix this annoyance. :smiley:

0 Likes

#4

Ah good point. Been a bit since I’ve actually gone into that menu I forgot.

0 Likes

#5

Very good idea!

But this plugin don’t work with projects opened as directory?

0 Likes

#6

No it doesn’t. I had actually forgotten that folders can act as projects in sublime. I’ll take a look and see what I can do with that.

EDIT: I made a fast fix for this. Another small thing I didn’t think about is that you can’t have two projects with the same name (it will use the same session file). And here I thought this was gonna be a small project. :stuck_out_tongue:

0 Likes

#7

Hm, I try updated plugin, but this still don’t work as expected with directory projects :frowning:

0 Likes

#8

Bah, ok. Does it work for you when using .sublime-project files? Which operating system do you use?

0 Likes

#9

After implementing of ability to open directory as project I use only this type of projects. I didn’t try this plugin with .sublime-project files, sorry.
Windows 7 32bit.

0 Likes

#10

Updated the plugin.

Hopefully fixes the problem with directories as projects (works for me on winXP).
Added messages that displays in the status bar (on errors).
Made some behaviors customizable.
Fixed minor bugs.

0 Likes

#11

fuglesang,
Now it’s works for me! It’s very useful, thanks!

But It has problem with session naming in some case :wink: For example, 95% of my directory (projects) has same name “site”. And this directory placed in directory with true name of the project. Like “Project-1\site”, “Project-2\site”, “MySite\site” etc. But session name has last folder name: “site”, “site”, “site” etc :smile:

0 Likes

#12

Hehe, yes. I still have to change it up to support projects with the same name. Will probably get it done sometime this week.

0 Likes

#13

Hi fuglesang,

Just wanted to say that this is a fantastic plugin, resolving one of the few weaknesses in SublimeText. Thanks!

Cheers,

Josh

0 Likes

#14

Thank you for this plugin.
I knew I was missing it - but I didn’t knew how much. For me it is one of the essential plugins.

0 Likes

#15

Just want to report something:

Situation: You have your current window with all the view, then open a new window with no view, close the first window then the second.

Reopen Sublime will restore the second window only, loosing all the views existing in the first window.

I think Session should include all windows of a Sublime instance also.

0 Likes

#16

Small update: Made it so the session files are opened based on the path to the .sublime-project file or the directory opened as a project. This resolves the issue with having more projects (or directories) with the same name. Though now you can’t move your project around without having to remake the session. Also the old sessions are invalidated and have to me remade.

@jbjornson, tgkeul
I’m glad you like it. ^^

@Esente
I tried to see if there was anyway I could implement support for this, but I can’t find anything that can help me. Doesn’t seem like this can happen automatically though I will see a bit more if I can come up with a solution. If you have any ideas on how this could be implemented, please tell. :smile:

0 Likes

#17

From the API, I think you can detect all opening windows from Sublime, so I think you could save that info into Session. Next time Sublime is loaded, there is command to open a new window. We could create tabs from that new window based on the info from the Session, no?

0 Likes

#18

not coding much lately… but this is a great plugin!

0 Likes