dotfiles/tmux.conf
2020-06-20 10:37:10 +08:00

97 lines
3.0 KiB
Plaintext

############################
# general
############################
set -g set-clipboard on
set -g default-terminal "xterm-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
############################
# keybindings
############################
setw -g mode-keys vi
set -g status-keys vi
# set -g prefix C-h
bind-key c new-window -c '#{pane_current_path}'
bind-key '"' split-window -c '#{pane_current_path}'
bind-key % 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 -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 20
bind -n M-J resize-pane -D 10
bind -n M-K resize-pane -U 10
bind -n M-L resize-pane -R 20
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 r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
bind -n M-[ copy-mode
bind -n M-] paste-buffer
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'
############################
# plugins
############################
set -g @yank_action 'copy-pipe'
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# tmux source ~/.tmux.conf
# prefix + I
# plugins dir: ~/.tmux/plugins/
#set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'kristijanhusak/tmux-simple-git-status'
set -g @plugin 'klesh/tmux-open'
set -g @plugin 'tmux-plugins/tmux-copycat'
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=black,bg=colour14,bold]#{simple_git_status}'