TL;DR
Use tmuxp so that you don’t have to re-create the same sessions, windows and panes every time you restart your machine.

tmuxp_3

Introduction

Previously I was using tmux-resurrect (persists tmux environment across system restarts) and tmux-continuum (continuous saving of tmux environment), but these lack finer control as to which sessions to restore.

Getting Started

  1. pip install --user tmuxp

  2. Make sure tmuxp is installed:

❯ tmuxp --version
tmuxp 1.13.0, libtmux 0.14.0
  1. Create the following in ~/.config/tmuxp/main.yaml:
session_name: main
windows:
  - window_name: zsh
    panes:
      - shell_command:
          - neofetch
          - echo hello
  - window_name: nvim
    panes:
      - nvim
  1. tmuxp load main

When I restart my machine, I do tmuxp load main misc nvim to restart all my sessions.

Conclusion

If you don’t like tmuxp, you can choose other session managers from Tools and session management.