-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
149 lines (124 loc) · 4.85 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
# create a new session if none exists
# breaks reload... need better solution
## new-session
##set-option -g default-command "reattach-to-user-namespace -l bash" # this causes iterm2 to break 2020/01/13
set-option -g mouse on
# bind to control-t
unbind C-b
set-option -g prefix C-t
bind-key C-t last-window
# fix delay with insert/command mode with vim
set-option -sg escape-time 0
# set base window numbering
set-option -g base-index 1
# set base pane numbering
set-option -g pane-base-index 1
# reload config
bind-key r source-file ~/.tmux.conf \; \
display-message "sourcing ~/.tmux.conf... done"
# set default terminal
set-option -g default-terminal "screen-256color"
bind-key -n S-up copy-mode
bind-key -n S-down new-window
bind-key -n S-left prev
bind-key -n S-right next
set-window-option -g xterm-keys off
set-option -g terminal-overrides 'xterm*:smcup@:rmcup@'
# example of 70/{20/80} dual split -- nice for logs, shell and editor
# bind y selectp -t0 \; splitw -h -p 30 \; selectp -t 1 \; splitw -v -p 80 \; selectp -t 0
# buffer commands
unbind [
bind-key Escape copy-mode
unbind p
bind-key p paste-buffer
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe "reattach-to-user-namespace pbcopy"
unbind-key -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode-vi Escape send-keys -X cancel
bind-key -T copy-mode-vi q send-keys -X clear-selection
bind ] run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
# Monitor windows
bind-key m setw monitor-silence 0 \; setw monitor-activity on
bind-key M setw monitor-activity off \; command-prompt -p "monitor-silence (seconds)" "setw monitor-silence %%"
# bind key to open a new window in same directory as current session
bind-key C new-window -c '#{pane_current_path}'
# Pipe the current pane to a log file with Shift-H - Press Shift-H again to stop.
bind-key H pipe-pane -o "cat >>$HOME/#W-tmux.log" \; display-message "Toggled logging to $HOME/#W-tmux.log"
# osx clipboard support
#bind-key C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer"
#bind-key C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
# Set window notifications
set-window-option -g monitor-activity on
set-option -g visual-activity on
# keymodes
set-option -g mode-keys vi
set-option -g status-keys vi
# pageup/pagedown uses copy mode
bind-key -T root PPage if-shell -F "#{alternate_on}" "send-keys PPage" "copy-mode -e; send-keys PPage"
bind-key -T copy-mode-vi PPage send-keys -X page-up
bind-key -T copy-mode-vi NPage send-keys -X page-down
# wheel support
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
bind-key -T copy-mode-vi WheelUpPane send-keys -X halfpage-up
bind-key -T copy-mode-vi WheelDownPane send-keys -X halfpage-down
# status bar
set-option -g status-bg black
set-option -g status-fg green
#set-option -g status-attr default
set-option -g set-titles on
set-option -g set-titles-string "#W"
#set-option -g status-utf8 on
set-option -g status-justify centre
set-option -g status-left "[#h #(sysctl vm.loadavg|cut -d' ' -f 3)]"
set-option -g status-right '[#[fg=cyan]%m/%d #[fg=green,bright]%R%p#[default]]'
set-option -g status-left-length 15
set-option -g status-interval 8
set-window-option -g automatic-rename on
##set-window-option -g window-status-fg white
set-window-option -g window-status-format '#I#F#T'
set-window-option -g window-status-current-format '#[fg=red](#[default]#I#F#T#[fg=red])#[default]'
##set-window-option -g window-status-attr dim
##set-window-option -g window-status-current-attr bright
##set-window-option -g window-status-activity-attr dim
##set-window-option -g window-status-activity-bg default
##set-window-option -g window-status-activity-fg yellow
#set-window-option -g window-status-content-attr dim
#set-window-option -g window-status-content-bg default
#set-window-option -g window-status-content-fg red
# messages
##set-option -g message-bg blue
##set-option -g message-fg white
##set-option -g message-attr bold
# binds for pane control
unbind %
bind-key | split-window -h
bind-key - split-window -v
# movement
bind-key -n -r M-Up select-pane -U
bind-key -n -r M-Down select-pane -D
bind-key -n -r M-Left select-pane -L
bind-key -n -r M-Right select-pane -R
# screen-like bindings
# displays *
unbind *
bind-key * list-clients
# next ^@ ^N sp n
unbind ^@
bind-key ^@ next-window
unbind ^N
bind-key ^N next-window
unbind " "
bind-key " " next-window
# title A
unbind A
bind-key A command-prompt "rename-window %%"
# windows ^W w
unbind ^W
bind-key ^W list-windows
unbind w
bind-key w list-windows
# " windowlist -b
unbind '"'
bind-key '"' choose-window