-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.tmux.conf
121 lines (104 loc) · 5.94 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
unbind C-b
set-option -g prefix C-j
bind-key C-j send-prefix
# reload settings (if you don't use this, you must do ´killall tmux´)
bind R source-file ~/.tmux.conf
# make sure current path is preserved when splitting windows
bind '"' split-window -c '#{pane_current_path}' # Split panes vertically
bind '%' split-window -h -c '#{pane_current_path}' # Split panes horizontal
bind-key -T copy-mode-vi ? command-prompt -i -p "search up" "send -X search-backward-incremental \"%%%\""
bind-key -T copy-mode-vi / command-prompt -i -p "search down" "send -X search-forward-incremental \"%%%\""
# # these bind-keys are needed to make C-b @$|[]\{}work in visual studio code integrated terminal with terminal.integrated.macOptionIsMeta
# #bind-key M-2 join-pane # option-2 maps to the at-sign @
# #bind-key M-4 \$ # option-4 maps to dollar $
# #bind-key M-7 \| # option-7 maps to vertical bar |
# bind-key M-8 copy-mode # option-8 maps to left square bracket [
# bind-key M-9 paste-buffer # option-9 maps to right square bracket ]
# #bind-key M-& \\ # option-shift-7 maps to backslash \ ('&' is found on the US keyboard!)
# bind-key 'M-*' swap-pane -U # option-shift-8 maps to left curly brace ('*' is found on the US keyboard!) {
# bind-key -T copy-mode-vi 'M-*' send-keys -X previous-paragraph # { is mapped in copy mode too
# bind-key M-( swap-pane -D # option-shift-9 maps to right curly brace ('(' is found on the US keyboard!) }
# bind-key -T copy-mode-vi M-( send-keys -X next-paragraph # } is mapped in copy mode too
# # still not wroking under terminal.integrated.macOptionIsMeta
# # @| are commands in tmux-sessionist
# # $ not working in ANY script (e.g. fzf-tmux)
set -g @continuum-restore 'on'
# continuum-boot doesn't work well with my setup, when starting it just types "tmux" inside tmux
#set -g @continuum-boot 'off'
#set -g @continuum-boot-options 'iterm'
set -g @continuum-save-interval '10' # 10 min instead of 15 min
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-processes 'tig lazygit ssh "~yarn->yarn *" "~pilot->pilot *" "~pps->pps *"'
# use the most modern zsh
if-shell "test -f $HOMEBREW_PREFIX/bin/zsh" 'TMUX_ZSH=$HOMEBREW_PREFIX/bin/zsh' 'TMUX_ZSH=/bin/zsh'
# if in macOS, use reattach (to make mouse work), otherwise (in WSL) use zsh
if-shell "test -f $HOMEBREW_PREFIX/bin/reattach-to-user-namespace" 'set -g default-command "reattach-to-user-namespace -l $SHELL"' 'set-option -g default-shell $TMUX_ZSH'
# general settings
set -g allow-rename on
# tmux-256color should be a more modern setting, it supports italics, but screen-256color is more backward compatible. e.g. it supports ncdu & nano
# for tmux-256color to work, a modern ncurses must be first in path.
# final hack: hardcoding TERM to screen-256color makes all (?!) programs work (but will blow up in my face eventually?)
set -g default-terminal "tmux-256color"
set -g history-limit 50000
set -g mouse on
set -g pane-border-format '#{pane_index} #[fg=colour64]#{pane_current_command}#[default] #(pwd="#{pane_current_path}"; echo $pwd | sed "s-$HOME-~-") #[fg=yellow]#{?#{==:#{pane_mode},},,#{pane_mode} }#{?pane_pipe,pipe ,}#{?pane_synchronized,synchronized ,}#T#[default]'
set -g pane-border-indicator 'both'
set -g set-titles on
set -g status-interval 1 # update every 1 second
set -g status-justify 'centre'
set -g status-left "#[reverse]#S#[default] #{?client_prefix,p, }"
set -g status-left-length 60
set -g status-right "#[reverse]#(echo $USER) @ #(hostname -s)#[default] #[fg=colour36]%F %R#[default]"
set -g status-right-length 60
set -g visual-activity on
# visual-bell may sound like a good idea, BUT it PAUSES the window for more than a second
set -g visual-bell off
set -g visual-silence on
set -g window-status-current-format '#[fg=colour222,bg=colour238]#{?window_zoomed_flag,#[reverse],}#I:#{?#{==:#{window_name},#{pane_current_command}},,#W|}#{pane_current_command}+#{b:pane_current_path}#F#[default]'
set -g window-status-format '#I:#{?#{==:#{window_name},#{pane_current_command}},,#W|}#{pane_current_command}+#{b:pane_current_path}#F'
setw -g aggressive-resize on
setw -g monitor-activity on
setw -g pane-border-status bottom
setw -g mode-keys vi
# better for yazi? https://yazi-rs.github.io/docs/image-preview#tmux-users (but I've not proven that it makes a difference)
set -g allow-passthrough on
# colours
set -g message-command-style 'fg=colour222,bg=colour238'
set -g message-style 'fg=colour222,bg=colour238'
set -g pane-active-border-style 'fg=colour112'
set -g pane-border-style 'fg=colour241'
set -g status-style 'fg=colour36,bg=colour235'
setw -g window-status-style 'fg=colour116,bg=colour235'
setw -g window-status-activity-style 'underscore'
# plugins
set -g @plugin 'tmux-plugins/tpm'
# standard bind was c-f, which is my prefix key
set -g @copycat_file_search 'C-b'
set -g @plugin 'tmux-plugins/tmux-copycat'
# generally better than copycat, this uses fzf, prefix is <tab>
set -g @extrakto_grab_area 'recent'
set -g @extrakto_filter_order 'line all path url quote s-quote word'
set -g @extrakto_copy_key 'tab'
set -g @extrakto_insert_key 'enter'
set -g @extrakto_filter_key 'ctrl-s'
set -g @extrakto_grab_key 'ctrl-r'
set -g @plugin 'laktak/extrakto'
set -g @plugin 'jbnicolai/tmux-fpp'
set -g @fpp-key 'a'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# gnu sed is needed for tmux-fzf
TMUX_FZF_SED="$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin/sed"
set -g @plugin 'sainnhe/tmux-fzf'
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set -g @emulate-scroll-for-no-mouse-alternate-buffer on
set -g @scroll-speed-num-lines-per-scroll 1
if "test ! -d ~/.tmux" \
"run 'mkdir ~/.tmux'"
if "test ! -d ~/.tmux/plugins" \
"run 'mkdir ~/.tmux/plugins'"
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bindings/install_plugins'"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'