dotfiles/config/tmux/tmux.conf

133 lines
5.1 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, ...)
#
set -g status-left ' ' # 󰄴 󰣕 󰬫 󰻃 󰪥 󰬪    󰡖 󰄱
set -g status-right '\
#[fg=brightblack] \
#{?client_prefix,#[fg=brightyellow],#[fg=brightblack]}#{pane_id}\
#[fg=brightblack]  \
#{?client_prefix,#[fg=brightyellow],#[fg=brightblack]}#{session_name}\
#[fg=brightblack]  \
#{?client_prefix,#[fg=brightyellow],#[fg=brightblack]}#{pid} @ #{host_short} '
setw -g window-status-current-format '\
#{?client_prefix,#[fg=brightyellow],#[fg=brightcyan]}#{window_index} \
#[bold]#[fg=blue]#{window_name}#[nobold] \
#{?client_prefix,#[fg=brightyellow],#[fg=brightcyan]}\
#{?pane_synchronized,󰵉 ,}#{?window_marked_flag,󰄵 ,}#{?window_zoomed_flag, ,}\
#[fg=brightblack]'
setw -g window-status-format '\
#{?client_prefix,#[fg=brightyellow],#{?window_last_flag,#[fg=cyan],#[fg=brightblack]}}\
#{window_index} \
#[fg=brightblack]#{window_name} \
#{?pane_synchronized,󰵉 ,}#{?window_marked_flag,󰄵 ,}#{?window_zoomed_flag, ,}\
#[fg=brightblack]'
set -g status-justify left
set -g status-style fg=white,bg=black
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