161 lines
6 KiB
Bash
161 lines
6 KiB
Bash
################################################################################
|
|
# Options
|
|
################################################################################
|
|
set -g base-index 1 # start window numbering from 1
|
|
set -g history-limit 20000 # remember longer history
|
|
set -gs escape-time 50 # avoid delays with ESC in vim
|
|
set -gs repeat-time 1000 # allow 1 second for multiple commands
|
|
set -s focus-events on # pass focus events from terminal to applications
|
|
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
|
|
|
|
set -g prefix C-space
|
|
|
|
################################################################################
|
|
# Key bindings
|
|
################################################################################
|
|
unbind C-b
|
|
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.
|
|
|
|
################################################################################
|
|
# Style
|
|
################################################################################
|
|
%hidden transparent_color="#131516"
|
|
%hidden bg_color="#1d2021"
|
|
%hidden fg_color="#a89984"
|
|
%hidden prefix_color="#b57614"
|
|
%hidden dimmed_color="#7c6f64"
|
|
%hidden highlight_color="#427b58"
|
|
%hidden active_color="#076678"
|
|
|
|
%hidden prefix_hl="#{?client_prefix,#[fg=${prefix_color}],}"
|
|
|
|
%hidden inactive_begin=" #[default]"
|
|
%hidden inactive_end="#[default] "
|
|
|
|
%hidden active_begin="#[fg=${transparent_color} bg=${bg_color}]#[fg=default bg=${transparent_color}] "
|
|
%hidden active_end=" #[fg=${transparent_color} bg=${bg_color}]"
|
|
|
|
%hidden inactive_index="#[fg=${dimmed_color}]${prefix_hl}#{?window_last_flag,#[fg=${highlight_color}],}"
|
|
%hidden active_index="#[fg=${highlight_color}]"
|
|
|
|
%hidden inactive_name="#[default]"
|
|
%hidden active_name="#[fg=${active_color}]"
|
|
|
|
%hidden flags="#[fg=${dimmed_color}] #{?pane_synchronized, ,}#{?window_marked_flag, ,}#{?window_zoomed_flag, ,}"
|
|
|
|
set -g pane-border-style "fg=black"
|
|
set -g pane-active-border-style "fg=brightblue"
|
|
|
|
set -g message-style "fg=${fg_color} bg=${bg_color}"
|
|
set -g message-command-style "fg=${highlight_color} bg=${bg_color}"
|
|
|
|
set -g status-style "fg=${fg_color} bg=${bg_color}"
|
|
|
|
set -g status-left-length 10
|
|
set -g status-left " ${prefix_hl} "
|
|
|
|
set -g status-right-length 64
|
|
set -g status-right "\
|
|
${active_begin}${prefix_hl} #{session_name}${active_end}\
|
|
${inactive_begin}${prefix_hl} #{host_short}${inactive_end}"
|
|
|
|
set -g window-status-separator ""
|
|
set -g status-justify left
|
|
|
|
set -g window-status-format "\
|
|
${inactive_begin}\
|
|
${inactive_index}#{window_index} \
|
|
${inactive_name}#{window_name}\
|
|
${flags}\
|
|
${inactive_end}"
|
|
|
|
set -g window-status-current-format "\
|
|
${active_begin}\
|
|
${active_index}#{window_index} \
|
|
${active_name}#{window_name}\
|
|
${flags}\
|
|
${active_end}"
|