tmux-plugins / tmux-continuum

Continuous saving of tmux environment. Automatic restore when tmux is started. Automatic tmux start when computer is turned on.
MIT License
3.31k stars 149 forks source link

Empty pane contents get restored #101

Open revolter opened 2 years ago

revolter commented 2 years ago
Screenshot 2021-12-15 at 11 50 01

The tmux_resurrect_20211122T134927.txt contains this:

pane    GitHub > Others 0   :<redacted> 1   :*  0   :/Users/revolt/Development/GitHub/<redacted>    1   zsh :
pane    GitHub > revolter   0   :<redacted> 0   :   0   :/Users/revolt/Development/GitHub/revolter/<redacted>   1   zsh :
pane    GitHub > revolter   1   :FLEX   0   :   0   :/Users/revolt/Development/GitHub/revolter/FLEX 1   zsh :
pane    GitHub > revolter   1   :FLEX   0   :   1   :/Users/revolt/Development/Local/FLEXTest   0   zsh :
pane    GitHub > revolter   2   :fastlane   0   :   0   :/Users/revolt/Development/GitHub/revolter/fastlane 1   zsh :
pane    GitHub > revolter   3   :xcode-install  0   :   0   :/Users/revolt/Development/GitHub/revolter/xcode-install    1   zsh :
pane    GitHub > revolter   4   :iulianonofrei.com  0   :   0   :/Users/revolt/Development/GitHub/revolter/iulianonofrei.com    1   zsh :
pane    GitHub > revolter   5   :Misc   1   :*  0   :/Users/revolt/Development/GitHub/revolter/SubtitlesConverter   1   zsh :
pane    GitHub > revolter   5   :Misc   1   :*  1   :/Users/revolt/Development/GitHub/revolter/SwiftLint    0   zsh :
pane    GitHub > revolter   5   :Misc   1   :*  2   :/Users/revolt/Development/GitHub/TokamakUI/Tokamak 0   zsh :
pane    GitHub > revolter   6   :<redacted> 0   :-  0   :/Users/revolt/Development/GitHub/<redacted>    1   zsh :
pane    GitHub > revolter   6   :iulianonofrei.com  0   :-  1   :/Users/revolt/Development/GitHub/revolter/iulianonofrei.com    0   zsh :
pane    GitLab > <redacted> 0   :<redacted> 0   :   0   :/Users/revolt/Development/GitLab/<redacted>    1   zsh :
pane    GitLab > <redacted> 1   :<redacted> 1   :*  0   :/Users/revolt/Development/GitLab/<redacted>    1   zsh :
pane    GitLab > <redacted> 2   :<redacted> 0   :-  0   :/Users/revolt/Development/GitLab/<redacted>    1   zsh :
pane    GitLab > Others 0   :<redacted> 1   :*  0   :/Users/revolt/Development/GitLab/<redacted>    1   zsh :
pane    GitLab > revolter > Bots    0   :Local  0   :-  0   :/Users/revolt/Development/GitHub/revolter/DexRoBot 0   zsh :
pane    GitLab > revolter > Bots    0   :Local  0   :-  1   :/Users/revolt/Development/GitHub/revolter/FileConvertBot   1   zsh :
pane    GitLab > revolter > Bots    1   :Remote 1   :*  0   :/Users/revolt  1   zsh :
pane    Playground  0   :nvim   1   :*  0   :/Users/revolt/Library/Mobile\ Documents/com~apple~CloudDocs/Videos/<redacted>  0   zsh :
pane    Playground  0   :nvim   1   :*  1   :/Users/revolt  1   nvim    :nvim /Users/revolt/.zshrc
pane    Playground  0   :nvim   1   :*  2   :/Users/revolt/Development/GitHub/robb/Underscore.m 0   zsh :
pane    Playground  0   :nvim   1   :*  3   :/Users/revolt/Downloads    0   zsh :
pane    Playground  1   :Work   0   :-  0   :/Users/revolt/Development/GitHub/revolter/docs 1   zsh :
pane    Playground  1   :Work   0   :-  1   :/Users/revolt/Development/GitHub/revolter/home 0   zsh :
pane    Playground  1   :Work   0   :-  2   :/Users/revolt/Development/GitHub/fastlane/fastlane 0   zsh :
window  GitHub > Others 0   1   :*  b55e,272x61,0,0,1
window  GitHub > revolter   0   0   :   b55f,272x61,0,0,2
window  GitHub > revolter   1   0   :   6e99,272x61,0,0{136x61,0,0,3,135x61,137,0,4}
window  GitHub > revolter   2   0   :   b562,272x61,0,0,5
window  GitHub > revolter   3   0   :   b563,272x61,0,0,6
window  GitHub > revolter   4   0   :   b564,272x61,0,0,7
window  GitHub > revolter   5   1   :*  6e8d,272x61,0,0{136x61,0,0[136x46,0,0,8,136x14,0,47,9],135x61,137,0,10}
window  GitHub > revolter   6   0   :-  9f81,272x61,0,0{136x61,0,0,11,135x61,137,0,12}
window  GitLab > <redacted> 0   0   :   5ae2,272x61,0,0,13
window  GitLab > <redacted> 1   1   :*  5ae3,272x61,0,0,14
window  GitLab > <redacted> 2   0   :-  5ae4,272x61,0,0,15
window  GitLab > Others 0   1   :*  5ae5,272x61,0,0,16
window  GitLab > revolter > Bots    0   0   :-  a39f,272x61,0,0{137x61,0,0,17,134x61,138,0,18}
window  GitLab > revolter > Bots    1   1   :*  5ae8,272x61,0,0,19
window  Playground  0   1   :*  c1d4,272x61,0,0{134x61,0,0[134x30,0,0,20,134x30,0,31,21],137x61,135,0[137x30,135,0,22,137x30,135,31,23]}
window  Playground  1   0   :-  ae1d,272x61,0,0{136x61,0,0,24,135x61,137,0[135x29,137,0,25,135x31,137,30,26]}
state   Playground  GitLab > revolter > Bots
PierrickF commented 2 years ago

Alternative to tmux-continuum's restore feature:

Use tmux-resurrect only and set a bash alias to open tmux and restore the last session at the same time.

.tmux.config

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

As you can see, tmux-continuum is not installed. Make sure to have a saved environment first with prefix ctrl-s before exiting tmux and setting the alias up.

.bash_aliases

# open tmux and automatically restore the last session
alias coding="
tmux new-session\; \
        run-shell ~/.tmux/plugins/tmux-resurrect/scripts/restore.sh \;"

You may put this in either .bashrc or .bash_aliases (recommended). You can check where the restore.sh file is by pasting tmux list-keys | grep 'prefix\s*C\-r' in your terminal.