dotfiles/dot_config/tmux/tmux.conf.tmpl

146 lines
4.1 KiB
Cheetah
Raw Normal View History

# Version-specific commands [grumble, grumble]
# See: https://github.com/tmux/tmux/blob/master/CHANGES
run-shell 'tmux setenv -g TMUX_VERSION $(tmux -V | \
sed -En "s/^tmux[^0-9]*([.0-9]+).*/\1/p")'
2021-06-16 17:22:10 -04:00
# use vi bindings
2021-06-16 17:23:40 -04:00
set -g status-keys vi
set -g mode-keys vi
2021-06-16 17:22:10 -04:00
2021-06-13 21:21:24 -04:00
# change prefix
unbind C-b
set -g prefix C-f
bind C-f send-prefix
2021-06-16 17:14:48 -04:00
# actual escape key
set -sg escape-time 0
2021-06-13 21:21:24 -04:00
# reload
bind r source-file $XDG_CONFIG_HOME/tmux/tmux.conf \; display "Config Reloaded"
2021-06-16 17:14:48 -04:00
# session/client
bind q detach-client
bind l list-sessions
set -g destroy-unattached off
2021-06-16 17:14:48 -04:00
2021-06-13 21:21:24 -04:00
# window creation
bind -n C-t new-window
2021-06-16 17:14:48 -04:00
bind N command-prompt -I "#{window_name}" "rename-window '%%'"
bind S command-prompt -I "#{session_name}" "rename-session '%%'"
bind - split-window -v
bind | split-window -h
2021-06-13 21:21:24 -04:00
# window navigation
bind -n M-F12 next-window # use this since C-Tab doesn't exist in most terminals
bind -n M-F11 previous-window # use this since BTab = S-Esc
bind M-F12 swap-window -t +1 \; next-window
bind M-F11 swap-window -t -1 \; previous-window
2021-06-16 17:14:48 -04:00
bind -n M-| choose-window "join-pane -h -t '%%'"
bind -n M-- choose-window "join-pane -v -t '%%'"
2021-06-13 21:21:24 -04:00
# pane navigation
bind -n M-l select-pane -R
bind -n M-h select-pane -L
bind -n M-k select-pane -U
bind -n M-j select-pane -D
bind -n M-o last-pane
2021-06-16 17:14:48 -04:00
bind o display-panes
bind H swap-pane -U
bind L swap-pane -D
set -g display-panes-time 5000
2021-06-13 21:21:24 -04:00
# pane resizing
bind -r C-l resize-pane -R 2
bind -r C-h resize-pane -L 2
bind -r C-k resize-pane -U
bind -r C-j resize-pane -D
2021-06-16 17:14:48 -04:00
# copy-mode (vim-like)
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
# clipboard integration
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -i -p && xsel -o -p | xsel -i -b"
bind-key p run "xsel -o | tmux load-buffer - ; tmux paste-buffer"
2021-06-13 21:21:24 -04:00
# pane selection (mouse)
# set -g mouse utf8 on
set -g mouse on
# copy-mode
bind C-c copy-mode
2021-06-16 17:14:48 -04:00
# theme
status_sep="#[fg=#888888]|#[default]"
set -g status-interval 1
set -g status-left "#h:#S $status_sep "
set -g status-left-length 32
set -g status-style "fg=#cccccc,bg=#444444"
set -g window-status-style "fg=#9f9f9f"
set -g window-status-activity-style "fg=#9f9f9f"
set -g window-status-current-style "fg=#000000 bold,bg=#00ff00"
2021-06-27 22:57:07 -04:00
set -g window-status-separator ""
2021-06-16 17:14:48 -04:00
2021-06-27 22:57:07 -04:00
set -g window-status-format " #{?window_activity_flag,##,}#I-#W "
2021-06-16 17:14:48 -04:00
set -g window-status-current-format " #I-#W "
set -g visual-activity off
set -g monitor-activity on
set -g pane-border-style "fg=#444444"
set -g pane-active-border-style "fg=#aaaaaa"
if-shell -b '[ "$(echo "$TMUX_VERSION >= 3.2" | bc)" = 1 ]' \
"set -g pane-border-lines heavy"
2021-06-16 17:14:48 -04:00
set -g message-style "fg=#ffffaa,bg=#666600"
set -g pane-border-status off
if-shell -b '[ "$(echo "$TMUX_VERSION >= 3.2" | bc)" = 1 ]' ' \
set -g copy-mode-current-match-style "fg=#000000,bg=#ffffff" \
set -g copy-mode-match-style "fg=#000000,bg=#aa00aa"'
2021-06-16 17:14:48 -04:00
# pressing F12 turns the current prefix key/keymap "OFF" and allows keypresses
# to go to a nested session if running
2021-06-13 21:21:24 -04:00
bind -T root F12 \
set prefix None \;\
set key-table off \;\
2021-06-16 17:14:48 -04:00
set status-style "fg=#aaaaaa,bg=#666666" \;\
set window-status-style "fg=#777777" \;\
set window-status-current-style "fg=#666666 bold,bg=#999999" \;\
2021-06-13 21:21:24 -04:00
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\
bind -T off F12 \
set -u prefix \;\
set -u key-table \;\
set -u status-style \;\
2021-06-16 17:14:48 -04:00
set -u window-status-style \;\
2021-06-13 21:21:24 -04:00
set -u window-status-current-style \;\
refresh-client -S
2021-06-17 17:21:38 -04:00
# if on local machine, put bar at top, if not put bar at bottom with some nice
# stats that the local machine already has via conky
2021-06-13 21:48:18 -04:00
{{- if eq .chezmoi.hostname "petrucci4prez" }}
set -g status-position top
2021-06-17 17:25:49 -04:00
set -g status-right ""
set -g status-right-length 0
2021-06-13 21:48:18 -04:00
{{- else }}
2021-06-17 17:21:38 -04:00
down="#($XDG_CONFIG_HOME/tmux/plugins/network down)"
up="#($XDG_CONFIG_HOME/tmux/plugins/network up)"
2021-06-17 17:39:18 -04:00
net="NET(↑/↓): $up $down"
2021-06-17 17:21:38 -04:00
cpu="CPU: #($XDG_CONFIG_HOME/tmux/plugins/cpu_perc)"
mem="RAM: #($XDG_CONFIG_HOME/tmux/plugins/mem_perc)"
2021-06-13 21:48:18 -04:00
set -g status-position bottom
2021-06-17 17:21:38 -04:00
set -g status-right-length 64
set -g status-right "$net $status_sep $cpu $status_sep $mem "
2021-06-13 21:48:18 -04:00
{{ end }}