Xinqi Bao's Git

feat(nvim): add markdown-preview plugin
[dotfiles.git] / .tmux.conf
1 # Terminal and colors
2 set -g default-terminal 'xterm-256color'
3 set -g set-clipboard on
4 set -g allow-passthrough on
5
6 # General settings
7 set -g history-limit 50000
8 set -g mouse on
9 set -g escape-time 0
10 set -g focus-events on
11 set -g base-index 1
12 set -g pane-base-index 1
13 set -g renumber-windows off
14
15 # Remap prefix from C-b to C-a
16 unbind C-b
17 set -g prefix C-a
18 bind C-a send-prefix
19
20 # Window and pane management
21 bind c new-window -c "${HOME}"
22 bind | split-window -h -c "#{pane_current_path}"
23 bind - split-window -v -c "#{pane_current_path}"
24 bind C-a last-window
25 unbind '"'
26 unbind %
27
28 # Status bar
29 set -g status-position bottom
30 set -g status-justify left
31 set -g status-interval 2
32 set -g status-style fg=colour137,bg=colour234,dim
33 set -g status-left ''
34 set -g status-left-length 20
35 set -g status-right '#[fg=colour233,bg=colour245,bold] %H:%M #[fg=colour233,bg=colour253,bold] %m-%d '
36 set -g status-right-length 50
37
38 # Window status
39 set -g window-status-current-style fg=colour69,bg=colour253,bold
40 set -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour233]#W#[fg=colour69]#F '
41 set -g window-status-style fg=colour131,bg=colour245,none
42 set -g window-status-format ' #I#[fg=colour237]:#[fg=colour233]#W#[fg=colour131]#F '
43 set -g window-status-bell-style fg=colour255,bg=colour1,bold
44
45 # Pane borders
46 set -g pane-border-style fg=colour238,bg=colour235
47 set -g pane-active-border-style fg=colour51,bg=colour236
48
49 # Messages
50 set -g message-style fg=colour232,bg=colour166,bold
51 set -g message-command-style fg=blue,bg=black
52
53 # Clock mode
54 set -g clock-mode-colour colour135
55 set -g mode-style fg=colour196,bg=colour238,bold
56
57 # Quiet mode
58 set -g visual-activity off
59 set -g visual-bell off
60 set -g visual-silence off
61 set -g bell-action other
62 set -g monitor-activity off
63 set -g monitor-bell on
64
65 # Vi copy mode
66 set -g mode-keys vi
67 bind -T copy-mode-vi v send-keys -X begin-selection
68 bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
69
70 # Reload config
71 bind r source-file ~/.tmux.conf \; display-message "Config reloaded"
72
73 # Vim-tmux-navigator: smart pane switching with vim awareness
74 # https://github.com/christoomey/vim-tmux-navigator
75 is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
76 bind -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
77 bind -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
78 bind -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
79 bind -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
80 bind -n 'C-\' if-shell "$is_vim" 'send-keys C-\\' 'select-pane -l'
81
82 bind -T copy-mode-vi 'C-h' select-pane -L
83 bind -T copy-mode-vi 'C-j' select-pane -D
84 bind -T copy-mode-vi 'C-k' select-pane -U
85 bind -T copy-mode-vi 'C-l' select-pane -R
86 bind -T copy-mode-vi 'C-\' select-pane -l