-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf.linux
115 lines (91 loc) · 4.72 KB
/
.tmux.conf.linux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# 0 is too far from ` ;)
set -g base-index 1
set-window-option -g pane-base-index 1
unbind C-a
setw -g mode-keys vi
set -g prefix C-a
set -g status-left-length 52
set -g status-right-length 451
# set -g status-fg white
# set -g status-bg colour234
# issue: https://github.com/tmux/tmux/issues/1688
set -g window-status-activity-style bold
set -g pane-border-style fg=colour245
set -g pane-active-border-style fg=colour39
set -g message-style fg=colour16
set -g message-style bg=colour221
set -g message-style bold
# lose vim colorscheme in tmux mode
# https://stackoverflow.com/questions/10158508/lose-vim-colorscheme-in-tmux-mode
set -g default-terminal "xterm-256color"
set -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S #[fg=colour252,bg=colour238,nobold] 🍺 #[fg=colour245,bg=colour238,bold] Liang Zheng #[fg=colour238,bg=colour234,nobold] ☞ '
set -g status-right '#[fg=green,bg=default,bright]#(tmux-mem-cpu-load) #[fg=red,dim,bg=default]#(uptime | cut -f 4-5 -d " " | cut -f 1 -d ",") #[fg=white,bg=default]%a%l:%M:%S %p#[default] #[fg=blue]%Y-%m-%d'
set -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S #[fg=colour252,bg=colour238,nobold]⮀#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold]⮀'
set -g window-status-format "#[fg=white,bg=colour234] #I #W "
set -g window-status-current-format "#[fg=colour234,bg=colour39] ❐ #[fg=colour25,bg=colour39,noreverse,bold] #I #W #[fg=colour39,bg=colour234,nobold] "
# increase scrollback lines
set -g history-limit 100000
set-window-option -g mode-keys vi
# TODO(zhengliang): fix it
# https://stackoverflow.com/questions/22831366/tmux-exited-on-startup
# set-option -g default-command "reattach-to-user-namespace -l zsh"
bind r source-file ~/.tmux.conf \; display "Reloaded config"
# # Rebind prefix to b
# bind B set -g prefix ^b
# bind A set -g prefix ^a
# Setup 'v' to begin selection as in Vim
unbind -T copy-mode-vi v
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
unbind -T copy-mode-vi y
# macOS 'reattach-to-user-namespace' wrapper no longer required in tmux 2.6
bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel pbcopy
bind-key p paste-buffer
# Setup mouse to copy selection on drag
bind-key -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel pbcopy
# Update default binding of `Enter` to also use copy-pipe-and-cancel
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send -X copy-pipe-and-cancel pbcopy
# Bind ']' to use pbpaste
bind-key -T copy-mode-vi ] send -X "pbpaste | tmux load-buffer - && tmux paste-buffer"
# # Smart pane switching with awareness of Vim splits.
# # See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
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"
# 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
# # Smart pane switching with awareness of Vim splits.
# # See: https://github.com/christoomey/vim-tmux-navigator
# is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
# | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
# bind-key -n 'C-x' if-shell "$is_vim" 'send-keys C-x' '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-x' 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
bind-key v split-window -h
bind-key s split-window -v
bind-key J resize-pane -D 5
bind-key K resize-pane -U 5
bind-key H resize-pane -L 5
bind-key L resize-pane -R 5
# set -g pane-border-fg green
# set -g pane-border-bg black
# set -g pane-active-border-fg white
# set -g pane-active-border-bg yellow