-
Notifications
You must be signed in to change notification settings - Fork 5
/
.tmux.conf
executable file
·149 lines (114 loc) · 4.73 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# =================================================
# Author :tracyone
# Url :https://github.com/tracyone/dotfiles
# Email :[email protected]
# =================================================
is_macos='uname | grep -qi Darwin'
is_linux='uname | grep -qi Linux'
no_display="test -z $DISPLAY"
# status bar
set -g status-interval 1
set -g status-justify right # center align window list
set -g status-left-length 20
set -g status-right-length 140
set -g status-left '#(date +%y%m%d\ %%H:%%M:%%S)'
set -g status-right ''
#Tab
setw -g window-status-current-format "#[bg=black]#[fg=brightred]*#I #[fg=brightred,bold]#[bg=black][#W]"
set-window-option -g window-status-current-attr bright
# default statusbar colors
set -g status-fg white
set -g status-bg default
set -g status-attr bright
# Use emacs / readline key-bindings at the tmux command prompt `<prefix>:`
set -g status-keys emacs
bind -r ( switch-client -p
bind -r ) switch-client -n
# resize pane
bind H resize-pane -L 5
bind J resize-pane -D 5
bind K resize-pane -U 5
bind L resize-pane -R 5
# default window title colors
set-window-option -g window-status-fg white
set-window-option -g window-status-bg default
set-window-option -g window-status-attr dim
# active window title colors
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-bg default
set-window-option -g window-status-current-attr bright
# C-b is not acceptable -- Vim uses it
set-option -g prefix C-a
bind-key C-a last-window
# Start numbering at 1
set -g base-index 1
# Allows for faster key repetition
set -s escape-time 0
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
setw -g aggressive-resize on
# This allows using the mouse to resize panes; note that there is no change in
# mouse cursor when hover over a pane divider as one might expect (everything
# still works though).
##
#
#
setw -g mouse off
# Allows us to use C-a a <command> to send commands to a TMUX session inside
# another TMUX session
bind-key a send-prefix
# Activity monitoring
setw -g monitor-activity on
set -g visual-activity on
# Highlight active window
set-window-option -g window-status-current-bg red
# Highlight active pane
set-option -g pane-active-border-fg red
# Vi copypaste mode
set-window-option -g mode-keys vi
# os x
if-shell "$is_macos" 'set-option -g default-command "reattach-to-user-namespace -l zsh"'
if-shell "$is_macos" 'bind-key -Tcopy-mode-vi 'y' send -X copy-pipe "reattach-to-user-namespace pbcopy"'
if-shell "$is_macos" 'bind-key -Tcopy-mode-vi Enter send -X copy-pipe "reattach-to-user-namespace pbcopy"'
if-shell "$is_macos" 'bind ] run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"'
# Linux
if-shell "$is_linux " 'bind-key -T copy-mode-vi 'y' send -X copy-pipe "xclip -sel clip -i"'
bind-key -T copy-mode-vi 'v' send -X begin-selection
if-shell "$no_display" 'bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel'
# hjkl pane traversal
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# reload config
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
# auto window rename
set-window-option -g automatic-rename
setw -g automatic-rename on # rename window to reflect current program
set -g set-titles on # set terminal title
set -g set-titles-string '#h ❐ #S ● #I #W'
# color
set-option -ga terminal-overrides ",xterm-256color:Tc"
set -g default-terminal "screen-256color"
# + and - now "zoom" in and out of a pane (e.i., temporarily maximize it)
unbind +
bind + new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' \; swap-pane -s tmux-zoom.0 \; select-window -t tmux-zoom
unbind -
bind _ last-window \; swap-pane -s tmux-zoom.0 \; kill-window -t tmux-zoom
bind-key c-K confirm-before -p "Kill Session #S (y/n)?" "run-shell 'tmux switch-client -l \\\; kill-session -t \"\$(tmux display-message -p \"#S\")\"'"
# | and _ are now used for splitting windows into panes
unbind %
bind \ split-window -h
bind - split-window -v
bind M setw -g mouse off \; display "Mouse OFF!"
bind m setw -g mouse on \; display "Mouse ON!"
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"'
bind -n m-h if-shell "$is_vim" "send-keys m-h" "select-pane -L"
bind -n m-j if-shell "$is_vim" "send-keys m-j" "select-pane -D"
bind -n m-k if-shell "$is_vim" "send-keys m-k" "select-pane -U"
bind -n m-l if-shell "$is_vim" "send-keys m-l" "select-pane -R"
bind -n m-w if-shell "$is_vim" "send-keys m-w" "select-pane -l"
bind -n c-q clear-history
set -g @plugin 'tmux-plugins/tmux-resurrect'
run '~/.tmux/plugins/tpm/tpm'