-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
206 lines (168 loc) · 5.42 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# tmux attach -t [session_name]
# tmux new-session -s development
# key bindings
# [Sessions]
# d detach from session
# s list sessions
# $ new session
#
# [Windows]
# c create new window
# w display windows
# , rename window
# & close window
# n next window
# p prev window
# f find window
# , name window
# 0..9 select window
#
# [Panes]
# % create pane (vertical)
# " create pane (hirozontal)
# o cycle thru panes
# q show pane numbers
# x close pane
# <space> cycle thru pane layouts
# ! turn pane into window
# + break into window
# - restore from window
# { move left
# } move rigth
# z toggle zoom
#
# [Misc]
# : enter command line
# ? list key bindings
# [ switch to copy mode
# ] paste buffer contents (buffer 0)
# = list paste buffers and paste selected buffer contents
# t show clock
# commands
# :capture-pane copy pane output to buffer
# :show-buffer show buffer contents
# :save_buffer save buffer to file
# :list-buffer list buffers
# :choose-buffer choose buffer to use for pasting
# :join-pane turn window into a pane
# preserve a lot of history
set-option -g history-limit 50000
bind-key C-w send-prefix
set -g default-terminal "screen-256color"
# apple magic
# set-option -g default-command "reattach-to-user-namespace -l zsh"
# navigate between panes
bind-key -r j select-pane -t :.- \; display-panes
bind-key -r k select-pane -t :.+ \; display-panes
bind-key -n C-Space select-pane -t :.+ \; display-panes
bind-key -n C-M-Space select-pane -t :. \; display-panes
bind-key -n M-1 select-pane -t 1 \; display-panes
bind-key -n M-2 select-pane -t 2 \; display-panes
bind-key -n M-3 select-pane -t 3 \; display-panes
bind-key -n M-4 select-pane -t 4 \; display-panes
bind-key -n M-5 select-pane -t 5 \; display-panes
bind-key -n M-6 select-pane -t 6 \; display-panes
bind-key -n M-7 select-pane -t 7 \; display-panes
bind-key -n M-8 select-pane -t 8 \; display-panes
bind-key -n M-9 select-pane -t 9 \; display-panes
# navigate between windows
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# create panes
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
# alt-hjkl keys to resizes panes
bind -n M-k resize-pane -U 5
bind -n M-j resize-pane -D 5
bind -n M-h resize-pane -L 20
bind -n M-l resize-pane -R 20
# alternative resizing
bind K resize-pane -U 100
bind J resize-pane -D 100
bind H resize-pane -L 100
bind L resize-pane -R 100
# reload tmux config
bind r source-file ~/.tmux.conf \; display "Config reloaded"
# clear screen
bind l send-keys "clear" \; send-keys "Enter" \;
# !not supported by new tmux
# fast command sequences (for vim)
set -s escape-time 0
# index windows starting from 1 instead of 0
set -g base-index 1
# index panes starting from 1
setw -g pane-base-index 1
# enable mouse
set -g mouse on
# !not supported by new version of tmux
# highlight the current window
# setw -g window-status-fg cyan
# setw -g window-status-bg default
# setw -g window-status-attr dim
# setw -g window-status-current-fg white
# setw -g window-status-current-bg red
# setw -g window-status-current-attr bright
# !not supported by new tmux
# hightlight the command line
# set -g message-fg white
# set -g message-bg black
# set -g message-attr bright
# set status bar colors
set -g status-fg white
set -g status-bg black
# turn on ubr8 in status line
# set -g status-utf8 on
# set left status bar
set -g status-left-length 60
# #H hostname
# #h hostname w/o domain
# #F current window flag
# #I current window index
# #P current pane index
# #S current session name
# #T current window title
# #W current window name
# ## a literl #
# #(shell command) first line of the command output
# #[attributes] color of attribute change
set -g status-left "#[fg=green]#S #[fg=yellow]#I #[fg=cyan]#P "
# set right status bar
set -g status-right "#[fg=cyan]%d %b %R"
# refresh status bar with interval
# set -g status-interval 60
# align the list of windows in the status bar [left|centre|right]
set -g status-justify left
# notify about activity on other windows
setw -g monitor-activity on
set -g visual-activity on
# use vi keys in copy mode
set -g mode-keys vi
# use vi-like bindings to work with buffers
bind Escape copy-mode
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
# bind-key -T copy-mode-vi 'y' send-keys -X copy-selection-and-cancel\; run "tmux save -|xsel -b >/dev/null 2>&1"
# linux
# bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
# clipboard to work on mac
bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
# temporarily maximaize pane, minimaze it
unbind Up
bind Up new-window -d -n tmp\; swap-pane -s tmp.1 \; select-window -t tmp
unbind Down
bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
# set default shell
set -g default-command /bin/zsh
set -g default-shell /bin/zsh
# toggle pane logging
bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"
# this fixes junk being printed on 'y' key when in vim mode
set-option -s set-clipboard off
# highlight selected pane
set -g pane-active-border-style 'fg=#685642,bg=#685642'
set -g pane-border-style 'fg=#685642'
# color scheme for pane numbers displayed when navigating between panes, panes are numbered 1,2,3,4,....
set -g display-panes-colour "#808080"
set -g display-panes-active-colour "orange"