- Shell 100%
| README.org | ||
| tmux.conf | ||
| tmux.conf.backup | ||
Tmux Configuration
Installation
This is my tmux config. It's a zero-plugin setup with vim-like keybindings and a Tokyo Night Moon theme.
To use this config, first make sure tmux is installed:
# Arch
sudo pacman -S tmux
# Ubuntu/Debian
sudo apt install tmux
# macOS
brew install tmux
Then point tmux to this config by symlinking it:
mkdir -p ~/.config/tmux
ln -sf /path/to/this/tmux.conf ~/.config/tmux/tmux.conf
Or if you just want to test it out without symlinking:
tmux source-file /path/to/this/tmux.conf
Configuration Breakdown
Terminal and Display Settings
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*:RGB"
These lines enable 256-color support and true color (RGB) support. The first line tells tmux to advertise itself as a 256-color terminal, and the second enables 24-bit RGB colors. This is essential for proper color rendering in tools like Neovim.
set -g mouse on
set -g set-clipboard on
Mouse support lets you click between panes and drag borders to resize. Clipboard integration means when you copy text in tmux, it goes to your system clipboard.
Prefix Key
unbind C-b
set -g prefix C-a
bind-key C-a send-prefix
This changes the prefix from Ctrl-b to Ctrl-a because it's way easier to reach. The third line lets you send the actual Ctrl-a to the terminal if needed.
Pane Navigation
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
Vim-style pane navigation. After hitting the prefix, you can use h/j/k/l to move between panes.
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
The -n flag means "bind without prefix". So Alt+h/j/k/l lets you switch panes instantly without hitting prefix first.
Splits
unbind %
bind | split-window -h -c "#{pane_current_path}"
unbind '"'
bind - split-window -v -c "#{pane_current_path}"
Split windows with prefix + | for vertical and prefix + - for horizontal. The -c "#{pane_current_path}" part makes new panes open in the same directory as your current pane.
Config Reload
unbind r
bind r source-file $HOME/.config/tmux/tmux.conf
Reload your config with prefix + r without having to restart tmux.
Window Management
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on
Start numbering windows and panes at 1 instead of 0. This is more ergonomic because window 1 is on the left of your keyboard. The renumber-windows option automatically renumbers windows when you close one, so you don't get gaps.
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
# ... (continues through M-9)
Jump directly to windows with Alt+1 through Alt+9, no prefix needed.
Copy Mode
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
unbind -T copy-mode-vi MouseDragEnd1Pane
Vim-style copy mode. Enter copy mode with prefix + [, navigate with h/j/k/l, press v to start selection, y to yank (copy). The C-v binding lets you do rectangle selection like in vim. The last line prevents mouse selection from exiting copy mode automatically.
Theme
The rest of the config is the Tokyo Night Moon theme. The color variables are defined at the top:
thm_bg="#222436"
thm_fg="#c8d3f5"
thm_cyan="#86e1fc"
# ... etc
The status bar shows:
- Current window with a checkmark and the last two parts of the current directory path
- Other windows showing just their index and name
- Right side shows window name, a visual indicator that changes color when prefix is pressed, and session name
The status bar format strings look complex but they're just using tmux's format variables like #I (window index), #W (window name), #S (session name), and conditional formatting with #{?client_prefix,...}.
Keybindings Summary
| Bind | Action |
|---|---|
Ctrl-a |
Prefix key |
prefix + \vert |
Split vertical |
prefix + - |
Split horizontal |
prefix + h/j/k/l |
Navigate panes |
Alt + h/j/k/l |
Navigate panes (no prefix) |
Alt + 1-9 |
Jump to window (no prefix) |
prefix + r |
Reload config |
prefix + [ |
Enter copy mode |
v (copy mode) |
Start selection |
y (copy mode) |
Yank (copy) selection |
Notes
This config is heavily inspired by Henry Misc's zero-plugin approach. No TPM, no plugins, just native tmux features.
If you want to change the theme colors, just swap out the thm_* variables at the top with your preferred color scheme.