-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtmux.conf
161 lines (125 loc) · 5.01 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
#-- Key-Bindings --------------------------------------------------------------
# reload config file
bind r source-file ~/.tmux.conf
# start with window 1 (instead of 0)
set -g base-index 1
# start with pane 1
set -g pane-base-index 1
bind g run-shell -b fts-tmux
# more intuitive split keys
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# create window
bind c new-window -a
unbind t
bind t new-window -a -c "#{pane_current_path}"
# navigate windows
bind -n C-right next-window
bind -n C-left previous-window
# rename window
bind e command-prompt -p rename: 'rename-window %1'
set-option -g allow-rename off
# auto rename
set-option -g status-interval 1
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{b:pane_current_path}'
# move between panes using vi keys 'hjkl'
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# cycle prev/next pane
bind -n S-right select-pane -t :.+
bind -n S-left select-pane -t :.-
# resize panes
bind -r C-k resize-pane -U 1
bind -r C-j resize-pane -D 1
bind -r C-h resize-pane -L 1
bind -r C-l resize-pane -R 1
# duplicate input to all panes in the same window
bind S set-window-option synchronize-panes on
bind s set-window-option synchronize-panes off
# move window
bind N swap-window -t +1
bind P swap-window -t -1
# join window
bind-key m choose-window -F "#{window_index}: #{window_name}" "join-pane -h -t %%"
bind-key M choose-window -F "#{window_index}: #{window_name}" "join-pane -v -t %%"
# buffers
bind b list-buffers # list paste buffers
bind P choose-buffer # choose which buffer to paste from
# reassign ; from last-pane to last-window
unbind \;
bind \; last-window
# reassign ' from select-window to last-pane, and use ' for last-pane
unbind "'"
bind "'" last-pane
bind / command-prompt -p index "select-window -t ':%%'"
# open a man page in new pane or window
bind o command-prompt -p "man page:" "split-window -h 'exec man %%'"
bind O command-prompt -p "Man page:" "new-window -n 'man %1' 'exec man %1'"
#-- Usability -----------------------------------------------------------------
# fix ESC delay in nvim
set-option -sg escape-time 10
# enable vi mode keys
set-option -g status-keys vi
set-window-option -g mode-keys vi
#bind -t vi-copy 'v' begin-selection
#bind -t vi-copy 'y' copy-selection
# set default terminal mode to 256 colors
set -g default-terminal "screen-256color"
# keep tmux msgs around longer
set -g display-time 3000
set -g history-limit 100000
## set -g set-titles off
## Set window notifications
##set-window-option -g monitor-activity on
##set -g visual-activity on
# always use the largest client size to prevent ... appears out of the boundary
set -g window-size largest
#-- Status-Bar ----------------------------------------------------------------
## Default colors
set -g status-bg colour250
set -g status-fg white
set -g status-justify left
set-option -g status-position bottom
set -g status-left ''
#
### Left side of status bar
## Show session name and hostname in my choice of colors
set -g status-left-length 33
set -g status-left '#[bg=colour236,fg=colour33] #(hostname -s):#S #[bg=default] '
#
### Middle of status bar, window labels
## Inactive windows in status bar
set-window-option -g window-status-format '#[bg=colour245,fg=colour0] #I:#W '
## Current or active window in status bar
#set-window-option -g window-status-current-format '#[bg=default,fg=red]#I:#W#F'
set-window-option -g window-status-current-format '#[bg=colour0,fg=colour15] #I:#W#F'
#
### Right side of status bar
## show current window title, date and time in my choice of colors
set -g status-right '#[bg=colour238]#[fg=colour248] %Y-%m-%d %H:%M '
#-- Mouse ---------------------------------------------------------------------
# While mouse is on, hold option key to select text
set -g mouse on
# disable "release mouse drag to copy and exit copy-mode", ref: https://github.com/tmux/tmux/issues/140
unbind-key -T copy-mode-vi MouseDragEnd1Pane
# since MouseDragEnd1Pane neither exit copy-mode nor clear selection now,
# let single click do selection clearing for us.
bind-key -T copy-mode-vi MouseDown1Pane select-pane\; send-keys -X clear-selection
# this line changes the default binding of MouseDrag1Pane, the only difference
# is that we use `copy-mode -eM` instead of `copy-mode -M`, so that WheelDownPane
# can trigger copy-mode to exit when copy-mode is entered by MouseDrag1Pane
bind -n MouseDrag1Pane if -Ft= '#{mouse_any_flag}' 'if -Ft= \"#{pane_in_mode}\" \"copy-mode -eM\" \"send-keys -M\"' 'copy-mode -eM'
# press `y` to copy selected text in visual mode
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel pbcopy
#-- Plugins -------------------------------------------------------------------
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# plugin configs
set -g @continuum-restore 'on'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'