tmux-continuum Documentation

repository·master·Indexed 26 days ago

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

A tmux plugin that provides continuous saving of the tmux environment, automatic tmux startup upon system boot, and automatic restoration of sessions when tmux starts. It requires tmux 1.9 or higher and the tmux-resurrect plugin. Supports automatic startup via Terminal.app on macOS and systemd on Linux.

Tokens
1.5K
Snippets
7
Records
15
Agent score
87%

What's inside tmux-continuum

  1. Install tmux-continuum manually

    master

    If you are not using TPM, you can install the plugin manually. Ensure tmux-resurrect is already installed.

    Steps:

    1. Clone the repository to a local directory.
    2. Add the run-shell command pointing to the cloned continuum.tmux file to the bottom of your .tmux.conf.
    3. Reload your tmux environment.
  2. Install tmux-continuum using Tmux Plugin Manager (TPM)

    master

    To install tmux-continuum using TPM, ensure you have the tmux-resurrect plugin installed first. Add both plugins to your .tmux.conf file, then fetch and source them within tmux.

    Prerequisites:

    • tmux 1.9 or higher
    • bash
    • tmux-resurrect plugin installed

    Steps:

    1. Add the following lines to your .tmux.conf:
    2. Press prefix + I to fetch and source the plugins.
    set -g @plugin 'tmux-plugins/tmux-resurrect'
    set -g @plugin 'tmux-plugins/tmux-continuum'
  3. Enable automatic tmux start on OS X

    master

    To have tmux automatically start after your computer is turned on, add the @continuum-boot option to your .tmux.conf and reload the configuration.

    When enabled, Terminal.app will open, resize to maximum size, and execute the tmux command. If the 'auto restore' feature is also enabled, tmux will attempt to restore your previous environment.

    Note: On the first reboot after enabling this, you may need to grant the script permission to control your computer via System Preferences -> Security & Privacy -> Accessibility if prompted about access to system programs (like System Events).

  4. Disable automatic restore

    master

    To disable automatic restore, you can either:

    1. Remove the set -g @continuum-restore 'on' line from your .tmux.conf.
    2. Create an empty file named tmux_no_auto_restore in your home directory. If this file exists, automatic restore will be prevented regardless of your .tmux.conf settings.
    touch ~/tmux_no_auto_restore
  5. Display tmux-continuum status in the tmux status line

    master

    You can display the current status of tmux-continuum in your tmux status line using the #{continuum_status} interpolation. This works with both the status-left and status-right tmux options.

    When enabled, the interpolation displays the current save interval (e.g., Continuum status: 15). If continuous saving is disabled, it displays Continuum status: off.

    set -g status-right 'Continuum status: #{continuum_status}'
  6. Enable automatic tmux startup via Systemd

    master

    To have tmux start automatically when you log in (via GUI, console, or SSH), set the @continuum-boot option to 'on' in your .tmux.conf.

    On the first run, tmux-continuum will automatically generate and enable a user-level systemd unit file located at ${HOME}/.config/systemd/user/tmux.service.

  7. Understand behavior when running multiple tmux servers

    master

    If you run multiple tmux servers simultaneously (e.g., using different sockets like tmux and tmux -S/tmp/foo), tmux-continuum manages them by giving precedence to the server that was started first.

    Only the first server started will perform "auto restore" (if enabled) and "auto saving". Subsequent servers will detect the presence of the first server and will not perform auto-restoring or auto-saving to prevent environment overwrites and conflicts.

  8. Change the automatic save interval

    master

    The automatic save interval is measured in minutes. To change the interval, set the @continuum-save-interval option in your .tmux.conf. For example, to save every 60 minutes, set it to '60'. After modifying the file, you must source your configuration by running tmux source-file ~/.tmux.conf in your shell.

    set -g @continuum-save-interval '60'
  9. Configure the Systemd tmux startup command

    master

    You can customize the command used by Systemd to start the tmux server using the @continuum-systemd-start-cmd option in .tmux.conf.

    • Default: new-session -d.
    • Custom Sessions: If you have pre-defined sessions in your .tmux.conf and want more control, set @continuum-systemd-start-cmd to 'start-server'.

    Note: This command is executed directly as part of Systemd's ExecStart statement, so it does not undergo shell parsing. Always reload your configuration with tmux source ~/.tmux.conf after making changes.