-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtmux.conf
More file actions
213 lines (170 loc) · 7.92 KB
/
tmux.conf
File metadata and controls
213 lines (170 loc) · 7.92 KB
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
205
206
207
208
209
210
211
212
213
# Tmux Configuration
# Author: Binoy Manoj
# GitHub: https://github.com/binoymanoj
# Install tpm (if not installed already) - tmux plugin manager
# git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm
# Reload config file
bind r source-file ~/.config/tmux/tmux.conf \; display-message "Config Reloaded!"
# prefix + I for installing newly added plugin
# Prefix CTRL+a (default: CTRL+b)
# unbind C-b
# set-option -g prefix C-a
# bind C-a send-prefix
# Set terminal color support
set -g default-terminal "tmux-256color"
set-option -sa terminal-features ',xterm-256color:RGB'
set -g mouse on # Enable mouse support
set -g focus-events on # Enable focus events for better Vim integration
set -g set-clipboard on # Enable system clipboard
set -g detach-on-destroy off # Don't exit from tmux when closing a session
# start window numbering from 1 instead of 0
set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on
# Enable terminal cursor shape changes
set-option -g terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[ q'
# Default to a block cursor (normal mode)
set -g @normal_cursor "\e[2 q" # Block cursor
set -g @insert_cursor "\e[6 q" # Line cursor
# Use Zsh's vi mode hooks
setw -g mode-keys vi
# Detect Zsh mode changes and update the cursor
bind-key -T vi-command Escape run-shell "printf '\e[2 q'"
bind-key -T vi-insert Escape run-shell "printf '\e[2 q'"
bind-key -T vi-insert Enter run-shell "printf '\e[6 q'"
# Vim-like copy mode bindings
# prefix + [ - to get into moving around mode in tmux then select using v and copy using y
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
bind-key -T copy-mode-vi 'r' send -X rectangle-toggle
# Copy to system clipboard
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
# Session Rename using Prefix + R
bind R command-prompt -I "#{session_name}" "rename-session '%%'"
# Set prefix key
# unbind C-b # Unbind default prefix
# set -g prefix C-Space # Set CTRL+SPACE as prefix
# Unbind existing pane navigation keys
unbind h
unbind j
unbind k
unbind l
# Use Ctrl + h/j/k/l for pane switching
# bind -n C-h select-pane -L
# bind -n C-j select-pane -D
# bind -n C-k select-pane -U
# bind -n C-l select-pane -R
# Ctrl is overlapping with Nvim switch split keybindings so, ALT instead
# bind -n M-h select-pane -L
# bind -n M-j select-pane -D
# bind -n M-k select-pane -U
# bind -n M-l select-pane -R
# Switch between windows with Ctrl + 1/2/3.... (not working with CTRL, so config with alt+1/2/3.... below)
# bind -n C-0 select-window -t :0
# bind -n C-1 select-window -t :1
# bind -n C-2 select-window -t :2
# bind -n C-3 select-window -t :3
# bind -n C-4 select-window -t :4
# bind -n C-5 select-window -t :5
# bind -n C-6 select-window -t :6
# bind -n C-7 select-window -t :7
# bind -n C-8 select-window -t :8
# bind -n C-9 select-window -t :9
# Switch between windows with Alt + 1/2/3....
bind -n M-0 select-window -t :0
bind -n M-1 select-window -t :1
bind -n M-2 select-window -t :2
bind -n M-3 select-window -t :3
bind -n M-4 select-window -t :4
bind -n M-5 select-window -t :5
bind -n M-6 select-window -t :6
bind -n M-7 select-window -t :7
bind -n M-8 select-window -t :8
bind -n M-9 select-window -t :9
# Splitting panes
bind | split-window -h -c "#{pane_current_path}"
bind \\ split-window -v -c "#{pane_current_path}"
# Vim keys to resize pane
bind -r h resize-pane -L 5
bind -r j resize-pane -D 5
bind -r k resize-pane -U 5
bind -r l resize-pane -R 5
bind -r m resize-pane -Z # to maximize current pane
# Utilities like sessionizer, open pdf and others
# bind-key f display-popup -E -w 80% -h 80% "~/.config/scripts/tmux-sessionizer.sh" # find and open in current session with popup
# bind-key F display-popup -E -w 80% -h 80% "~/.config/scripts/tmux-sessionizer.sh new" # find and open in a new session with popup
# bind-key o display-popup -E -w 80% -h 80% "~/.config/scripts/tmux-open-pdf.sh" # open pdf with popup
bind-key g run-shell "~/.config/scripts/tmux-open-github.sh" # opens github repository of the current project
# Smaller popup for sessionizer and open pdf
bind-key f display-popup -E -w 60% -h 60% "~/.config/scripts/tmux-sessionizer.sh"
bind-key F display-popup -E -w 60% -h 60% "~/.config/scripts/tmux-sessionizer.sh new"
bind-key -r H run-shell "~/.config/scripts/tmux-sessionizer.sh ~" # go home in new window
bind-key o display-popup -E -w 60% -h 60% -x C -y C "~/.config/scripts/tmux-open-pdf.sh"
bind-key s display-popup -E -w 80% -h 80% "~/.config/scripts/tmux-session-manager.sh"
# Centered smaller popup
# bind-key f display-popup -E -w 70% -h 70% -x C -y C "~/.config/scripts/tmux-sessionizer.sh"
# bind-key F display-popup -E -w 70% -h 70% -x C -y C "~/.config/scripts/tmux-sessionizer.sh new"
# bind-key o display-popup -E -w 70% -h 70% -x C -y C "~/.config/scripts/tmux-open-pdf.sh"
# TPM (Tmux Plugin Manager)
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'tmux-plugins/tmux-resurrect' # persist session after restarting computer
set -g @plugin 'tmux-plugins/tmux-continuum' # Automatically saves session every 15 mins
set -g @plugin 'thewtex/tmux-mem-cpu-load' # for cpu and memory usage in statusline
# set -g @plugin 'binoymanoj/tmux-zenflow' # Zen workflow plugin (sessionizer & open pdf)
set -g @resurrect-capture-pane-contents 'on'
set -g @continuum-restore 'on'
set -g @resurrect-save-shell-history 'on'
# =============================================
# MINIMAL THEME CONFIGURATION
# =============================================
# Define colors
BG_COLOR="#1A1D23"
ACTIVE_COLOR="#b4befe"
INACTIVE_COLOR="#6c7086"
TEXT_COLOR="#cdd6f4"
ACCENT_COLOR="#b4befe"
# Basic status bar setup
set -g status on
set -g status-position bottom
set -g status-interval 3
set -g status-justify left
# Status bar colors and style
set -g status-style "bg=$BG_COLOR,fg=$TEXT_COLOR"
set -g status-left-length 100
set -g status-right-length 100
# Pane borders
set -g pane-border-style "fg=#44475a"
set -g pane-active-border-style "fg=$ACTIVE_COLOR"
# Message style
set -g message-style "bg=$BG_COLOR,fg=$TEXT_COLOR,bold"
set -g message-command-style "bg=$BG_COLOR,fg=$TEXT_COLOR,bold"
# Window status format - using dots instead of asterisks
set -g window-status-format "#[fg=$INACTIVE_COLOR,bg=$BG_COLOR] #I:#W "
set -g window-status-current-format "#[fg=$ACTIVE_COLOR,bg=$BG_COLOR,bold] #I:#W "
# Window status separator
set -g window-status-separator ""
# Status left (session name with minimal styling)
set -g status-left "#[fg=$ACCENT_COLOR,bold] #S #[fg=$INACTIVE_COLOR]│ "
# Status right (current path and time)
# set -g status-right "#[fg=$TEXT_COLOR] #(echo #{pane_current_path} | sed \"s:^$HOME:~:\") #[fg=$INACTIVE_COLOR]│ #[fg=$ACCENT_COLOR]#(cat /sys/class/power_supply/BAT*/capacity 2>/dev/null || echo 'N/A')% #[fg=$INACTIVE_COLOR]│ #[fg=$ACTIVE_COLOR,bold]%I:%M %p "
# Status right (CPU %, RAM %, Battery %, Date)
set -g status-right "\
#[fg=$ACCENT_COLOR] #[fg=$TEXT_COLOR]#([ #{pane_current_path} = $HOME ] && echo '~' || basename #{pane_current_path}) \
#[fg=$INACTIVE_COLOR]│ \
#[fg=$ACCENT_COLOR] #[fg=$TEXT_COLOR]#(free | awk '/^Mem/ { printf(\"%.0f%%\", $3/$2 * 100 - 0.5) }' ) \
#[fg=$INACTIVE_COLOR]│ \
#[fg=$ACCENT_COLOR] #[fg=$TEXT_COLOR]#(date +%d) \
#[fg=$INACTIVE_COLOR]│ \
#[fg=$ACCENT_COLOR] #[fg=$TEXT_COLOR]#(date +%H:%M) \
#[fg=$INACTIVE_COLOR]│ \
#[fg=$ACCENT_COLOR] #[fg=$TEXT_COLOR]#(cat /sys/class/power_supply/BAT*/capacity 2>/dev/null || echo 'N/A')% "
# [fg=$ACCENT_COLOR] #[fg=$TEXT_COLOR]#(date +%I:%M\ %p) \ for 12 hour format
# Copy mode styling
set -g mode-style "bg=$ACTIVE_COLOR,fg=$BG_COLOR"
# Clock mode
set -g clock-mode-colour "$ACTIVE_COLOR"
set -g clock-mode-style 24
# Initialize TPM (keep this line at the very bottom)
run '~/.tmux/plugins/tpm/tpm'