tmux

tmux

Set mouse mode on

I wanna use a mouse to resize panes!
I ain’t gonna use the keyboard for that!

Add this to $HOME/.tmux.conf:

set -g mouse on

Split terminal into panes

For horizontal split: Press Ctrl + b followed by ".
For vertical split: Press Ctrl + b followed by %.

But I ain’t gonna remember these keybinds, so I modified foot configuration to use Konsole-style keybinds (Ctrl-Shift-9 and Ctrl-Shift-0). Check this out.

Switch tabs

Switch between tabs without prefix using Shift + ← / →:
(Tmux calls tabs windows for some stupid reason, but anyway)

bind -n S-Left  previous-window
bind -n S-Right next-window

Open splits and tabs with current directory

By default, tmux opens splits and new windows in the directory where the tmux session started. To open them in the current pane’s path, pass -c "#{pane_current_path}":

bind % split-window -h -c "#{pane_current_path}"
bind '"' split-window -v -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"

Navigate splits with Alt and arrow/vim keys, no Ctrl+b

  • Arrow keys: Alt + ← / → / ↑ / ↓
  • Vim keys: Alt + h / j / k / l
bind -n M-Left  select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up    select-pane -U
bind -n M-Down  select-pane -D

bind -n M-h     select-pane -L
bind -n M-l     select-pane -R
bind -n M-k     select-pane -U
bind -n M-j     select-pane -D

1-based indexing & auto-renumbering

Panes & tabs start from 1 instead of 0.
Makes it easier to switch tabs and stuff.
Automatically renumbers tabs/windows if one is closed too.

set -g base-index 1
setw -g pane-base-index 1
set -g renumber-windows on

Reload configuration without restarting

Bind Ctrl + b followed by r to reload ~/.tmux.conf on the fly:

bind r source-file ~/.tmux.conf \; display-message "Config reloaded!"

Performance, Escape time & True Color

  • Increase history scrollback buffer to 10,000 lines.
  • Set escape time to 0 to remove the delay when pressing Esc in Neovim/Vim.
  • Enable 256 colors and 24-bit TrueColor (RGB).
set -g history-limit 10000
set -s escape-time 0
set -g default-terminal "tmux-256color"
set -as terminal-features ",*:RGB"

Styling & Themes

man that ugly green used for borders and the status bar, it sucks:

# Active and inactive tabs
set -g window-status-format "#[fg=#6c778c]#I:#W"
set -g window-status-current-format "#[fg=#4cd9e3,bold] #I:#W "
set -g window-status-separator " "

# Clean split borders
set -g pane-border-style "fg=#242e3a"
set -g pane-active-border-style "fg=#4cd9e3"

# Optionally load external theme
source-file -q "$HOME/.config/tmux/themes/noctalia.conf"