Go to file
Robin Stern 21de0b35cd Fixed a case where user executes resurrect save while focus is in a tmux session which is part of a session group, and focussed session does not have @resurrect-dir set. Tmux session groups do not share/inherit session options amoung member sessions. The fix is to identify if the focussed session is part of a session group, if yes then iterate over the group to find the first session that has @resurrect-dir, and use that @resurrect-dir value. If the session is not part of a group, then simply try finding if it has a @resurrect-dir set and use that if thats the case. In either case, if @resurrect-dir is not found then default to the default_resurrect_dir value used by tmux-resurrect. 2021-07-08 16:53:19 -07:00
docs Changed helpers.sh and save.sh to allow simultaneously working on and maintaining multiple independent resurrect session files. Should resolve #246, and #389. Description of changes: 1) File helpers.sh: function get_tmux_option() now has an optional 3rd argument that can be used to pass custom option to tmux show-option command. This is used in function resurrect_dir() to pickup session local value of @resurrect-dir instead of using a global @resurrect-dir. Using session local values for @resurrect-dir is needed to maintain and simultaneously work with multiple different resurrect session files. 2) File save.sh: a missing filter has been applied to tmux list-sessions, tmux-listpanes, and tmux-listwindows. The filter does this: at time of saving a resurrect session, it checks if the current (attached) session is in a group. If that is true then the filter passes only sessions/panes/windows that belong to current (attached) group. Thus only current group's sessions/panes/windows are saved. If that is false, then filter passes only current (attached) session's panes and windows. Thus only current (attached) session's panes/windows are saved. Both changes to 1) and 2) together are required to enable working on multiple different resurrect sessions simultaneously, and independently. The effect of maintaining, working on multiple different resurrect sessions simultaneously can be achieved by the user by setting different values for @resurrect-dir. I confirm testing new capability. 2021-07-08 01:01:09 -07:00
lib Update tmux-test 2017-05-30 05:02:58 +02:00
save_command_strategies Change `CPID` to something a little less cryptic 2019-12-17 11:04:45 -05:00
scripts Fixed a case where user executes resurrect save while focus is in a tmux session which is part of a session group, and focussed session does not have @resurrect-dir set. Tmux session groups do not share/inherit session options amoung member sessions. The fix is to identify if the focussed session is part of a session group, if yes then iterate over the group to find the first session that has @resurrect-dir, and use that @resurrect-dir value. If the session is not part of a group, then simply try finding if it has a @resurrect-dir set and use that if thats the case. In either case, if @resurrect-dir is not found then default to the default_resurrect_dir value used by tmux-resurrect. 2021-07-08 16:53:19 -07:00
strategies Don't be too smart when restoring vim session 2020-06-05 09:24:42 +02:00
tests Update tests to save and restore a setup with a zoomed pane. 2018-01-24 22:32:35 +01:00
video Add issue video screenshot 2014-10-07 13:55:23 +02:00
.gitattributes Adding png attributes as binary files so git does not swap the crlf to lf. 2015-10-14 18:06:20 +00:00
.gitignore Run setup task from .travis.yml 2015-02-23 00:46:41 +01:00
.gitmodules Setup 'tmux-test' 2015-02-22 18:41:58 +01:00
.travis.yml Update '.travis.yml' from tmux-test 2017-05-30 05:04:08 +02:00
CHANGELOG.md Changed helpers.sh and save.sh to allow simultaneously working on and maintaining multiple independent resurrect session files. Should resolve #246, and #389. Description of changes: 1) File helpers.sh: function get_tmux_option() now has an optional 3rd argument that can be used to pass custom option to tmux show-option command. This is used in function resurrect_dir() to pickup session local value of @resurrect-dir instead of using a global @resurrect-dir. Using session local values for @resurrect-dir is needed to maintain and simultaneously work with multiple different resurrect session files. 2) File save.sh: a missing filter has been applied to tmux list-sessions, tmux-listpanes, and tmux-listwindows. The filter does this: at time of saving a resurrect session, it checks if the current (attached) session is in a group. If that is true then the filter passes only sessions/panes/windows that belong to current (attached) group. Thus only current group's sessions/panes/windows are saved. If that is false, then filter passes only current (attached) session's panes and windows. Thus only current (attached) session's panes/windows are saved. Both changes to 1) and 2) together are required to enable working on multiple different resurrect sessions simultaneously, and independently. The effect of maintaining, working on multiple different resurrect sessions simultaneously can be achieved by the user by setting different values for @resurrect-dir. I confirm testing new capability. 2021-07-08 01:01:09 -07:00
CONTRIBUTING.md Change plugin name and all the variables 2014-08-29 18:59:14 +02:00
LICENSE.md Initial commit 2014-08-25 21:52:07 +02:00
README.md Add link to how-to restore to a previously saved environment 2021-03-12 13:10:21 +01:00
resurrect.tmux Add mosh-client default strategy 2018-12-28 20:08:46 -05:00
run_tests Do not gitignore 'tmux-test' files 2015-02-22 22:31:57 +01:00

README.md

Tmux Resurrect

Build Status

Restore tmux environment after system restart.

Tmux is great, except when you have to restart the computer. You lose all the running programs, working directories, pane layouts etc. There are helpful management tools out there, but they require initial configuration and continuous updates as your workflow evolves or you start new projects.

tmux-resurrect saves all the little details from your tmux environment so it can be completely restored after a system restart (or when you feel like it). No configuration is required. You should feel like you never quit tmux.

It even (optionally) restores vim and neovim sessions!

Automatic restoring and continuous saving of tmux env is also possible with tmux-continuum plugin.

Screencast

screencast screenshot

Key bindings

  • prefix + Ctrl-s - save
  • prefix + Ctrl-r - restore

About

This plugin goes to great lengths to save and restore all the details from your tmux environment. Here's what's been taken care of:

  • all sessions, windows, panes and their order
  • current working directory for each pane
  • exact pane layouts within windows (even when zoomed)
  • active and alternative session
  • active and alternative window for each session
  • windows with focus
  • active pane for each window
  • "grouped sessions" (useful feature when using tmux with multiple monitors)
  • programs running within a pane! More details in the restoring programs doc.

Optional:

Requirements / dependencies: tmux 1.9 or higher, bash.

Tested and working on Linux, OSX and Cygwin.

tmux-resurrect is idempotent! It will not try to restore panes or windows that already exist.
The single exception to this is when tmux is started with only 1 pane in order to restore previous tmux env. Only in this case will this single pane be overwritten.

Add plugin to the list of TPM plugins in .tmux.conf:

set -g @plugin 'tmux-plugins/tmux-resurrect'

Hit prefix + I to fetch the plugin and source it. You should now be able to use the plugin.

Manual Installation

Clone the repo:

$ git clone https://github.com/tmux-plugins/tmux-resurrect ~/clone/path

Add this line to the bottom of .tmux.conf:

run-shell ~/clone/path/resurrect.tmux

Reload TMUX environment with: $ tmux source-file ~/.tmux.conf. You should now be able to use the plugin.

Docs

Configuration

Optional features

Experimental features (also optional)

Other goodies

  • tmux-copycat - a plugin for regex searches in tmux and fast match selection
  • tmux-yank - enables copying highlighted text to system clipboard
  • tmux-open - a plugin for quickly opening highlighted file or a url
  • tmux-continuum - automatic restoring and continuous saving of tmux env

Reporting bugs and contributing

Both contributing and bug reports are welcome. Please check out contributing guidelines.

Credits

Mislav Marohnić - the idea for the plugin came from his tmux-session script.

License

MIT