dotfiles/config/tmux/tmux.conf

143 lines
5.2 KiB
Bash

set -g prefix C-space
#
# Key bindings
#
bind C-space send-prefix
bind R source-file "$XDG_CONFIG_HOME/tmux/tmux.conf"\; display "RELOADED"
bind v copy-mode
bind P choose-buffer "paste-buffer -b '%%' -s ''"
bind p paste-buffer -s ''
bind C command-prompt -p 'Save pane history:' \
-I '~/tmux.history' \
'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
# Window/pane management (new windows/panes use the path in current pane)
bind c new-window -c '#{pane_current_path}'
bind C-v split-window -h -c '#{pane_current_path}'
bind M-v split-window -h -c '#{pane_current_path}' -f
bind C-s split-window -v -c '#{pane_current_path}'
bind M-s split-window -v -c '#{pane_current_path}' -f
bind x kill-pane
bind X kill-window
bind w choose-tree -Z
bind W command-prompt 'rename-window %%'
bind S command-prompt 'rename-session %%'
bind s set synchronize-panes
# Move around
bind . next-window
bind , previous-window
bind / last-window
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -r C-h select-pane -L
bind -r C-j select-pane -D
bind -r C-k select-pane -U
bind -r C-l select-pane -R
# Resize panes
bind -r Left resize-pane -L 1
bind -r Down resize-pane -D 1
bind -r Up resize-pane -U 1
bind -r Right resize-pane -R 1
bind -r S-Left resize-pane -L 10
bind -r S-Down resize-pane -D 10
bind -r S-Up resize-pane -U 10
bind -r S-Right resize-pane -R 10
# Arrangement of panes & windows
bind b break-pane -d
bind B break-pane
bind H join-pane -h -b \; select-pane -M
bind J join-pane -v \; select-pane -M
bind K join-pane -v -b \; select-pane -M
bind L join-pane -h \; select-pane -M
bind C-p swap-pane \; select-pane -M
bind -r > swap-window -d -t :+
bind -r < swap-window -d -t :-
# Choosing layouts
bind -r C-y set main-pane-width 50% \; set main-pane-height 50% \; next-layout
bind -r C-o rotate-window -D
bind -r C-i rotate-window -U
# Copy mode
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-selection
unbind -T copy-mode-vi MouseDragEnd1Pane # Stay in copy mode on drag end.
#
# General
#
set -s focus-events on # pass focus events from terminal to applications
set -gs escape-time 50 # avoid delays with ESC in vim
set -gs repeat-time 1000 # allow 1 second for multiple commands
set -g base-index 1 # start window numbering from 1
set -g history-limit 20000 # remember longer history
setw -g automatic-rename on # automatically rename windows
setw -g mouse on # enable mouse support
setw -g pane-base-index 1 # start pane numbering from 1
# Start non-login shells for new panes/windows.
# https://wiki.archlinux.org/title/Tmux#Start_a_non-login_shell
set -g default-command "${SHELL}"
# Set $TERM, force 256 colors, and enable italics.
# https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-a-256-colour-terminal
# https://github.com/tmux/tmux/wiki/FAQ#i-dont-see-italics-or-italics-and-reverse-are-the-wrong-way-round
set -g default-terminal 'tmux-256color'
# Report true color support to programs.
# https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-rgb-colour
set -ga terminal-overrides ',*-256col*:Tc'
# The shell will increment SHLVL by one when it is started -> unsetting this
# variable here removes any memory of nesting before tmux was executed and will
# cause shells to start with level 1 again within the session.
set-environment -gu SHLVL
#
# Style (status list, colors, ...)
#
background="#1d2021"
highlight="#b57614"
current_badge="#076678"
current_bg="#003848"
current_fg="#83a598"
window_badge="#504945"
window_fg="#7c6f64"
set -g pane-border-style fg=black
set -g pane-active-border-style fg=brightblue
set -g message-style fg=brightwhite,bg=black
set -g message-command-style fg=yellow,bg=black
set -g status-style bg=${background}
set -g status-justify left
set -g status-left ""
flags="#{?pane_synchronized,󰵉 ,}#{?window_marked_flag,󰄵 ,}#{?window_zoomed_flag, ,}"
setw -g window-status-format "\
#[fg=${background} bg=#{?client_prefix,${highlight},${window_badge}} bold] #{window_index} \
#[fg=#{?window_last_flag,${current_fg},${window_fg}} bg=${background} nobold] #{window_name} ${flags}\
#[default] "
setw -g window-status-current-format "\
#[fg=${background} bg=#{?client_prefix,${highlight},${current_badge}} bold] #{window_index} \
#[fg=${current_fg} bg=${current_bg} nobold] #{window_name} ${flags}\
#[default] "
box_begin="#[fg=${background} bg=#{?client_prefix,${highlight},${window_badge}} bold] "
box_mid="#[fg=${window_fg} bg=${background} nobold]"
box_end="#[default]"
set -g status-right-length 64
set -g status-right "\
${box_begin}󰈷 ${box_mid} #{pane_id} ${box_end} \
${box_begin}${box_mid} #{session_name} ${box_end} \
${box_begin}${box_mid} #{pid} ${box_end} \
${box_begin}󱡶 ${box_mid} #{host_short} ${box_end}"