-
Notifications
You must be signed in to change notification settings - Fork 1
/
.tmux.conf
153 lines (119 loc) · 5.19 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
## GENERAL
# truecolor
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*256col*:Tc"
# start in zsh
set-option -g default-shell /bin/zsh
# set mouse scrolling
set-option -g -q mouse on
# rebind tmux prefix to ctrl-a
set -g prefix C-a
unbind C-b # unbind the default binding to send prefix key
#bind C-a send-prefix
# prefix + r to force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display "Finished sourcing ~/.tmux.conf ."
# Allow for longer history in scrollback buffers; note that tmux-resurrect
# # (used later) has to save this much information. Hence the limit of 20000
# # rather than more; any more, and you should be dumping to a file anyhow.
set -g history-limit 50000
# longer messages
set-option -g display-time 4000
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 0
# vi key mode
setw -g mode-keys vi
# vi copy/paste
#bind-key -T copy-mode-vi v send-keys -X begin-selection
#bind-key -T copy-mode-vi y send-keys -X copy-selection
# focus events for vim-tmux-focus-events plugin
set -g focus-events on
# TODO: Not sure if these are needed
unbind-key Up
unbind-key Down
unbind-key Left
unbind-key Right
## XCLIP GOODNESS
# tmux top buff to system buff
unbind C-y
bind C-y run-shell -b "tmux show-buffer | xclip -sel clip -i" \; display-message "Copied tmux buff[top] to sys clip"
#bind C-p run-shell -b "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer" \; display-message "Pasted sys clip to tmux"
# Copy current path to system buff
unbind C-p
bind C-p run-shell -b "tmux display -p -F '#{pane_current_path}' | xclip -sel clip -i" \; display "Copied current path '#{pane_current_path}' to the clipboard."
## PANES
set -g pane-base-index 1 # start pane index at 1
unbind % # TODO: Not sure if this is needed
# Rebind split keys and ensure pane splitting should retain current path
bind-key | split-window -h -c "#{pane_current_path}"
bind-key - split-window -v -c "#{pane_current_path}"
# Cycle Panes
bind o select-pane -t :.+ # cycle panes
bind O select-pane -t :.- # cycle panes in reverse
# Smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l"
# Resize Panes
bind -r h resize-pane -L 2
bind -r C-h resize-pane -L 10
bind -r j resize-pane -D 2
bind -r C-j resize-pane -D 10
bind -r k resize-pane -U 2
bind -r C-k resize-pane -U 10
unbind l # unbind default binding for `last-window`
bind -r l resize-pane -R 2
bind -r C-l resize-pane -R 10
## WINDOWS
set-option -g renumber-windows on # sequential window numbers
set -g base-index 1 # start window index at 1
set -g allow-rename off # disable auto renaming of windows
bind C-a last-window # switch to last active window
# Allow repeats for next/previous-window
bind -r p previous-window
bind -r n next-window
## COLOUR (Solarized 256)
# default statusbar colors
set-option -g status-bg colour0 #base02
set-option -g status-fg colour130 #yellow
set-option -g status-attr default
# status bar customization
set -g status-interval 2
set -g status-right-length 80
set -g status-right "#[fg=colour33]#(basic-cpu-and-memory.tmux --interval 2)#[fg=green] :: %a "
# default window title colors
set-window-option -g window-status-fg colour33 #base0
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 colour196 #orange
set-window-option -g window-status-current-bg default
#set-window-option -g window-status-current-attr bright
# active/inactive pane styles
#set -g window-style 'fg=default,bg=black'
set -g window-active-style 'fg=default,bg=colour8'
# pane border
set-option -g pane-border-style 'fg=colour239'
set-option -g pane-active-border-style 'fg=magenta'
# message text
set-option -g message-bg colour235 #base02
set-option -g message-fg colour196 #orange
# pane number display
set-option -g display-panes-active-colour colour20 #blue
set-option -g display-panes-colour colour196 #orange
# clock
set-window-option -g clock-mode-colour colour40 #green
## TPM - tmux plugin manager
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'Morantron/tmux-fingers'
# TPM options
# tmux default-command can NOT contain && or || operators for the below to work
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-processes 'false'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'