-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
188 lines (143 loc) · 5.73 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
#--------------------------------------------------------------------------
# Configuration
#--------------------------------------------------------------------------
# Screen-like Control
unbind C-b
set-option -g detach-on-destroy off
set-option -g prefix C-a
set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
set -gF mouse on
bind m set -gF mouse "#{?mouse,off,on}" # Toggle mouse on/off
setw -g automatic-rename on # rename window to reflect current program
set -g renumber-windows on # renumber windows when a window is closed
set -g default-terminal "${TERM}"
set-option -ga terminal-overrides ",${TERM}:Tc"
set -g status-keys vi
set -g history-limit 100000
# A bell in another window should cause a bell in the current window
set -g bell-action any
# Don't show distracting notifications
set -g visual-bell off
set -g visual-activity off
set-option -g set-titles on
set-option -g focus-events on
setw -g mode-keys vi
setw -g monitor-activity on
set -g display-panes-time 2000
set -g pane-base-index 1
set -sg escape-time 0 # No delay for escape key press
set -sg repeat-time 300 # increase repeat timeout
#--------------------------------------------------------------------------
# Status line
#--------------------------------------------------------------------------
# --> Catppuccin
thm_bg="#1e1e28"
thm_fg="#dadae8"
thm_cyan="#c2e7f0"
thm_black="#15121c"
thm_gray="#332e41"
thm_magenta="#c6aae8"
thm_pink="#e5b4e2"
thm_red="#e38c8f"
thm_green="#b1e3ad"
thm_yellow="#ebddaa"
thm_blue="#a4b9ef"
thm_orange="#f9c096"
thm_black4="#575268"
# Status line customisation
set-option -g status-left-length 100
# set-option -g status-right-length 100
set-option -g status-left " #[fg=${thm_red},bg=${thm_bg}]#{session_name} "
# set-option -g status-right "#{pane_title} "
set-option -g status-style "fg=${thm_fg} bg=${thm_bg}" # default will set the background to transparent
set-option -g window-status-format "#{window_index}:#{window_name}#{window_flags} " # window_name -> pane_current_command
set-option -g window-status-current-format "#{window_index}:#{window_name}#{window_flags} "
set-option -g window-status-current-style "fg=${thm_orange}"
set-option -g window-status-activity-style none
#--------------------------------------------------------------------------
# Key Bindings
#--------------------------------------------------------------------------
# -r means that the bind can repeat without entering prefix again
# -n means that the bind doesn't use the prefix
# buffers
bind b list-buffers # list paste buffers
bind p paste-buffer # paste from the top paste buffer
bind P choose-buffer # choose which buffer to paste from
bind x setw synchronize-panes
# create session
bind C-c new-session
# find session
bind -r f command-prompt -p find-session 'switch-client -t %%'
bind-key -n F3 choose-session
# switch to last active window
bind Tab last-window
# Split window
bind-key v split-window -h -c "#{pane_current_path}"
bind-key s split-window -v -c "#{pane_current_path}"
# pane resizing
bind -r H resize-pane -L 6
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Smart pane switching with awareness of Vim splits and fzf.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim_or_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$' \
|| ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE 'fzf'" # check for fzf
bind-key -n 'C-h' if-shell "$is_vim_or_fzf" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim_or_fzf" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim_or_fzf" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim_or_fzf" 'send-keys C-l' 'select-pane -R'
bind w kill-pane
bind > swap-pane -D # swap current pane with the next one
bind < swap-pane -U # swap current pane with the previous one
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Alt arrow to switch windows
bind -n M-p previous-window
bind -n M-n next-window
# Start a floating pane
bind-key p if-shell -F '#{==:#{session_name},floating}' {
detach-client
} {
popup -d '#{pane_current_path}' -xC -yC -w80% -h80% 'tmux new -A -s floating'
}
# Start a floating pane
bind-key g if-shell -F '#{==:#{session_name},floating}' {
detach-client
} {
popup -d '#{pane_current_path}' -xC -yC -w80% -h80% 'gitui'
}
# switch between two most recently used sessions
bind -n M-Tab switch-client -l
# Reload tmux config
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
bind-key -n F2 run-shell "tmux neww $HOME/local/bin/tmux-sessionizer.sh"
# tmux-prefix-highlight settings
set -g @prefix_highlight_fg 'red'
set -g @prefix_highlight_bg 'blue'
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_show_sync_mode 'on'
# tmux-open settings
# set -g @open-S 'https://www.google.com/'
set -g @open 'o'
set -g @open-editor 'C-e'
# tmux-thumgs settings
set -g @thumbs-command 'echo -n {} | ccopy'
# NOTE: you can use vars with $<var> and ${<var>} as long as the str is double quoted: ""
# WARNING: hex colors can't contain capital letters
# --------=== Modes
setw -g clock-mode-colour "${thm_blue}"
setw -g mode-style "fg=${thm_pink} bg=${thm_black4} bold"
# List of plugins
set -g @plugin 'tmux-plugins/tmux-urlview'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'fcsonline/tmux-thumbs'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'