rwx/sh/tmux.sh

92 lines
2.4 KiB
Bash
Raw Normal View History

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-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
set-option -g automatic-rename-format ''
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-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-17 23:37:58 +00:00
set-option -g set-titles-string '#(pwd)'
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
set-option -g status-interval 1
set-option -g status-left ''
set-option -g status-position top
set-option -g status-right '| #{session_name} | %Y-%m-%d %H:%M:%S'
2025-01-17 09:27:59 +00:00
2025-01-17 12:50:06 +00:00
# windows separator
2025-01-17 23:37:58 +00:00
set-option -g window-status-separator ' | '
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 13:19:50 +00:00
# windows style
set-window-option -g window-status-current-style bg=black,fg=green
set-window-option -g window-status-style bg=black,fg=gray
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
"
}