nix-conf/config/tmux/tmux.conf

110 lines
3.3 KiB
Plaintext
Raw Normal View History

2024-08-23 19:55:31 -04:00
### styling
# status left [session name]
set -g status-left-style fg=black,bg=white
# red bg when multiple clients attached to session
set -g status-left "#{?session_many_attached,#[bg=red] [#S]:#{session_attached} , [#S] }"
# window status bar
set -g status-style bg=black,fg=white
# + flag when zoomed in
set -g window-status-format ' #I:#W#{?window_zoomed_flag,+ , }'
# blue bg on current window
set -g window-status-current-format '#[bg=blue,fg=black] #I:#W#{?window_zoomed_flag,+ , }'
set -g window-status-separator ''
# status right user@host | date, time
set -g status-right "#{?window_bigger,[#{window_offset_x}#,#{window_offset_y}] ,}#{client_user}@#H | %a %b %d, %H:%M"
# dark blue message bg
set -g message-style bg=#4571a2,fg=white
set -g set-titles on
set -g set-titles-string "tmux: [#S#{?session_many_attached,+,}] #I-#W"
# borders
set -g pane-border-lines heavy
set -g pane-border-status top
set -g pane-border-indicators off
# show pane title (- if default name)
# blue bg on active pane, red if prefix active
# brackets on title when zoomed
set -g pane-border-format "#{?pane_active,#{?client_prefix,#[bg=red#,fg=black],#[bg=blue#,fg=black]},#[fg=blue]}#{?window_zoomed_flag, [ , }#{?#{==:#T,#H},-,#T}#{?window_zoomed_flag, ] , }"
set -g pane-border-style default
set -g pane-active-border-style fg=#4571a2
set -g mode-style bg=#4571a2
### bindings
# split window
unbind v
unbind h
bind v split-window -h -c "#{pane_current_path}"
bind h split-window -v -c "#{pane_current_path}"
# reload config
unbind r
bind r source-file ~/.config/tmux/tmux.conf \; display 'Config reloaded'
# pane selection
bind -T root C-h select-pane -L
bind -T root C-j select-pane -D
bind -T root C-k select-pane -U
bind -T root C-l select-pane -R
# resize pane
bind -r H resize-pane -L 5
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 5
bind m resize-pane -Z
# detach (sends signal to parent process to exec shell)
unbind d
bind d run 'sh-tmux -d'
set -g update-environment SH_TMUX_PID
### settings
set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",*256col*:Tc"
set -sg escape-time 0
set -g history-limit 50000
set -g display-time 4000
set -g status-interval 1
setw -g aggressive-resize on
set -g mouse on
setw -g mode-keys vi
setw -g status-keys emacs
# start indices at 1
set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on
# copy mode
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send -X copy-selection
unbind -T copy-mode-vi MouseDragEnd1Pane
# use arrow keys when scrolling on certain commands
tmux_commands_with_legacy_scroll="nano less more man git"
bind -T root WheelUpPane \
if-shell -Ft= '#{?mouse_any_flag,1,#{pane_in_mode}}' \
'send -Mt=' \
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
"send -t= Up Up Up" "copy-mode -et="'
bind -T root WheelDownPane \
if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \
'send -Mt=' \
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
"send -t= Down Down Down" "send -Mt="'
### plugins
#set -g @plugin 'tmux-plugins/tpm'
#set -g @plugin 'christoomey/vim-tmux-navigator'
#set -g @plugin 'tmux-plugins/tmux-sessionist'
#run '~/.config/tmux/plugins/tpm/tpm'