dotfiles/misc/tmux/tmux.conf

86 lines
2.3 KiB
Plaintext

# Unbind unused default keys
unbind '#' # list-buffers
unbind = # choose-buffer
unbind - # delete-buffer
unbind % # split-pane -v
unbind '"' # split-pane -h
unbind q # display-panes
setw -g mode-keys vi
set -g default-terminal "screen-256color"
bind R source-file ~/.tmux.conf
bind '\' confirm-before kill-server
# Mouse
set -g mouse
# Copy/Pasting
bind [ copy-mode
bind ] paste-buffer -s \015
bind b list-buffers # list all paste buffers (default key is '#')
bind p choose-buffer # choose buffer to paste interactively (default key was '=')
bind x delete-buffer # delete the most recently copied buffer of text (default key was '-')
# new window
bind C-c new-window
bind c new-window
# Window/Pane management
# Options
set -g base-index 1
set -g set-titles on
setw -g automatic-rename on
# Splitting
bind _ split-window -v
bind | split-window -h
# Resizing
bind -r < resize-pane -L 3
bind -r > resize-pane -R 3
bind -r + resize-pane -U 1
bind -r - resize-pane -D 1
# Swapping panes
bind -r J swap-pane -D
bind -r K swap-pane -U
# Jumping to panes
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind b last-window # Jump to last active window
bind w display-panes # display visible indicator of each pane
# Statusbar settings
set -g status-keys vi
set -g display-time 4000 # How long messages are displayed for
setw -g aggressive-resize on
# https://github.com/sjl/vitality.vim/issues/8#issuecomment-7664649
set-option -g terminal-overrides '*88col*:colors=88,*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%p1%{2}%-%;%d\007'
set -sg escape-time 0 # needed to distinguish between ESC and Meta in emacs
if-shell "uname | grep -q Darwin" {
if-shell "command -v reattach-to-user-namespace &>/dev/null" {
set-option -g default-command "reattach-to-user-namespace -l zsh"
} {
set-option -g default-command "zsh"
}
bind C-c run "tmux save-buffer - | pbcopy"
bind C-v run "pbpaste | tmux load-buffer - && tmux paste-buffer"
}
if-shell "uname | grep -q Linux" {
if-shell "command -v zsh &>/dev/null" {
set-option -g default-command "zsh"
} {
set-option -g default-command "bash"
}
}