# ╭──────┬───────╮ # │ tmux │ setup │ # ╰──────┴───────╯ rwx_tmux_setup() { local file file="${HOME}/.tmux.conf" rwx_file_write "${file}" "\ # first index number set-option -g base-index 1 set-option -g pane-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 # status lines set-option -g status 3 # enable title set-option -g set-titles on # set title to working directory set-option -g set-titles-string '\ tmux / \ #{session_name} / \ #{window_index} #{window_name} / \ #{pane_index} #{pane_width}×#{pane_height}\ ' # status bar set-option -g status-bg black set-option -g status-fg gray set-option -g status-format[1] '\ #[fg=yellow]#{session_name}\ #{W: \ #{?window_active,#[fg=green],\ #{?window_activity_flag,#[fg=red],#[fg=default]}}\ #{window_index} \ #{window_name}\ #{?window_flags, #{window_flags},}\ }\ #[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\ ' set-option -g status-interval 1 set-option -g status-position top # 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 # 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 " }