Convert Figma logo to code with AI

tmux-plugins logotmux-resurrect

Persists tmux environment across system restarts.

11,268
421
11,268
252

Top Related Projects

Continuous saving of tmux environment. Automatic restore when tmux is started. Automatic tmux start when computer is turned on.

A list of awesome resources for tmux

21,777

🇫🇷 Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❤️

:green_book: Example tmux configuration - screen + vim key-bindings, system stat, cpu load bar.

A pack of various Tmux themes.

Quick Overview

Tmux-resurrect is a plugin for tmux that enables users to save and restore tmux sessions across system restarts. It preserves the state of tmux panes, windows, and even running programs, allowing users to seamlessly continue their work after rebooting their machine or closing tmux.

Pros

  • Saves and restores complex tmux environments with multiple windows and panes
  • Preserves running programs and their state (e.g., vim sessions, ssh connections)
  • Easy to use with simple save and restore commands
  • Customizable with options to include or exclude specific programs

Cons

  • May not work perfectly with all programs or complex environments
  • Requires manual saving before shutting down or closing tmux
  • Can potentially slow down tmux startup if restoring large sessions
  • Limited to tmux-specific functionality, not a system-wide solution

Getting Started

  1. Install tmux plugin manager (TPM) if not already installed:
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
  1. Add the following to your ~/.tmux.conf:
set -g @plugin 'tmux-plugins/tpm'
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'
  1. Reload tmux configuration:
tmux source ~/.tmux.conf
  1. Install the plugin by pressing prefix + I (capital i) in a tmux session.

  2. Use the following commands in tmux:

    • prefix + Ctrl-s to save the session
    • prefix + Ctrl-r to restore the session

Competitor Comparisons

Continuous saving of tmux environment. Automatic restore when tmux is started. Automatic tmux start when computer is turned on.

Pros of tmux-continuum

  • Automatic saving: Periodically saves tmux environment without manual intervention
  • Automatic restoration: Restores tmux environment on system startup
  • Customizable save interval: Allows users to set their preferred frequency for automatic saves

Cons of tmux-continuum

  • Dependency: Requires tmux-resurrect to function, adding complexity to setup
  • Resource usage: Continuous saving might impact system performance, especially with frequent saves
  • Limited control: Less granular control over when and what to save compared to manual saves

Code Comparison

tmux-resurrect (manual save):

prefix + Ctrl-s  # Save tmux environment
prefix + Ctrl-r  # Restore tmux environment

tmux-continuum (automatic save):

set -g @continuum-save-interval '15'  # Save every 15 minutes
set -g @continuum-restore 'on'        # Enable automatic restore

tmux-continuum builds upon tmux-resurrect, providing automation for saving and restoring tmux sessions. While tmux-resurrect offers manual control over saving and restoring, tmux-continuum adds the convenience of automatic, periodic saves and startup restoration. The choice between the two depends on user preferences for manual control versus automation and the willingness to manage an additional plugin dependency.

A list of awesome resources for tmux

Pros of awesome-tmux

  • Comprehensive resource collection for tmux, including plugins, tutorials, and configurations
  • Regularly updated with community contributions
  • Provides a broader overview of tmux ecosystem beyond just session management

Cons of awesome-tmux

  • Not a functional plugin, but rather a curated list of resources
  • Requires more effort from users to implement desired functionality
  • May overwhelm beginners with too many options

Code comparison

Not applicable, as awesome-tmux is a curated list and doesn't contain executable code. tmux-resurrect, on the other hand, is a functional plugin with code for session management. Here's a sample of tmux-resurrect's code:

save_command_strategy_file() {
  local save_command_strategy="$(get_tmux_option "$save_command_strategy_option" "$default_save_command_strategy")"
  local strategy_file="$CURRENT_DIR/strategies/${save_command_strategy}.sh"
  local default_strategy_file="$CURRENT_DIR/strategies/${default_save_command_strategy}.sh"

  if [ -f "$strategy_file" ]; then
    echo "$strategy_file"
  else
    echo "$default_strategy_file"
  fi
}

This code snippet demonstrates how tmux-resurrect handles saving command strategies, which is a core feature of the plugin.

21,777

🇫🇷 Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❤️

Pros of .tmux

  • Comprehensive configuration with sensible defaults
  • Includes status bar customization and themes
  • Easier setup with a single configuration file

Cons of .tmux

  • Less focused on session management and restoration
  • May require more manual configuration for specific needs
  • Potentially overwhelming for users who prefer minimal setups

Code Comparison

tmux-resurrect:

set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-strategy-vim 'session'

.tmux:

set -g status-left-length 32
set -g status-right-length 150
set -g status-interval 5
set -g @themepack 'powerline/default/cyan'

Key Differences

  • tmux-resurrect focuses specifically on session management and restoration
  • .tmux provides a more comprehensive tmux configuration with various features
  • tmux-resurrect requires the tmux plugin manager (tpm), while .tmux is a standalone configuration
  • .tmux includes status bar customization out of the box, while tmux-resurrect doesn't address this aspect
  • tmux-resurrect offers more granular control over session restoration, including specific application support

Use Cases

  • Choose tmux-resurrect for robust session management and restoration capabilities
  • Opt for .tmux if you want a well-rounded, pre-configured tmux setup with minimal effort
  • Consider using both in combination for a feature-rich tmux environment with strong session management

:green_book: Example tmux configuration - screen + vim key-bindings, system stat, cpu load bar.

Pros of tmux-config

  • Comprehensive configuration with sensible defaults
  • Includes custom key bindings and status bar customization
  • Designed as a complete tmux setup, not just a plugin

Cons of tmux-config

  • Less focused on session persistence and restoration
  • May require more manual configuration and tweaking
  • Not as easily integrable with other tmux plugins

Code Comparison

tmux-resurrect:

set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-strategy-vim 'session'

tmux-config:

# Set prefix key to Ctrl-a
unbind-key C-b
set-option -g prefix C-a

# Custom status bar
set -g status-left '#[fg=green]#H #[fg=black]• #[fg=green,bright]#(uname -r | cut -c 1-6)#[default]'

Summary

tmux-resurrect focuses specifically on session persistence and restoration, while tmux-config provides a more comprehensive tmux setup with various customizations. tmux-resurrect is easier to integrate with other plugins, while tmux-config offers a more complete out-of-the-box experience but may require more manual configuration. The choice between the two depends on whether you need a full tmux configuration or just session persistence functionality.

A pack of various Tmux themes.

Pros of tmux-themepack

  • Focuses on visual customization, offering a variety of pre-made themes
  • Lightweight and easy to install, requiring minimal configuration
  • Enhances the aesthetic appeal of tmux sessions

Cons of tmux-themepack

  • Limited functionality compared to tmux-resurrect, as it doesn't offer session management
  • Lacks the ability to save and restore tmux environments
  • May require additional plugins for a complete tmux setup

Code Comparison

tmux-themepack:

set -g @plugin 'jimeh/tmux-themepack'
set -g @themepack 'powerline/default/cyan'

tmux-resurrect:

set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-strategy-vim 'session'

While tmux-themepack focuses on applying visual themes to tmux, tmux-resurrect provides functionality for saving and restoring tmux sessions. The code examples show how to include and configure each plugin in a tmux configuration file. tmux-themepack allows for easy theme selection, while tmux-resurrect offers options for capturing pane contents and integrating with vim sessions.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

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.

Installation with Tmux Plugin Manager (recommended)

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

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