-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.tmux.conf
167 lines (133 loc) · 6.14 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
# prefix to a
unbind-key C-b
set -g prefix C-a
# don't rename windows automatically
set-option -g allow-rename off
set-option -g default-shell $SHELL
set -g default-command "reattach-to-user-namespace -l ${SHELL}"
# reduce escape time to 1ms
set -sg escape-time 1
# # Set ability to capture on start and restore on exit window data when running an application
setw -g alternate-screen on
# act like vim
setw -g mode-keys vi
set -g status-keys vi
set -g visual-activity off
set -g visual-bell off
set -g visual-silence on
# navigate between vim and tmux
# checks for "not_tmux" so that j and k nav work inside of e.g. fzf when run via `v c-t`
not_tmux="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?(g?(view|n?vim?x?)(diff)?|fzf)$'"
bind-key -n C-h if-shell "$not_tmux" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$not_tmux" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$not_tmux" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$not_tmux" "send-keys C-l" "select-pane -R"
# copy-mode
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi Escape send -X cancel
bind-key -T copy-mode-vi V send -X rectangle-toggle
bind-key P paste-buffer
# turn on mouse support, note plugin below
set -g mouse on
# make scrolling with wheels work
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
# nicer splitting keys
unbind-key %
# open splits with the current path
bind-key | split-window -h -c '#{pane_current_path}'
bind-key '\' split-window -h -c '#{pane_current_path}'
bind-key - split-window -v -c '#{pane_current_path}'
# create a small vertical pane at the bottom
unbind-key m
bind-key m split-window -v -l 8
bind-key C-x kill-pane
# resize pane
bind-key -r J resize-pane -D 5
bind-key -r K resize-pane -U 5
bind-key -r H resize-pane -L 5
bind-key -r L resize-pane -R 5
# preset resizing
unbind-key ]
bind-key ] resize-pane -t 2 -x 70
# # Easy config reload
unbind-key r
bind-key r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
# Scroll 3 lines at a time instead of default 5; don't extend dragged selections.
# bind-key -T copy-mode-vi WheelUpPane select-pane\; send-keys -t{mouse} -X clear-selection\; send-keys -t{mouse} -X -N 3 scroll-up
# bind-key -T copy-mode-vi WheelDownPane select-pane\; send-keys -t{mouse} -X clear-selection\; send-keys -t{mouse} -X -N 3 scroll-down
# Make double and triple click work outside of copy mode (already works inside it with default bindings).
# bind-key -T root DoubleClick1Pane if-shell -Ft{mouse} '#{alternate_on}' "send-keys -M" "copy-mode -t{mouse}; send-keys -t{mouse} -X select-word"
# bind-key -T root TripleClick1Pane if-shell -Ft{mouse} '#{alternate_on}' "send-keys -M" "copy-mode -t{mouse}; send-keys -t{mouse} -X select-line"
#start window and pane numbering at 1
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
# Needed as on tmux 1.9 and up (defaults to off).
# Added in tmux commit c7a121cfc0137c907b7bfb.
set -g focus-events on
# But don't change tmux's own window titles.
set -w -g automatic-rename off
# #T = standard window title (last command, see ~/.bash_profile)
# #h = short hostname
# #S = session name
# #W = tmux window name
#
# (Would love to include #(pwd) here as well, but that would only print the
# current working directory relative to the session -- ie. always the starting
# cwd -- which is not very interesting).
set -g set-titles-string "#T : #h > #S > #W"
# to install new plugins, prefix + I (shift i)
set -g @tpm_plugins ' \
tmux-plugins/tpm \
tmux-plugins/tmux-sensible \
tmux-plugins/tmux-resurrect \
tmux-plugins/tmux-continuum \
tmux-plugins/tmux-yank \
tmux-plugins/tmux-pain-control \
tmux-plugins/tmux-copycat \
tmux-plugins/tmux-open
'
# Initialize TMUX plugin manager
run '~/.tmux/plugins/tpm/tpm'
# use the xterm-kitty terminfo
set -g default-terminal "xterm-kitty"
# turn on 24bit colour
set -ga terminal-overrides ",xterm-kitty:Tc"
# enable underlines etc.
set -ga terminal-overrides ",xterm-kitty:smxx=\\033[9m"
# allow kitty to listen to things from inside tmux
set -ga update-environment 'KITTY_LISTEN_ON'
# recognise extended keys
set -s extended-keys on
set -as terminal-features 'xterm-kitty*:extkeys'
# push through specific keys
# for some reason need to bind these as it won't get through otherwise
bind-key -T root C-Enter send-keys Escape "[13;5u"
bind-key -T root S-Enter send-keys Escape "[13;2u"
bind-key -T root C-/ send-keys Escape "[47;5u"
bind-key -T root C-, send-keys Escape "[44;5u"
bind-key -T root C-. send-keys Escape "[46;5u"
bind-key -T root C-[ send-keys Escape "[91;5u"
bind-key -T root C-S-p send-keys Escape "[80;6u"
bind-key -T root C-S-j send-keys Escape "[74;6u"
# undercurl support with colours!
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
set -g status-interval 30 # Default is 15.
# setw -g xterm-keys on
# default falcon tmux styling
source-file ~/Documents/Work/internal/vim/colors/falcon/tmux/falcon.transparent.tmux.conf
# zoom
setw -g window-status-current-format "#[fg=white,bg=#020221] #[fg=#787882]#[fg=#dfdfe5]#W#{?window_zoomed_flag,#[fg=#dfdfe5] , }"
# to even windows
bind-key b select-layout even-horizontal
# tmux select-layout even-horizontal / even-vertical
# the following is falcon colour specific
# see https://man.openbsd.org/tmux.1#FORMATS for status items
set -g status-left "#[fg=#57575e]"
set -g status-right "#[fg=#57575e]#{user}@#{host_short} "
# set -g status-right "#(~/.config/tmux/thyme.zsh) #(~/.config/tmux/music.zsh) #[fg=white]%d/%m/%Y %H:%M "
# set -g status-right-length 200