dotfiles/cli/tmux/tmux.conf
2023-01-14 10:25:07 +08:00

99 lines
3.1 KiB
Plaintext

############################
# general
############################
# set -g set-clipboard on # rely on xterm sequence
set -g default-terminal "screen-256color"
set -s escape-time 0
set -g base-index 1
set -g pane-base-index 1
set-option -g mouse on
#set-option -g mouse-select-pane on
set-option -g display-time 4000
set-option -g set-titles on
set-option -g set-titles-string "#S / #W"
############################
# keybindings
############################
setw -g mode-keys vi
set -g status-keys vi
set -g default-shell /usr/bin/fish
# set -g prefix C-h
bind c new-window -c '#{pane_current_path}'
bind '"' split-window -c '#{pane_current_path}'
bind % split-window -h -c '#{pane_current_path}'
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind a set-window-option automatic-rename
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
bind m \
set-option -g mouse on \;\
display 'Mouse: ON'
# set mouse off with prefix M
bind M \
set-option -g mouse off \;\
display 'Mouse: OFF'
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
bind -n M-H resize-pane -L 10
bind -n M-J resize-pane -D 10
bind -n M-K resize-pane -U 10
bind -n M-L resize-pane -R 10
bind -n M-0 select-window -t :=0
bind -n M-1 select-window -t :=1
bind -n M-2 select-window -t :=2
bind -n M-3 select-window -t :=3
bind -n M-4 select-window -t :=4
bind -n M-5 select-window -t :=5
bind -n M-6 select-window -t :=6
bind -n M-7 select-window -t :=7
bind -n M-8 select-window -t :=8
bind -n M-9 select-window -t :=9
bind -n M-n next-window
bind -n M-p previous-window
bind -n M-N swap-window -t +1 \; next-window
bind -n M-P swap-window -t -1 \; previous-window
bind -n M-[ copy-mode
bind -n M-] paste-buffer
############################
# plugins
############################
set -g @yank_action 'copy-pipe'
set -g @plugin 'tmux-plugins/tmux-yank'
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone --depth 1 https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# prefix + I
# plugins dir: ~/.tmux/plugins/
run -b '~/.tmux/plugins/tpm/tpm'
############################
# appearance
############################
run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | cut -c 6- | sed 's/[a-z]//g')"
if-shell -b '[ "$(echo "$TMUX_VERSION > 2.8" | bc)" = 1 ]' \
"source ~/.config/tmux/tmux2.9.conf" \
"source ~/.config/tmux/tmux2.8.conf"
# statusbar
set -g status-left "#[bg=colour4,fg=colour7] #S #[bg=default]"
set -g automatic-rename on
set -g automatic-rename-format '#{b:pane_current_path}'
set -g window-status-format ' #I:#W#F '
set -g window-status-current-format ' #I:#W#F '
set -g window-status-separator ""
set -g window-status-current-style "bg=black,fg=white"
set -g status-interval 5
#set -g status-right-length 80
#set -g status-right '#[fg=white,bg=red] prefix: C-h #[fg=black,bg=colour14,bold]#{simple_git_status}#[fg=colour14,bg=black] #(echo $USER)@#H #[fg=colour7,bg=colour4] %Y-%m-%d %H:%M '
set -g status-right '#[fg=white] #(echo $USER)@#H '
set -g status-right-length 30