dotfiles/tmux/.tmux.conf

83 lines
2.5 KiB
Plaintext

# 256 colors for vim
set -g default-terminal "screen-256color"
# Set default shell to zsh
set-option -g default-shell /bin/zsh
# Tmuxline
if-shell "test -f ~/.tmuxline_theme_snapshot" "source ~/.tmuxline_theme_snapshot"
# Start window numbering at 1
set-option -g base-index 1
set-window-option -g pane-base-index 1
# Change prefix to C-sp
unbind-key C-b
set-option -g prefix C-Space
bind-key C-Space send-prefix
# Cycle panes with C-b C-b
# unbind ^B
# bind ^B select-pane -t :.+
# Reload config wtih a key
bind-key r source-file ~/.tmux.conf \; display "Config reloaded!"
# Mouse works as expected
set -g mouse on
# set -g mode-mouse on
# set -g mouse-select-pane on
# set -g mouse-resize-pane on
# set -g mouse-select-window on
# Scrolling works as expected
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# Use the system clipboard
# set-option -g default-command "reattach-to-user-namespace -l zsh"
# Clear the pane and its history
bind -n C-k send-keys C-l \; clear-history
# Smart pane switching with awareness of vim splits
# From github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n C-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
bind-key -T copy-mode-vi C-\\ select-pane -l
# C-l is taken oer by vim style pane navigation (not sure where this comes from or whether I still need it)
bind C-l send-keys 'C-l'
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
# The next line throws a syntax error.
# bind-key -t vi-copy v begin-selection
# bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace cb"
# Update default binding of `Enter` to also use copy-pipe
# unbind -t vi-copy Enter
# bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace cb"
# tmux-weather
run-shell /home/adam/code/tmux-weather/tmux-weather.tmux
# tmux-battery
run-shell /home/adam/code/tmux-battery/battery.tmux
# tmux-cpu
run-shell /home/adam/code/tmux-cpu/cpu.tmux
# tmux-protonvpn
run-shell /home/adam/code/tmux-protonvpn/protonvpn.tmux