Comments (8)
Any chance this is similarly simple to do for zsh?
from tmux-resurrect.
Hi, thanks for the suggestion, this would be an interesting feature.
Yes, tmux send-keys
can do this, but I see a few downsides:
- all panes would get "dirty" on each save and each restore. What this means is: a user would see the
history -w foo_file
andhistory -r foo_file
commands as if they were "typed" in the console. - as you mentioned, save would not be possible when another program is running in a pane
- when saving, the
history -w foo_file
should not be run if a program (ie vim) is running in the pane.send-keys
can mess the programs' current state.
from tmux-resurrect.
Yes, I understand some people might find such feature intrusive or surprising. It should likely by flag-gated, so whoever enables the flag knows what he's doing.
Restricting save to panes not running any program could work based on #{pane_current_format}
value, which is already extracted from tmux. If user really needs to save "running" pane history, he can pause running program himself with Ctrl-z.
As for "dirtying" user state - I did some research and I think impact can be minimized:
- when issuing
history -w
command, it should be prefixed by space. With Bash's default HISTCONTROL setting, space-prefixed commands are not saved to history. history -r
is never saved to history, as it "overwrites itself". If combined with clear (history -r foo_file && clear
), it is never even seen by user, and newly started shell looks clean.
As you can see, the only annoyance is visible history write, and the history itself is never clobbered.
The use case for such feature is as follows. I usually have a few panes open: one for editing, one for build/unit testing, others for deployment. If I need to restart machine, the most annoying part is to recall all the commands. Having tmux-resurrect restore windows & working dirs is great, but having history would make it perfect!
from tmux-resurrect.
Flag-gating this makes sense.
Ok, you got me convinced. If you can make this feature work (and it doesn't majorly screw up other things) submit a pull request and we'll "polish" the feature together and merge it.
Saving the history should probably be hooked at the end of this function.
Restoring the history should go before this function.
Don't worry about flag-gating this or making the code nice - we can do that later.
from tmux-resurrect.
I have pushed an implementation to my repo (see rburny@f69b64e)
This does not have flag-gating, but I think it's pretty complete otherwise. Should I open a pull request?
from tmux-resurrect.
Hi, thank you for the work. No need to open a pull request - I'll cherry-pick your commit (you'll still be shown as a committer), test it and do the rest of the work.
from tmux-resurrect.
@rburny, all looks good.
Can you please check pull request #49 and see if you have any comments?
If not, I think that one is ready for merging into master.
from tmux-resurrect.
This was implemented in #49
from tmux-resurrect.
Related Issues (20)
- 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
- plugin not saving correct command
- automatically restore HOT 1
- Does not save, does not restore, returned 127
- restore reports success but does not restore HOT 1
- Activating resurrect breaks config, no plugins get loaded, keybinds get reset
- Binding to different client key tables
- NNN - NO RESTORE OPEN FILE VIM
- resurrect-processes does not play well with `tmux split-window <cmd>` HOT 3
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.