|
# Enable true color support for terminals with screen-256color capability. |
|
set -ga terminal-overrides ",screen-256color*:Tc" |
|
|
|
# Set default terminal type to screen-256color. |
|
set-option -g default-terminal "screen-256color" |
|
|
|
# Set escape time for key sequences to 0 milliseconds. |
|
set -s escape-time 0 |
|
|
|
# Change tmux prefix key from the default Ctrl-b (C-b) to Ctrl-a (C-a). |
|
unbind C-b # Unbind the default prefix key, Ctrl-b. |
|
set-option -g prefix C-a # Set prefix to Ctrl-a. |
|
bind-key C-a send-prefix # Use C-a C-a to send a literal Ctrl-a. |
|
|
|
# Customize the status bar with a dark background and light blue foreground color. |
|
set -g status-style 'bg=#333333 fg=#5eacd3' |
|
|
|
# Reload tmux configuration with prefix + r (Ctrl-a then r). |
|
bind r source-file ~/.tmux.conf |
|
|
|
# Set base index for windows to 1 (tmux windows will start from 1 instead of 0). |
|
set -g base-index 1 |
|
|
|
# Use vi-style keys in copy mode for navigation and selection. |
|
set-window-option -g mode-keys vi |
|
bind -T copy-mode-vi v send-keys -X begin-selection # Use 'v' to begin selection. |
|
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard' # Use 'y' to copy to clipboard. |
|
|
|
# Vim-like pane switching shortcuts: |
|
bind -r ^ last-window # Press 'Ctrl-^' to jump to the last active window. |
|
bind -r k select-pane -U # Press 'k' to move up a pane. |
|
bind -r j select-pane -D # Press 'j' to move down a pane. |
|
bind -r h select-pane -L # Press 'h' to move left a pane. |
|
bind -r l select-pane -R # Press 'l' to move right a pane. |
|
|
|
# Open TODO.md in the current pane's directory if it exists; otherwise, open a default TODO file. |
|
bind -r D neww -c "#{pane_current_path}" "[[ -e TODO.md ]] && nvim TODO.md || nvim ~/.dotfiles/personal/todo.md" |
|
|
|
# Open `tmux-sessionizer` script (for switching sessions) in a new tmux window. |
|
# Use prefix + f (Ctrl-a then f). |
|
bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer" |
|
|
|
# Open 'tmux-cht.sh' script (for cheat sheets) in a new tmux window. |
|
# Use prefix + i (Ctrl-a then i). |
|
bind-key -r i run-shell "tmux neww tmux-cht.sh" |
|
|
|
# Open specific projects with custom bindings: |
|
# Use Ctrl-a + G, C, R, H, T, N, S to quickly navigate to various projects. |
|
|
|
bind-key -r G run-shell "~/.local/bin/tmux-sessionizer ~/work/nrdp" # Open `~/work/nrdp` with Ctrl-a + G. |
|
bind-key -r C run-shell "~/.local/bin/tmux-sessionizer ~/work/tvui" # Open `~/work/tvui` with Ctrl-a + C. |
|
bind-key -r R run-shell "~/.local/bin/tmux-sessionizer ~/work/milo" # Open `~/work/milo` with Ctrl-a + R. |
|
# bind-key -r L run-shell "~/.local/bin/tmux-sessionizer ~/work/hpack" # Disabled for now. |
|
bind-key -r H run-shell "~/.local/bin/tmux-sessionizer ~/personal/vim-with-me" # Open `~/personal/vim-with-me` with Ctrl-a + H. |
|
bind-key -r T run-shell "~/.local/bin/tmux-sessionizer ~/personal/refactoring.nvim" # Open `~/personal/refactoring.nvim` with Ctrl-a + T. |
|
bind-key -r N run-shell "~/.local/bin/tmux-sessionizer ~/personal/harpoon" # Open `~/personal/harpoon` with Ctrl-a + N. |
|
bind-key -r S run-shell "~/.local/bin/tmux-sessionizer ~/personal/developer-productivity" # Open `~/personal/developer-productivity` with Ctrl-a + S. |