Go to file
2014-08-30 17:11:14 +02:00
scripts Make the default program running list even more conservative 2014-08-30 00:15:15 +02:00
strategies Change plugin name and all the variables 2014-08-29 18:59:14 +02:00
video Update screencast image in the readme 2014-08-30 10:51:59 +02:00
CHANGELOG.md v1.0.0 2014-08-30 11:18:26 +02: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 Fix a link to tpope/vim-obsession 2014-08-30 17:11:14 +02:00
resurrect.tmux Change plugin name and all the variables 2014-08-29 18:59:14 +02:00

Tmux Resurrect

Restore tmux environment after a 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 sessions!

Screencast

screencast screenshot

Key bindings

  • prefix + Alt-s - save
  • prefix + Alt-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
  • active and alternative session
  • active and alternative window for each session
  • windows with focus
  • active pane for each window
  • programs running within a pane! More details in the configuration section.
  • restoring vim sessions (optional). More details in restoring vim sessions.

Requirements / dependencies: tmux 1.9 or higher, pgrep

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

set -g @tpm_plugins "           \
  tmux-plugins/tpm              \
  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:

# type this in terminal
$ tmux source-file ~/.tmux.conf

You should now be able to use the plugin.

Configuration

Configuration is not required, but it enables extra features.

Only a conservative list of programs is restored by default:
vi vim emacs man less more tail top htop irssi. Open a GitHub issue if you think some other program should be on the default list.

  • Restore additional programs with the setting in .tmux.conf:

      set -g @resurrect-processes 'ssh psql mysql sqlite3'
    
  • Programs with arguments should be double quoted:

      set -g @resurrect-processes 'some_program "git log"'
    
  • Start with tilde to restore a program whose process contains target name:

      set -g @resurrect-processes 'irb pry "~rails server" "~rails console"'
    
  • Don't restore any programs:

      set -g @resurrect-processes 'false'
    
  • Restore all programs (be careful with this!):

      set -g @resurrect-processes ':all:'
    

Restoring vim sessions

  • save vim sessions. I recommend tpope/vim-obsession.

  • in .tmux.conf:

      set -g @resurrect-strategy-vim "session"
    

tmux-resurrect will now restore vim sessions if Sessions.vim file is present.

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.

Other

Here's another script that tries to solve the same problem: link. It even has the same name, even though I discovered it only after pushing v1.0 of this plugin.

License

MIT