Skip to content

Instantly share code, notes, and snippets.

@afrendeiro
Last active July 20, 2026 06:55
Show Gist options
  • Select an option

  • Save afrendeiro/f318ab2130e88d73c4524fa56d477f1a to your computer and use it in GitHub Desktop.

Select an option

Save afrendeiro/f318ab2130e88d73c4524fa56d477f1a to your computer and use it in GitHub Desktop.
Tmux setup on CachyOS (fish + alacritty)

tmux Setup Guide for Fish + Alacritty

This guide documents a complete tmux configuration optimized for Fish shell and Alacritty terminal on Linux systems.

Installation

Prerequisites

Ensure you have the following installed:

  • tmux
  • Fish shell
  • Alacritty
  • git

One-time Setup

Install TPM (Tmux Plugin Manager):

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

Create tmux configuration at ~/.tmux.conf:

# Remap prefix to Ctrl-a
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# Start windows and panes at 1
set -g base-index 1
setw -g pane-base-index 1

# Renumber windows when one is closed
set-option -g renumber-windows on

# Split panes with - and |
bind-key - split-window -v
bind-key | split-window -h
unbind '"'
unbind %

# Enable mouse support
set -g mouse on

# Vi keybindings
setw -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-line

# Longer scrollback
set-option -g history-limit 5000

# 256 color support
set -g default-terminal "screen-256color"

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'dracula/tmux'

# Dracula theme config
set -g @dracula-show-powerline true
set -g @dracula-cpu-usage true
set -g @dracula-gpu-usage true
set -g @dracula-ram-usage true

# Initialize TMUX plugin manager (keep this at the very end)
run '~/.tmux/plugins/tpm/tpm'

Configure Fish shell at ~/.config/fish/config.fish:

Add this to your existing config (or create the file if it doesn't exist):

# Auto-attach to tmux session
if status is-interactive
    if not set -q TMUX
        exec tmux attach-session -t main -c ~ || exec tmux new-session -s main -c ~
    end
end

Configure Alacritty at ~/.config/alacritty/alacritty.toml:

[terminal.shell]
program = "fish"
args = ["-l", "-c", "tmux attach-session -t main || tmux new-session -s main"]

Install tmux plugins (one-time):

Launch tmux and press Ctrl-a Shift-i to install all plugins listed in your config. You should see output in the bottom right corner indicating repositories are being cloned.

Usage

Basic Navigation

All tmux commands use the prefix Ctrl-a followed by a key.

Window management:

  • Ctrl-a n — Next window
  • Ctrl-a p — Previous window
  • Ctrl-a 1 — Jump to window 1 (works for any number)
  • Ctrl-a w — List all windows (interactive selector)
  • Ctrl-a l — Toggle to last active window
  • Ctrl-a c — Create new window
  • Ctrl-a , — Rename current window
  • Ctrl-a & — Close current window

Pane management:

  • Ctrl-a - — Split pane horizontally
  • Ctrl-a | — Split pane vertically
  • Ctrl-a arrow keys — Navigate between panes
  • Ctrl-a z — Zoom pane (toggle fullscreen)
  • Ctrl-a x — Close current pane
  • Ctrl-a { or } — Swap panes

Copy mode (vi-style):

  • Ctrl-a [ — Enter copy mode
  • v — Start selection
  • y — Copy selection
  • q — Exit copy mode
  • Ctrl-a ] — Paste

Auto-launch behavior

When you open a new Alacritty window, Fish will automatically attach you to the main tmux session (or create it if it doesn't exist). All terminal windows will share the same session and windows.

Useful additions

To add quick window navigation without the prefix, add this to ~/.tmux.conf:

# Quick window navigation with Alt
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3

# Or use Alt-arrow for quick switching
bind-key -n M-Left select-window -t -1
bind-key -n M-Right select-window -t +1

Then reload: Ctrl-a : and type source-file ~/.tmux.conf

Theme

This setup uses the Dracula theme, which displays system information (CPU, GPU, RAM usage) in the status bar. The theme is automatically installed via TPM.

To customize further, check the Dracula tmux documentation at https://github.com/dracula/tmux

Troubleshooting

Theme not showing colors:

  • Verify plugins installed: ls ~/.tmux/plugins/ (should contain dracula, tpm, tmux-sensible)
  • If empty, launch tmux and press Ctrl-a Shift-i to install
  • Reload config: tmux source-file ~/.tmux.conf

Fish not auto-launching tmux:

  • Verify Fish config includes the auto-launch snippet
  • Test manually: tmux attach-session -t main || tmux new-session -s main

Plugins not loading:

  • Ensure ~/.tmux/plugins/tpm exists
  • Run Ctrl-a Shift-i inside a tmux session to install

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment