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