Comments (14)
I'd like to request that this be re-opened.
This issue does fit with my workflow, but despite my own workflow, the main reason I think this should be provided is programmability. I didn't expect tmux-ressurect
to support my exact workflow. Instead I'd hoped there is some api to save and restore a particular session by name so that I could use my own config and keybindings to set it up.
My Workflow (if it helps)
I use a session per project. I might be working on projects A
, B
and C
but I won't get to A
or C
for another few weeks and I'm just using B
for now. What happens now is that I have to save it when all 3 sessions are running. If I want to close A
and C
and keep working with B
and then store B
again, I can't do that since A
and C
would be lost.
I use tmux on my laptop and not a server which is why I'd much rather close A
and C
than leave them running.
Ping @bruno-
from tmux-resurrect.
+1
from tmux-resurrect.
Interesting idea. Is there something in your workflow that makes you want to restore session one by one, instead of just restoring them all together?
I have one main project (aka work ^^) and a lot of on going side projects. By starting only what I need, I have less clutter in the Tmux session list. This makes switching between sessions easier, because the list is shorter and only filled with "active" stuff. I only restart my PC once a week, so my Tmux server runs pretty long. Another point is the amount of running (not used) processes like unit tests which watch for changes of files or something similar.
I don't have the necessity for this in my own workflow but I'll give it a thought.
Can you explain your workflow, please? I would appreciate some new thoughts on this topic 😄
from tmux-resurrect.
In my workflow, I open a new session for a project. After finish a project, I close its session, while some day I want to reopen that project in a new session. In this situation, save and restore only a specific session is useful.
from tmux-resurrect.
@bruno- could this be reopened? I find that it's not cheap to have all sessions on RAM. For example I work on different projects with different dependencies, multiples instances of neovim (with language servers, which are not cheap)... It will be useful to be able to save/restore a single session only.
from tmux-resurrect.
Hi, thanks for sharing the idea.
At the next morning you can spawn your saved sessions one after the other when you need them.
Interesting idea. Is there something in your workflow that makes you want to restore session one by one, instead of just restoring them all together?
I don't have the necessity for this in my own workflow but I'll give it a thought.
from tmux-resurrect.
Okay that makes sense. You don't want to restore "helper" sessions that make noise in the list and make switching sessions harder and slower.
Perfectly reasonable, and in fact I had the same problem until I made tmux-sessionist - specifically the prefix + g
binding that has the goal to speed up session switching. (btw. g is a mnemonic for "goto session")
With it, if you want to switch to work
session, you just type: prefix + g
w<Enter>
and you are there. Notice, only the first letter of the session name is typed - the rest is "auto-completed" presuming you have only one session starting with the letter "w".
You don't have to look and visually "parse" the session list, then type j/k to select it (this is ultra slow btw). You just think of a session name you need, type 1 or 2 first letters and bang, you're there.
This is the principle I learned in the vim community and it's called "tell don't parse" (or something similar). To achieve the speed, the goal is to "tell" the tool what you want to do, instead of visually parsing/reading options available to you and then choosing.
So, as a result of that thinking, I don't really worry about the session list or it's size. Currently I have ~25 sessions. Some of them are not used for a couple days and that's completely fine since they don't come into way.
Since you asked about the workflow, another thing I'd say I don't do in tmux is "garbage collection". Tmux makes everything cheap. Panes, windows, sessions - they all come at no cost or penalty to create, own and just have around, even if you don't use it.
Noone should worry about maintaining the state of tmux windows or sessions. They are all cheap, so why bother and waste time.
So, if you do some experimentation and create a couple new windows or a session - that's fine. No need to feel obliged to "clean up" after you did that. And who knows, you might even need it later.
With the "tell don't parse", "garbage collection" and "everything is cheap" thoughts out, the decision about "which session to restore" becomes easier - I think. For me, it's: I don't want to bother or think - I just want everything as it was. It's all cheap anyway.
So there you go - does that give you some ideas? Let me know!
from tmux-resurrect.
Perfectly reasonable, and in fact I had the same problem until I made tmux-sessionist - specifically the prefix + g binding that has the goal to speed up session switching.
Great 👍 This solves the switching problem for me I think. Especially "jump to last session" key binding is great time saver!
This is the principle I learned in the vim community and it's called "tell don't parse" (or something similar). To achieve the speed, the goal is to "tell" the tool what you want to do, instead of visually parsing/reading options available to you and then choosing.
I'm using vim for years now but didn't see this principle so clearly descriped, thank :)
Panes, windows, sessions - they all come at no cost or penalty to create, own and just have around, even if you don't use it.
I think you talking about this sentence of my last post:
Another point is the amount of running (not used) processes like unit tests which watch for changes of files or something similar.
I meant the process running inside a pane can be a problem. But I setup tmux-ressurect and tmux-sessionlist and test how it affects the overall performance.
So, thanks for the great discussion ;)
from tmux-resurrect.
Closing this discussion as it's been a while and it seems it didn't generate additional interest from other users.
If anyone has anything to add to this, please feel free to reopen.
from tmux-resurrect.
Thanks for the interesting discussion. I'd like to add that with my workflow, being able to restore specific sessions would still be useful. I have half a dozen projects that I'm working on at a given time, and each one might have it's own dependencies of background running processes that may not be cheap to run. Frequently I have separated django preview server processes, redis, postgres, and nginx containers for each project. Currently, when I cd into the project directory, the docker containers for that respective project will run. If I cd into another project, it will have it's own dependencies run. For simplicity, I always run postgres, redis, the debug server etc. on the default ports. I realize I could leave the containers running for all my projects simultaneously if I just use different ports for each project. It would get messy pretty quickly to manage ports not clashing.
Ideally, if I could activate a session for a project, then I would only run the containers I need and without any worry of collision.
With the prevalence of docker these days, I feel my workflow is not uncommon among web developers.
Thanks for the great project!
from tmux-resurrect.
I'd definitly use that. I tend to create a whole session per ticket, with a lot of different "tabs" for different tasks, themselves splited most of the time in different windows. There are sessions that I'd like to be save on disk, but not loaded in RAM. Just so I could go back to it when I want to. I guess it doesn't take that much memory though.
Would be also very cool if it was in the exact same state that I left it. :D
from tmux-resurrect.
+1, it would be great.
Thanks for your work
from tmux-resurrect.
I think someone should step up and take the lead on this feature.
Frankly, I don't see it added to this repo. I think it should be developed as another plugin or a fork of this plugin.
from tmux-resurrect.
I've made a quick set of functions in my .zshrc
:
tmux_sessions_path="/home/<user>/.tmux/resurrect"
tmux_resurrect_scripts="/home/<user>/.tmux-resurrect/scripts"
tmux_save() {
cp -P $tmux_sessions_path/last $tmux_sessions_path/last_copy
$tmux_resurrect_scripts/save.sh
cp $tmux_sessions_path/last $tmux_sessions_path/$1.txt
mv $tmux_sessions_path/last_copy $tmux_sessions_path/last
}
tmux_load() {
cp -P $tmux_sessions_path/last $tmux_sessions_path/last_copy
ln -sf $tmux_sessions_path/$1.txt $tmux_sessions_path/last
$tmux_resurrect_scripts/restore.sh
mv $tmux_sessions_path/last_copy $tmux_sessions_path/last
}
To use this:
- save all sessons (ctrl + b => ctrl + s)
- close all sessions not related to projecta =>
tmux_save myprojecta
- reload all sessions (ctrl + b => ctrl + r)
- close all sessions not related to project b =>
tmux_save myprojectb
- repeat for each project
- then you can
tmux_load myprojecta
Notes:
- If you load multiple project it won't close other session but this seems a feature to me.
- This functions needs to be run in tmux, otherwise it will crash.
- I've made this quickly but it seems to work. If someone want to wrap this nicely somewhere, feel free.
Edit:
If you save more than one session it will fail to restore. Solution, save multiple individual session
Edit 2:
Seems that https://github.com/tmuxinator/tmuxinator make what I wanted to achieve.
from tmux-resurrect.
Related Issues (20)
- Ressurect only named sessions
- .tmux/resurrect directory not created HOT 1
- Restores wrong PWD when it's a symbolic link HOT 1
- resurrect files not saving expected data
- Save env variables as well
- Restoring non-existing directories
- Save problems
- Tests failing on clean checkout from master. HOT 1
- Description in document save_dir.md is not complete
- Problem recreate windows
- How to start tmux server with resurrect
- resurrect creates minimal sized horizontal splits
- Resurrect not saving the tmux session as intended HOT 2
- C-b C-r to restore session will end up with [exited] from tmux client on iSH(iOS alpinelinux)
- Login shell not invoked for zsh
- [Question] Create new sessions/windows/layouts using a file - supported?
- [BUG] saving with nvim opens the incorrect files if you have spaces in filenames
- How to upgrade from 3.0 and keep saved sessions ?
- [Bug] Restoring sessions is adding a new empty prompts everytime
- [BUG] Hooks pre-restore-all and post-restore-all don't work correctly with tmux v3.4 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tmux-resurrect.