-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
146 lines (117 loc) · 4.91 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
# plugins
set-option -g @tpm_plugins " \
tmux-plugins/tpm \
tmux-plugins/tmux-logging \
tmux-plugins/tmux-resurrect \
tmux-plugins/tmux-sensible \
tmux-plugins/tmux-sessionist \
erikw/tmux-powerline \
tmux-plugins/tmux-continuum \
sainnhe/tmux-fzf \
"
# continuum must come after powerline
# other examples:
# github_username/plugin_name \
# [email protected]/user/plugin \
# [email protected]/user/plugin \
set-option -g @plugin "thewtex/tmux-mem-cpu-load"
# tmux-resurrect
set-option -g @resurrect-default-processes "man less tail htop irssi mutt"
set-option -g @resurrect-processes "ssh"
set-option -g @continuum-restore "on"
# initialise TMUX plugin manager
run-shell ~/.tmux/plugins/tpm/tpm
# basic config
if-shell "[ $(uname) = Linux ]" "set-option -g default-terminal 'tmux-256color'" ""
if-shell "[ $(uname) = Darwin ]" "set-option -g default-terminal 'tmux-256color'" ""
if-shell "[ $(uname) = FreeBSD ]" "set-option -g default-terminal 'screen-256color'" ""
if-shell "[ $(uname) = FreeBSD ]" "set-option -g default-shell /usr/local/bin/zsh" ""
set-window-option -g xterm-keys
set-option -s escape-time 50
set-environment -g "SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
set-environment -g "TMUX_FZF_OPTIONS" "-p -w 75% -h 75%"
TMUX_FZF_LAUNCH_KEY="q"
# remap prefix to Control + a
set-option -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix
unbind-key a
bind-key a send-prefix
# activity
set-window-option -g monitor-activity off
set-option -g visual-activity off
# reload config file
unbind-key R
bind-key R source-file ~/.tmux.conf \; display-message "reloading..."
# edit config file
unbind-key C-e
bind-key C-e split-window -bl "80%" "nvim ~/.tmux.conf"
# automatically set window title
set-window-option -g allow-rename off
set-window-option -g automatic-rename off
# vi mode
set-window-option -g mode-keys vi
# title
set-option -g set-titles on
# history
set-option -g history-limit 100000
# bell
set-option -g bell-action none
# sort sessions alphabetically in tree
bind-key s choose-tree -s -O name
# don't constrain to size of smallest client
set-window-option -g aggressive-resize on
# allow passing values directly to the terminal - used for wezterm integration
set-option -g allow-passthrough on
# borders
set-option -g focus-events on
set-option -g pane-border-lines heavy
set-option -g pane-border-indicators both
set-option -g pane-border-style fg=brightgreen
set-option -g pane-active-border-style fg=yellow
# terminal features
set-option -ga terminal-overrides ',*256col*:Tc' # true colour and italics
set-option -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q' # cursor shape
set-option -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set-option -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours
# mouse
set-option -g mouse on
bind-key C-y run "~/utils/tmux/mouse-toggle"
# add mouse status
# set-option -g status-right '#[fg=white]#(tmux show-options -g | grep mouse-resize-pane | cut -d" " -f2)#[default] %d-%b-%y %H:%M'
# navigation
bind-key -n DC previous-window
bind-key -n End next-window
bind-key -n IC send-keys C-a C-p
bind-key -n Home send-keys C-a C-n
bind-key C-q last-window
bind-key -n M-Left previous-window
bind-key -n M-Right next-window
# pane selection
unbind-key l
bind-key -r -T prefix k select-pane -U
bind-key -r -T prefix j select-pane -D
bind-key -r -T prefix h select-pane -L
bind-key -r -T prefix l select-pane -R
# copying selection vim style
bind-key Enter copy-mode # enter copy mode; default [
bind-key p paste-buffer # paste; default ]
bind-key P choose-buffer # choose which buffer to paste from
bind-key -T copy-mode-vi Escape send-keys -X clear-selection # clear selection
bind-key -T copy-mode-vi v send-keys -X begin-selection # begin visual mode
bind-key -T copy-mode-vi V send-keys -X select-line # visual line
bind-key -T copy-mode-vi y send-keys -X copy-selection # yank to tmux clipboard
bind-key -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel "clipit" # yank and send to sys clipboard
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle # visual block toggle
# read and write paste buffer
bind-key < command-prompt -p "copy to tmux (hit enter to confirm):" "run-shell 'tmux set-buffer -- \"$(clipit -c)\"'"
bind-key > command-prompt -p "copy to xsel (hit enter to confirm):" "run-shell 'tmux show-buffer | clipit'"
# show all keys in help
unbind-key ?
bind-key ? list-keys -Na
# send scrollback to editor
bind-key v "capture-pane" \; \
capture-pane -S - \; \
save-buffer /tmp/tmux.txt \; \
delete-buffer \; \
send-keys Escape 'ddiv +"/^\\%u2500" +":normal! GN" /tmp/tmux.txt' Enter