-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
119 lines (101 loc) · 6.3 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
# Support for fabulous colors and italics!
set -g default-terminal 'alacritty'
set-option -g default-shell $SHELL
set-option -ga terminal-overrides ",alacritty:Tc" # tmux/tmux#696
set -g prefix C-a
bind C-a send-prefix # work with nested sessions
set-option -g mouse on
# Select text using keyboard on copy mode
unbind-key -T copy-mode-vi v
unbind-key -T copy-mode-vi 'C-v'
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi 'C-v' send -X begin-selection \; send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send -X copy-selection-no-clear
# Exit from copy-mode with "a" (matching nvim terminal's normal mode)
bind-key -T copy-mode-vi a send -X cancel
# vim-like motions for selecting text:
# source1: https://old.reddit.com/r/vim/comments/12eg832/is_there_a_way_to_have_vim_objects_in_tmux/jfd1m40/
# source2: https://github.com/kite12580/.vim/blob/8669005063b5daead6a3101e90ecfb1160d1594a/config/.tmux.conf#L140-L156
bind-key -T copy-mode-vi i switch-client -T copyModeMultiKey_i
bind-key -T copyModeMultiKey_i w send-keys -X select-word
bind-key -T copyModeMultiKey_i W send-keys -X clear-selection \; send-keys -X previous-space \; send-keys -X begin-selection \; send-keys -X next-space-end
bind-key -T copyModeMultiKey_i b send-keys -X clear-selection \; send-keys -X jump-to-backward '(' \; send-keys -X begin-selection \; send-keys -X jump-to-forward ')'
bind-key -T copyModeMultiKey_i ( send-keys -X clear-selection \; send-keys -X jump-to-backward '(' \; send-keys -X begin-selection \; send-keys -X jump-to-forward ')'
bind-key -T copyModeMultiKey_i ) send-keys -X clear-selection \; send-keys -X jump-to-backward '(' \; send-keys -X begin-selection \; send-keys -X jump-to-forward ')'
bind-key -T copyModeMultiKey_i B send-keys -X clear-selection \; send-keys -X jump-to-backward '{' \; send-keys -X begin-selection \; send-keys -X jump-to-forward '}'
bind-key -T copyModeMultiKey_i \{ send-keys -X clear-selection \; send-keys -X jump-to-backward '{' \; send-keys -X begin-selection \; send-keys -X jump-to-forward '}'
bind-key -T copyModeMultiKey_i \} send-keys -X clear-selection \; send-keys -X jump-to-backward '{' \; send-keys -X begin-selection \; send-keys -X jump-to-forward '}'
bind-key -T copyModeMultiKey_i [ send-keys -X clear-selection \; send-keys -X jump-to-backward '[' \; send-keys -X begin-selection \; send-keys -X jump-to-forward ']'
bind-key -T copyModeMultiKey_i ] send-keys -X clear-selection \; send-keys -X jump-to-backward '[' \; send-keys -X begin-selection \; send-keys -X jump-to-forward ']'
bind-key -T copyModeMultiKey_i < send-keys -X clear-selection \; send-keys -X jump-to-backward '<' \; send-keys -X begin-selection \; send-keys -X jump-to-forward '>'
bind-key -T copyModeMultiKey_i > send-keys -X clear-selection \; send-keys -X jump-to-backward '<' \; send-keys -X begin-selection \; send-keys -X jump-to-forward '>'
bind-key -T copyModeMultiKey_i ` send-keys -X clear-selection \; send-keys -X jump-to-backward '`' \; send-keys -X begin-selection \; send-keys -X jump-to-forward '`'
bind-key -T copyModeMultiKey_i \' send-keys -X clear-selection \; send-keys -X jump-to-backward "'" \; send-keys -X begin-selection \; send-keys -X jump-to-forward "'"
bind-key -T copyModeMultiKey_i \" send-keys -X clear-selection \; send-keys -X jump-to-backward '"' \; send-keys -X begin-selection \; send-keys -X jump-to-forward '"'
bind-key -T copyModeMultiKey_i l send-keys -X clear-selection \; send-keys -X back-to-indentation \; send-keys -X begin-selection \; send-keys -X end-of-line \; send-keys -X cursor-left \; send-keys -X other-end
# Jump to last window with prefix-l
bind '\' last-window
bind 'C-\' last-window
# Copy mode colors
set -g mode-style bg=green,fg=black,blink
# vi bindings to switch panes
bind h select-pane -L
bind C-h select-pane -L
bind j select-pane -D
bind C-j select-pane -D
bind k select-pane -U
bind C-k select-pane -U
bind l select-pane -R
bind C-l select-pane -R
# Somewhat tmux-copycat functionality (requires 3.1+)
bind / copy-mode \; send ?
bind C-u copy-mode \; send -X search-backward "(https?://|git@|git://|ssh://|ftp://|file:///)[[:alpha:]+][[:alnum:]?=%/_.:,;~@!#$&*+-]*"
bind C-f copy-mode \; send -X search-backward "(^|^\.|[[:space:]]|[[:space:]]\.|[[:space:]]\.\.|^\.\.)[[:alnum:]~_-]*/[][[:alnum:]_.#$%&+=/@-]*"
## AESTHETICS
# Visual feedback on window activity
set-window-option -g monitor-activity on
set-option -g visual-activity on
# Theme
# based on https://github.com/dracula/tmux/blob/master/scripts/dracula.sh
set -g @white '#f8f8f2'
set -g @gray '#44475a'
set -g @dark_gray '#282a36'
set -g @light_purple '#bd93f9'
set -g @dark_purple '#6272a4'
set -g @cyan '#8be9fd'
set -g @green '#50fa7b'
set -g @orange '#ffb86c'
set -g @red '#ff5555'
set -g @pink '#ff79c6'
set -g @yellow '#f1fa8c'
set -g @left_icon "☺"
flags="#{?window_flags,#[fg=#{@white}]#{window_flags},} "
current_flags="#{?window_flags,#[fg=#{@light_purple}]#{s/\\*//:window_flags},}"
set-option -g pane-active-border-style "fg=#{@light_purple}"
set-option -g pane-border-style "fg=#{@gray}"
set-option -g message-style "bg=#{@gray},fg=#{@white}"
set-option -g status-style "bg=#{@gray},fg=#{@white}"
set-option -g status-left "#[bg=#{@green},fg=#{@dark_gray}]#{?client_prefix,#[bg=#{@yellow}],} #{@left_icon} "
set-window-option -g window-status-current-format "#[fg=#{@white},bg=#{@dark_purple}] ➤#I #W${current_flags} "
set-window-option -g window-status-format "#[fg=#{@white}]#[bg=#{@gray}] #I #W${flags}"
# History scroll size
set-option -g history-limit 5000
# status bar with:
# - fear and greed index
# - crypto price
set -g status-right-length 100
set-option -g status-interval 60
set -g status-right "#{prefix_highlight} #($HOME/.tmux/scripts/fear-and-greed) #($HOME/.tmux/scripts/crypto-price btc) | %R [#H]"
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'schasse/tmux-jump'
set -g @jump-key 'J'
# Import macos specific
if-shell 'test "$(uname -s)" = Darwin' 'source-file ~/.tmux-osx.conf'
# Install tpm and plugins if not yet installed
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 (should be at bottom)
run -b '~/.tmux/plugins/tpm/tpm'