2025-01-17 09:27:59 +00:00
|
|
|
# ╭──────┬───────╮
|
|
|
|
# │ tmux │ setup │
|
|
|
|
# ╰──────┴───────╯
|
|
|
|
|
|
|
|
rwx_tmux_setup() {
|
2025-01-17 23:19:15 +00:00
|
|
|
local file
|
|
|
|
file="${HOME}/.tmux.conf"
|
|
|
|
rwx_file_write "${file}" "\
|
2025-01-18 13:39:03 +00:00
|
|
|
# first index number
|
|
|
|
set-option -g base-index 1
|
2025-01-18 16:04:45 +00:00
|
|
|
set-option -g pane-base-index 1
|
2025-01-17 23:15:17 +00:00
|
|
|
# display duration
|
2025-01-17 23:37:58 +00:00
|
|
|
set-option -g display-time 1536
|
2025-01-17 11:15:11 +00:00
|
|
|
# reload configuration
|
2025-01-17 23:37:58 +00:00
|
|
|
bind-key r source-file ${file} \\; display-message 'Source: ${file}'
|
2025-01-17 23:15:17 +00:00
|
|
|
# toggle mouse
|
2025-01-17 23:37:58 +00:00
|
|
|
bind-key t set-option -g mouse \\; display-message 'Mouse: #{mouse}'
|
2025-01-17 09:27:59 +00:00
|
|
|
|
2025-01-17 14:37:37 +00:00
|
|
|
# select sessions with Alt & ↑ | ↓
|
2025-01-17 23:37:58 +00:00
|
|
|
bind-key -n M-Down switch-client -n
|
|
|
|
bind-key -n M-Up switch-client -p
|
2025-01-17 14:37:37 +00:00
|
|
|
|
2025-01-17 13:44:23 +00:00
|
|
|
# empty name for windows
|
2025-01-17 23:37:58 +00:00
|
|
|
set-option -g automatic-rename on
|
2025-01-18 14:49:40 +00:00
|
|
|
set-option -g automatic-rename-format '#{pane_current_command}'
|
2025-01-17 23:42:26 +00:00
|
|
|
# extend history limit
|
|
|
|
set-option -g history-limit 1048576
|
2025-01-17 11:15:11 +00:00
|
|
|
# enable mouse actions
|
2025-01-17 23:37:58 +00:00
|
|
|
set-option -g mouse on
|
2025-01-17 11:15:11 +00:00
|
|
|
# renumber windows after closing one
|
2025-01-17 23:37:58 +00:00
|
|
|
set-option -g renumber-windows on
|
2025-01-18 16:00:59 +00:00
|
|
|
# status lines
|
2025-01-18 16:35:14 +00:00
|
|
|
set-option -g status 3
|
2025-01-17 09:27:59 +00:00
|
|
|
|
2025-01-17 13:33:35 +00:00
|
|
|
# enable title
|
2025-01-17 23:37:58 +00:00
|
|
|
set-option -g set-titles on
|
2025-01-17 13:33:35 +00:00
|
|
|
# set title to working directory
|
2025-01-18 18:53:26 +00:00
|
|
|
#set-option -g set-titles-string ''
|
2025-01-17 09:27:59 +00:00
|
|
|
|
2025-01-17 11:35:21 +00:00
|
|
|
# status bar
|
2025-01-17 23:37:58 +00:00
|
|
|
set-option -g status-bg black
|
|
|
|
set-option -g status-fg gray
|
2025-01-18 19:11:16 +00:00
|
|
|
set-option -g status-format[1] '\
|
|
|
|
#[fg=yellow]#{session_name}#{W: #{?window_active,#[fg=green],#[fg=default]}#{window_index}#{?window_flags,#{window_flags}, } #{window_name}}#[align=right] #[fg=blue]#{pane_width}×#{pane_height}#{P: #{?pane_active,#[fg=green],#[fg=default]}#{pane_index}}\
|
|
|
|
'
|
|
|
|
set-option -g status-format[2] '\
|
|
|
|
#[fg=cyan]#{pane_current_path}\
|
|
|
|
#[align=right]\
|
|
|
|
#[fg=yellow]%Y-%m-%d %H:%M:%S\
|
|
|
|
'
|
2025-01-17 23:37:58 +00:00
|
|
|
set-option -g status-interval 1
|
|
|
|
set-option -g status-position top
|
2025-01-17 09:27:59 +00:00
|
|
|
|
2025-01-17 11:40:51 +00:00
|
|
|
# style for messages
|
|
|
|
set-option -g message-style bg=red,fg=white
|
|
|
|
# style for pane borders
|
|
|
|
set-option -g pane-active-border-style bg=black,fg=green
|
|
|
|
set-option -g pane-border-style bg=black,fg=gray
|
2025-01-17 09:27:59 +00:00
|
|
|
|
2025-01-17 11:21:37 +00:00
|
|
|
# prefix with ^B or F12
|
|
|
|
set-option -g prefix C-b
|
|
|
|
set-option -g prefix2 F12
|
2025-01-17 09:27:59 +00:00
|
|
|
|
2025-01-17 12:50:06 +00:00
|
|
|
# enable activity monitoring
|
2025-01-17 23:37:58 +00:00
|
|
|
set-window-option -g monitor-activity on
|
2025-01-17 12:50:06 +00:00
|
|
|
# activity style
|
|
|
|
set -g window-status-activity-style bg=black,fg=red
|
|
|
|
# disable silence monitoring
|
2025-01-17 23:37:58 +00:00
|
|
|
set-window-option -g monitor-silence 0
|
2025-01-17 09:27:59 +00:00
|
|
|
|
2025-01-17 11:17:51 +00:00
|
|
|
# bind key to detach client
|
2025-01-17 23:37:58 +00:00
|
|
|
bind-key -n F6 detach-client
|
2025-01-17 09:27:59 +00:00
|
|
|
|
2025-01-17 18:51:17 +00:00
|
|
|
# swap window with next or previous
|
2025-01-17 23:37:58 +00:00
|
|
|
bind-key M-Left swap-window -t -1
|
|
|
|
bind-key M-Right swap-window -t +1
|
2025-01-17 09:27:59 +00:00
|
|
|
|
2025-01-17 11:27:55 +00:00
|
|
|
# create new window with F2
|
2025-01-17 23:37:58 +00:00
|
|
|
bind-key -n F2 new-window
|
2025-01-17 11:27:55 +00:00
|
|
|
# previous or next window with Alt & ← | →
|
2025-01-17 23:37:58 +00:00
|
|
|
bind-key -n M-Left previous-window
|
|
|
|
bind-key -n M-Right next-window
|
2025-01-17 09:27:59 +00:00
|
|
|
|
2025-01-17 13:25:25 +00:00
|
|
|
# select panes with Ctrl & Shift & ←↑↓→
|
2025-01-17 23:37:58 +00:00
|
|
|
bind-key -n C-S-Down select-pane -D
|
|
|
|
bind-key -n C-S-Left select-pane -L
|
|
|
|
bind-key -n C-S-Right select-pane -R
|
|
|
|
bind-key -n C-S-Up select-pane -U
|
2025-01-17 09:27:59 +00:00
|
|
|
|
2025-01-17 12:53:35 +00:00
|
|
|
# horizontal split with H
|
2025-01-17 23:37:58 +00:00
|
|
|
bind-key h split-window -h
|
2025-01-17 12:53:35 +00:00
|
|
|
# vertical split with V
|
2025-01-17 23:37:58 +00:00
|
|
|
bind-key v split-window -v
|
2025-01-17 09:27:59 +00:00
|
|
|
"
|
|
|
|
}
|