Xinqi Bao's Git

a5aff0c1027c4b78c832027cb4a6e82ceff1ddd2
[dotfiles.git] / .tmux.conf
1 # Improve colours
2 set -g default-terminal 'xterm-256colour'
3
4 # Set scrollback buffer to 10000
5 set -g history-limit 10000
6
7 # remap prefix from 'C-b' to 'C-z'
8 unbind C-b
9 set-option -g prefix C-a
10 bind-key C-a send-prefix
11
12 # split panes using | and -
13 bind | split-window -h
14 bind - split-window -v
15 bind-key C-a last-window
16 unbind '"'
17 unbind %
18
19 ## Status bar design
20 # status line
21 set -g status-justify left
22 set -g status-interval 2
23
24 # loud or quiet?
25 set-option -g visual-activity off
26 set-option -g visual-bell off
27 set-option -g visual-silence off
28 set-window-option -g monitor-activity off
29 set-option -g bell-action none
30
31 set -g default-terminal "screen-256colour"
32
33
34 # The modes {
35 setw -g clock-mode-colour colour135
36 setw -g mode-style fg=colour196,bg=colour238,bold
37 # }
38
39
40 # The panes {
41 set -g pane-border-style fg=colour238,bg=colour235
42 set -g pane-active-border-style fg=colour51,bg=colour236
43 # }
44
45
46 # The statusbar {
47 set -g status-position bottom
48 set -g status-style fg=colour137,bg=colour234,dim
49
50 set -g status-left ''
51 set -g status-left-length 20
52
53 set -g status-right '#[fg=colour233,bg=colour245,bold] %H:%M #[fg=colour233,bg=colour253,bold] %m-%d '
54 set -g status-right-length 50
55
56 setw -g window-status-current-style fg=colour69,bg=colour253,bold
57 setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour233]#W#[fg=colour69]#F '
58
59 setw -g window-status-style fg=colour131,bg=colour245,none
60 setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour233]#W#[fg=colour131]#F '
61
62 setw -g window-status-bell-style fg=colour255,bg=colour1,bold
63 # }
64
65
66 # The messages {
67 set -g message-style fg=colour232,bg=colour166,bold
68 set -g message-command-style fg=blue,bg=black
69 # }
70
71 # Smart pane switching with awareness of Vim splits.
72 # See: https://github.com/christoomey/vim-tmux-navigator{
73 is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
74 | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
75 bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
76 bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
77 bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
78 bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
79 tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
80 if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
81 "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
82 if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
83 "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
84
85 bind-key -T copy-mode-vi 'C-h' select-pane -L
86 bind-key -T copy-mode-vi 'C-j' select-pane -D
87 bind-key -T copy-mode-vi 'C-k' select-pane -U
88 bind-key -T copy-mode-vi 'C-l' select-pane -R
89 bind-key -T copy-mode-vi 'C-\' select-pane -l
90 # }
91
92 #enable powerline for tmux
93 #source /usr/lib/python3.8/site-packages/powerline/bindings/tmux/powerline.conf