Various changes to desktop configuration

This commit is contained in:
2026-02-22 08:50:34 +08:00
parent 740297097b
commit aeffcee52f
9 changed files with 1972 additions and 1 deletions

View File

@@ -0,0 +1,61 @@
unbind C-b
set -g prefix C-a
bind C-a send-prefix
bind -n M-h previous-window
bind -n M-l next-window
unbind x
bind x kill-pane
unbind &
bind & kill-window
set -g default-terminal "tmux-256color"
set -as terminal-overrides ',*:Tc'
set -g detach-on-destroy off
set -g renumber-windows on
set -g base-index 1
setw -g pane-base-index 1
set -g status-position top
set -g status on
set -g status-style "bg=default,fg=white"
set -g status-left ""
set -g status-right ""
set -g status-justify centre
set -g window-status-format "#I: #W"
set -g window-status-current-format "#I: #W"
set -g window-status-separator " "
set -g status-interval 5
set -g pane-border-style "fg=colour240"
set -g pane-active-border-style "fg=white"
set -g mouse on
set -g history-limit 10000
setw -g automatic-rename on
# neovim tmux navigator
vim_pattern='(\S+/)?g?\.?(view|l?n?vim?x?|fzf)(diff)?(-wrapped)?'
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +${vim_pattern}$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l