-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
204 lines (171 loc) Β· 7.33 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
# https://github.com/tmux/tmux/wiki/Advanced-Use
# The command to pipe to if the copy-pipe copy mode command is used without arguments
set -s copy-command "clipcopy"
# utf8 is on
# tmux can also be forced to use UTF8 via tmux -u <command>
setw -q -g utf8 on
# Set TMUX_VERSION env variable.
run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | cut -c 6-)"
# set is the alias of set-option.
# Set a pane option with -p, a window option with -w, a server option with -s, otherwise a session option. If
# the option is not a user option, -w or -s may be unnecessary - tmux will infer the type from the option name,
# assuming -w for pane options. If -g is given, the global session or window option is set.
# Enable 24-bit "True color" support
# https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-a-256-colour-terminal
# https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-rgb-colour
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",xterm-256color:RGB"
# Set 256 colours support for all terminal `$TERM` types.
set -g terminal-features ",*:RGB"
# Undercurl, taken from: https://github.com/folke/lsp-colors.nvim
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 zsh as your default Tmux shell
# With this, PATH exported by zsh via zi is also available to tmux
set -g default-shell $HOME/.zi/polaris/bin/zsh
# scrolling
set -g mouse off
# decrease command delay (increases vim responsiveness)
set -sg escape-time 1
# increase repeat time for repeatable commands
set -g repeat-time 1000
# 0 is at the wrong end of the keyboard
set -g base-index 1 #windows
set -g pane-base-index 1
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# notifications
set -g visual-activity off
set -g visual-bell off
set -g visual-silence on
setw -g monitor-activity off
set -g bell-action none
# TMUX prefix key (similar Vim leader key)
unbind C-b # remap tmux leader key
set -g prefix C-Space
bind C-Space send-prefix
# M is meta key, usually Alt
# switch panes using Alt without prefix
bind -n M-h select-pane -L
bind -n M-l select-pane -R
bind -n M-k select-pane -U
bind -n M-j select-pane -D
# Toggle between last active window
bind-key a last-window
# windows
bind r source-file $HOME/.tmux.conf
# Rebind spit and new-window commands to use current path
bind s split-window -h -c "#{pane_current_path}"
bind x split-window -v -c "#{pane_current_path}"
# bind """ choose-tree -w # use tmux-fzf to show and switch windows
# dont allow renaming window short name
set -g allow-rename off
# COPY MODE
# https://sunaku.github.io/tmux-yank-osc52.html "Copying to clipboard from tmux and Vim using OSC 52"
# https://dev.to/iggredible/the-easy-way-to-copy-text-in-tmux-319g
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi V send -X select-line
# Setup 'y' to copy selection as in Vim
# Use reattach-to-user-namespace with pbcopy on OS X
# Use xclip on Linux
set -g set-clipboard off
# buffer length
set -g history-limit 9999 # NOTE: the maximum allowed limit is 32767
if-shell 'test "$(uname -s)" = Darwin' 'bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy 2> /dev/null"' 'bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel "xclip -i -selection clipboard"'
bind ^J copy-mode # any unmapped key to quit
# Clear scrollback
bind q clear-history
# search buffer using copy mode
# advanced using vim: https://sunaku.github.io/tmux-searchable-scrollback.html
bind-key -n M-/ copy-mode \;\
command-prompt -p 'search-backward (press up):' \
-i 'send-keys -X search-backward-incremental "%%%"'
# status bar
# set -g status off
set -g status-position top
set -g status-interval 3 # seconds
set -g status-left ""
set -g status-right ""
set -g pane-active-border-style bg=default,fg=magenta
set -g pane-border-style fg=magenta
# https://unix.stackexchange.com/questions/269537/how-do-i-make-the-tmux-rename-window-prompt-empty-by-default
bind-key , command-prompt "rename-window '%%'"
# resurrect and continuum
set -g @resurrect-strategy-vim "session"
set -g @resurrect-strategy-nvim "session"
set -g @resurrect-save "S"
set -g @resurrect-restore "R"
set -g @resurrect-processes "true"
set -g @continuum-restore "on"
set -g @continuum-save-interval "10"
# extrakto
# set -g @extrakto_fzf_tool "$HOME/.zi/polaris/bin/fzf"
set -g @extrakto_insert_key "enter"
set -g @extrakto_copy_key "tab"
# tries to use clip.exe when set to auto in wsl
set -g @extrakto_clip_tool "xclip -i -selection clipboard >/dev/null"
# tmux-session-wizard
set -g @session-wizard "T"
# tmux-fuzzback
set -g @fuzzback-bind ?
set -g @fuzzback-popup 1
set -g @fuzzback-hide-preview 1
set -g @fuzzback-finder-bind "ctrl-y:execute-silent(echo -n {3..} | xsel -ib)+abort"
# tmux-fzf
# if `tmux run-shell -b 'command -v fzf' fails, check if fzf is available in tmux
# $PATH via `tmux run-shell -b 'echo $PATH'`
TMUX_FZF_PREVIEW=0
TMUX_FZF_OPTIONS="-p -w 30% -h 38% -m"
bind-key f run-shell -b "~/.tmux/plugins/tmux-fzf/scripts/window.sh switch"
# pomodoro
set -g @pomodoro_on "#[fg=$onedark_red]π
"
set -g @pomodoro_complete "#[fg=$onedark_green]π
"
set -g @pomodoro_pause "#[fg=$onedark_yellow]π
"
set -g @pomodoro_prompt_break "#[fg=$onedark_green]π€ ? "
set -g @pomodoro_prompt_pomodoro "#[fg=$onedark_gray]π€ ? "
set -g @pomodoro_interval_display "[%s/%s]"
set -g @pomodoro_notifications "on"
# Set CPU percentage in status bar
# updates every $status-interval seconds (caution: has to be the same as tmux variable status-interval)
set -g @onedark_widgets "#[default]#(tmux-mem-cpu-load --vertical-graph --interval 3 --averages-count 0) #{pomodoro_status}"
# show a tab instead of time
set -g @onedark_date_format "%t"
# tmux-thumbs
set -g @thumbs-key y
set -g @thumbs-contrast 1
set -g @thumbs-command "echo -n {} | xclip -i -sel clipboard"
set -g @thumbs-position off_lefl
# tmux-navigate
# Seamless tmux/vim navigation (over SSH too!)
# QWERTY layout
set -g @navigate-left '-n M-h'
set -g @navigate-down '-n M-j'
set -g @navigate-up '-n M-k'
set -g @navigate-right '-n M-l'
set -g @navigate-back '-n M-\'
## TPM -- tmux plugin manager
# List of plugins
# IMPORTANT: run PREFIX + I to fetch plugins and load it
set -g @plugin "tmux-plugins/tpm"
set -g @plugin "tmux-plugins/tmux-sensible"
set -g @plugin "odedlaz/tmux-onedark-theme"
set -g @plugin "laktak/extrakto"
# set -g @plugin "fcsonline/tmux-thumbs"
set -g @plugin "sainnhe/tmux-fzf"
set -g @plugin "tmux-plugins/tmux-resurrect"
set -g @plugin "tmux-plugins/tmux-continuum"
set -g @plugin "olimorris/tmux-pomodoro-plus"
# set -g @plugin "27medkamal/tmux-session-wizard"
set -g @plugin "roosta/tmux-fuzzback"
set -g @plugin 'sunaku/tmux-navigate'
# Automatic installation of Tmux Plugin Manager
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
# You will need to install the plugins using the `<prefix> + I` binding.
# To update the plugins, you will need to use `<prefix> + U`
# To remove plugins, you will need to use `<prefix> + alt + u`
run -b '~/.tmux/plugins/tpm/tpm'