61 lines
2.6 KiB
Plaintext
61 lines
2.6 KiB
Plaintext
# some basic options
|
|
set-option -g default-shell $SHELL
|
|
set-window-option -g mode-keys vi
|
|
set-option -g history-limit 10000
|
|
set-option -g set-clipboard off
|
|
set -g escape-time 10
|
|
|
|
# set prefix to c-a
|
|
unbind C-a
|
|
unbind C-b
|
|
set -g prefix C-a
|
|
bind C-a send-prefix
|
|
|
|
set -g status-bg red
|
|
set -g status-fg white
|
|
|
|
# do some cool color stuff
|
|
set -g default-terminal "tmux-256color"
|
|
set -sa terminal-overrides ",xterm*:Tc" # true-color
|
|
set -as terminal-overrides ',xterm*:Smulx=\E[4::%p1%dm' # undercurl support
|
|
set -as terminal-overrides ',xterm*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
|
|
|
|
# smart pane switching with awareness of vim splits
|
|
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L || true"
|
|
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D || true"
|
|
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U || true"
|
|
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R || true"
|
|
# TODO bind these in vi normal mode
|
|
bind C-h send-keys C-h
|
|
bind C-j send-keys C-j
|
|
bind C-k send-keys C-k
|
|
bind C-l send-keys C-l
|
|
|
|
# sane copying (TODO?)
|
|
bind -Tcopy-mode-vi 'v' send -X begin-selection
|
|
bind -Tcopy-mode-vi 'Y' send -X copy-pipe 'xclip'
|
|
|
|
# launch splits in the same directory and with some copied environment
|
|
# new window command opens window after current window
|
|
unbind %
|
|
unbind '"'
|
|
unbind c
|
|
bind % split-window -c "#{pane_current_path}" -h
|
|
bind '"' split-window -c "#{pane_current_path}" -v
|
|
bind c new-window -c "#{pane_current_path}" -a
|
|
# garbage-collect split pane variables
|
|
#set-hook -g pane-exited 'run-shell "zsh -c \"HOOK_PANE=#{hook_pane}; for VAR in \\\$(tmux show-environment | grep \"^ZSH_PANE_\\\${HOOK_PANE#%}_\" | cut -d= -f1); do tmux set-environment -u \\\${VAR}; done\""'
|
|
|
|
# don't change the title once I've set it
|
|
set-option -g allow-rename off
|
|
|
|
# set window title to session name for scripting
|
|
set-option -g set-titles-string "#H tmux #{session_name}"
|
|
set-option -g set-titles on
|
|
|
|
|
|
# do stuff on focus
|
|
set focus-events on
|
|
set-hook -g client-focus-in[0] attach
|
|
#set-hook -g client-focus-in[1] 'run-shell "bash -c \"tmux list-panes -sF \\\"##D\\\" | while read -r MY_PANE; do tmux set-environment ZSH_PANE_\\\${MY_PANE#%}_IMPORTS \\\"\\\$(for var in DISPLAY WAYLAND_DISPLAY; do tmux show-environment -s \\\$var || true ; done)\\\"; done\" >/tmp/augh 2>&1"'
|