94 lines
2.6 KiB
Bash
94 lines
2.6 KiB
Bash
# ╭──────┬───────╮
|
|
# │ tmux │ setup │
|
|
# ╰──────┴───────╯
|
|
|
|
rwx_tmux_setup() {
|
|
local file
|
|
file="${HOME}/.tmux.conf"
|
|
rwx_file_write "${file}" "\
|
|
# first index number
|
|
set-option -g base-index 1
|
|
# display duration
|
|
set-option -g display-time 1536
|
|
# reload configuration
|
|
bind-key r source-file ${file} \\; display-message 'Source: ${file}'
|
|
# toggle mouse
|
|
bind-key t set-option -g mouse \\; display-message 'Mouse: #{mouse}'
|
|
|
|
# select sessions with Alt & ↑ | ↓
|
|
bind-key -n M-Down switch-client -n
|
|
bind-key -n M-Up switch-client -p
|
|
|
|
# empty name for windows
|
|
set-option -g automatic-rename on
|
|
set-option -g automatic-rename-format '#{pane_current_command}'
|
|
# extend history limit
|
|
set-option -g history-limit 1048576
|
|
# enable mouse actions
|
|
set-option -g mouse on
|
|
# renumber windows after closing one
|
|
set-option -g renumber-windows on
|
|
|
|
# enable title
|
|
set-option -g set-titles on
|
|
# set title to working directory
|
|
set-option -g set-titles-string '#{pane_current_command} @ #{pane_current_path}'
|
|
|
|
# status bar
|
|
set-option -g status-bg black
|
|
set-option -g status-fg gray
|
|
set-option -g status-interval 1
|
|
set-option -g status-justify left
|
|
set-option -g status-left '#[fg=yellow]#{session_name} '
|
|
set-option -g status-position top
|
|
set-option -g status-right ' #[fg=yellow]%Y-%m-%d %H:%M:%S'
|
|
|
|
# windows separator
|
|
set-option -g window-status-separator ' '
|
|
|
|
# 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
|
|
|
|
# prefix with ^B or F12
|
|
set-option -g prefix C-b
|
|
set-option -g prefix2 F12
|
|
|
|
# enable activity monitoring
|
|
set-window-option -g monitor-activity on
|
|
# activity style
|
|
set -g window-status-activity-style bg=black,fg=red
|
|
# disable silence monitoring
|
|
set-window-option -g monitor-silence 0
|
|
|
|
# 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
|
|
|
|
# bind key to detach client
|
|
bind-key -n F6 detach-client
|
|
|
|
# swap window with next or previous
|
|
bind-key M-Left swap-window -t -1
|
|
bind-key M-Right swap-window -t +1
|
|
|
|
# create new window with F2
|
|
bind-key -n F2 new-window
|
|
# previous or next window with Alt & ← | →
|
|
bind-key -n M-Left previous-window
|
|
bind-key -n M-Right next-window
|
|
|
|
# select panes with Ctrl & Shift & ←↑↓→
|
|
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
|
|
|
|
# horizontal split with H
|
|
bind-key h split-window -h
|
|
# vertical split with V
|
|
bind-key v split-window -v
|
|
"
|
|
}
|