-
Notifications
You must be signed in to change notification settings - Fork 8
/
tmux.conf
executable file
·131 lines (107 loc) · 5.48 KB
/
tmux.conf
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# tmux.conf
#
# Initialize TPM (Tmux Plugin Manager)
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @cpu_interval 5
unbind l
unbind s
# window index start with 1
set -g base-index 1
setw -g pane-base-index 1
# set -g default-shell /usr/bin/zsh
# For server
# if-shell -b "[[ $(whoami) | grep -q root ]]" "unbind C-b; set -g prefix C-w"
set -g automatic-rename on
set -g automatic-rename-format '#{b:pane_current_path}'
set-option -g set-titles on
set -g status-keys vi
set -g history-limit 1000000
setw -g mode-keys vi
set -g mouse on
set -g focus-events on
set -g status-keys vi
setw -g monitor-activity on
setw -g visual-activity on
setw -g aggressive-resize on
set -g default-terminal tmux-256color
setw -g alternate-screen on
bind-key -n WheelUpPane if-shell -Ft= "#{?pane_in_mode,1,#{alternate_on}}" "send-keys -M" "copy-mode"
# bind-key -r c new-window
# bind-key -r s split-window -v
# bind-key -r v split-window -h
bind -r c new-window -c '#{pane_current_path}'
bind -r s split-window -v -c '#{pane_current_path}'
bind -r v split-window -h -c '#{pane_current_path}'
# bind-key -r c new-window -c $PWD
# bind-key -r s split-window -c $PWD -v
# bind-key -r v split-window -c $PWD -h
bind-key -r a setw synchronize-panes \; display "synchronize-panes #{?pane_synchronized,on,off}"
bind-key -r C-j resize-pane -D 5
bind-key -r C-k resize-pane -U 5
bind-key -r C-h resize-pane -L 5
bind-key -r C-l resize-pane -R 5
bind-key -r M-j resize-pane -D 5
bind-key -r M-k resize-pane -U 5
bind-key -r M-h resize-pane -L 5
bind-key -r M-l resize-pane -R 5
# Vim style pane selection
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Use Alt-vim keys without prefix key to switch panes
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
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
bind -n MouseDown1StatusLeft new-window
# No delay for escape key press
set -sg escape-time 0
# Reload tmux config
unbind r
bind r source-file ~/.tmux.conf
# copy
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel "xsel -i -p && xsel -o -p | xsel -i -b" # for Linux
bind-key p run "xsel -o | tmux load-buffer - ; tmux paste-buffer" # for Linux
# bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel "pbcopy" # for mac OS
# THEME
## set the default TERM
# set -g default-terminal screen
## update the TERM variable of terminal emulator when creating a new session or attaching a existing session
set -g update-environment 'DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY TERM'
## determine if we should enable 256-colour support
if-shell "[[ ${TERM} =~ 256color || ${TERM} == fbterm ]]" 'set -g default-terminal screen-256color'
set-option -sa terminal-overrides ",${TERM}:RGB"
# set -g pane-border-format "#(ps --no-headers -t #{pane_tty} -o args kstart_time | grep -v '^-.*' | head -n 1)"
set -g pane-border-status "off"
set -g pane-border-format "[#[fg=white]#{?pane_active,#[bold],} :#P: #T #[fg=default,nobold]]"
set -g default-command "${SHELL}" # for Linux
set -g pane-active-border-style "bg=cyan,fg=black"
set -g status on
set -g status-bg colour234
set -g status-interval 1
set -g status-justify left
set -g status-left "#[fg=green,bg=#303030][#S:#I.#P]#[fg=#303030]#[fg=brightcyan]#{pane_current_path}#[fg=#303030]#[fg=magenta]#(cd #{pane_current_path}; git rev-parse --abbrev-ref HEAD)#[fg=#303030]"
set -g status-left-length 180
set -g status-position bottom
set -g @check_gpu "lspci | grep -E 'VGA|3D' | grep -E 'NVIDIA|AMD'"
if-shell -b "#{@check_gpu}" \
'set -g status-right "#[bg=colour234]#[fg=#303030]#[bg=#303030] #[fg=default]LA: #(cut -d\" \" -f-3 /proc/loadavg) #[fg=colour236]#[fg=color253]#[bg=colour236] CPU: #{cpu_fg_color}#{cpu_percentage} #{cpu_temp_fg_color}#{cpu_temp} #[fg=color253]RAM: #{ram_fg_color}#{ram_percentage}#[fg=colour238] #[fg=colour254]#[bg=colour238] GPU: #{gpu_fg_color}#{gpu_percentage} #{gpu_temp_fg_color}#{gpu_temp} #[fg=colour254]VRAM: #{gram_fg_color}#{gram_percentage}#[fg=colour254] #[fg=colour240]#[fg=colour255]#[bg=colour240] %Y/%m/%d(%a) %H:%M:%S #[fg=#303030]#[bg=#303030]#(sh $HOME/.tmux-kube 250 green brightcyan)"' \
'set -g status-right "#[bg=colour234]#[fg=#303030]#[bg=#303030] #[fg=default]LA: #(cut -d\" \" -f-3 /proc/loadavg) #[fg=colour236]#[fg=color253]#[bg=colour236] CPU: #{cpu_fg_color}#{cpu_percentage} #{cpu_temp_fg_color}#{cpu_temp} #[fg=color253]RAM: #{ram_fg_color}#{ram_percentage}#[fg=colour254] #[fg=colour240]#[fg=colour255]#[bg=colour240] %Y/%m/%d(%a) %H:%M:%S #[fg=#303030]#[bg=#303030]#(sh $HOME/.tmux-kube 250 green brightcyan)"'
set -g status-right-length 180
set -g status-style "bg=black,fg=white"
set -g window-status-current-format '#[fg=colour239]#[bg=#303030]#{?client_prefix,#[fg=color3],}#[bg=colour239]#{?client_prefix,#[bg=colour3],}#[fg=colour119] I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249] #F#[fg=colour239]#[bg=colour234]#{?client_prefix,#[fg=color3],}'
set -g window-status-current-style "bg=cyan,fg=black"
set -g window-status-format '#I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
# set-environment -g PATH "/opt/homebrew/bin:/usr/local/bin:/bin:/usr/bin"
run -b '~/.tmux/plugins/tpm/tpm'