22

I'm a tmux user and a fan of tmuxinator because it lets me get back to a baseline tmux session setup with ease.

However, I find that my setup changes on a regular basis, and editing my tmuxinator setup by hand can become tedious.

Is there a way to effectively tmuxinator save-session, such that my current tmux session gets saved into a tmuxinator project of choice with the panes, windows, and other details of the session automatically stored?

user456584
  • 86,427
  • 15
  • 75
  • 107
  • Similar question on SU for reference: http://superuser.com/questions/440015/restore-tmux-session-after-reboot – user456584 Oct 21 '13 at 18:04

3 Answers3

14

Here's a tmux plugin I wrote that enables you to save and completely restore tmux sessions/environments:

https://github.com/tmux-plugins/tmux-resurrect

  • 1
    tmux-ressurect and tmux-continum are both great, but I cannot figure out how to restore the command on each window. Is this possible? – CESCO Mar 10 '16 at 22:14
  • OP here. tmux-resurrect is my current preferred solution to this problem. The other tmux-plugins are cool too! – user456584 Apr 13 '17 at 01:30
  • The proposed plug-in is very limited as it cannot create tmuxinator files as OP asked for plausibly. – Siavoshkc Aug 12 '22 at 00:54
11

I've been trying to figure out how to save sessions. One solution I am looking at can be found here:

Custom Scripts for saving Tmux sessions...

This link provides scripts that the author wrote for saving sessions at regular intervals, and saving a series of backups of those sessions.

I haven't personally tried the scripts myself, but they seem to be a potential issue for this situation.

(As for myself: I'm a little surprised that Tmux doesn't provide something like this as a built-in feature. With Screen I can understand: the code base is so messy, it's difficult to add anything new...)

alpheus
  • 317
  • 3
  • 3
0

Steps:

  1. Clone the tmux-resurrect repository: Clone the tmux-resurrect repository to your local machine using git. Run the following command to clone the repository into the ~/.tmux/plugins directory:

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

  2. Configure Tmux to use the plugin: Add the following line to your ~/.tmux.conf file to enable the tmux-resurrect plugin:

    run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux

  3. Reload the Tmux configuration: Reload the Tmux configuration file by running the following command in the terminal:

    tmux source-file ~/.tmux.conf

  4. Prefix (ctl+b) +
    ctl+s to save and ctl+r to restore

Monir
  • 1,402
  • 14
  • 16