# ╭──────┬───────╮ # │ tmux │ setup │ # ╰──────┴───────╯ rwx_tmux_setup() { local file file="${HOME}/.tmux.conf" rwx_file_write "${file}" "\ # ╭────────╮ # │ option │ # ╰────────╯ # empty name for windows set-option -g automatic-rename-format '#{pane_current_command}' set-option -g automatic-rename on # first index number set-option -g base-index 1 # display duration set-option -g display-time 1536 # extend history limit set-option -g history-limit 1048576 # style for messages set-option -g message-style bg=red,fg=white # activity monitoring set-window-option -g monitor-activity on # silence monitoring set-window-option -g monitor-silence 0 # enable mouse actions set-option -g mouse on # prefix with ^B or F12 set-option -g prefix C-b set-option -g prefix2 F12 # 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 '\ tmux / \ #{session_name} / \ #{window_index} #{window_name} / \ #{pane_index} #{pane_width}×#{pane_height}\ ' # status lines set-option -g status 3 # ╭────────┬──────╮ # │ option │ pane │ # ╰────────┴──────╯ # first index number set-option -g pane-base-index 1 # ╭────────┬──────┬────────╮ # │ option │ pane │ border │ # ╰────────┴──────┴────────╯ # active style set-option -g pane-active-border-style bg=black,fg=green # regular style set-option -g pane-border-style bg=black,fg=gray # ╭────────┬────────╮ # │ option │ status │ # ╰────────┴────────╯ # background color set-option -g status-bg black # foreground color set-option -g status-fg gray # first line set-option -g status-format[0] '\ #{W:\ #{?window_active,#[fg=green],\ #{?window_activity_flag,#[fg=red],#[fg=default]}}\ #{window_index} \ #{window_name}\ #{?window_flags, #{window_flags},}\ \ }\ #[align=centre]\ #[fg=blue]#{session_name}\ #[align=right] \ #[fg=yellow]%Y-%m-%d\ ' # second line set-option -g status-format[1] '\ #{P:\ #{?pane_active,#[fg=green],#[fg=default]}\ #{pane_index}\ \ }\ #[align=centre]\ #[fg=blue]#{pane_width}×#{pane_height}\ #[align=right] \ #[fg=yellow]%H:%M:%S\ ' # third line set-option -g status-format[2] '\ #[fg=cyan]#{pane_current_path}\ ' # refresh period set-option -g status-interval 1 # bar location set-option -g status-position top # ╭─────╮ # │ key │ # ╰─────╯ # select sessions with Alt & ↑ | ↓ bind-key -n M-Down switch-client -n bind-key -n M-Up switch-client -p # ╭─────┬────────╮ # │ key │ prefix │ # ╰─────┴────────╯ # reload configuration bind-key r source-file ${file} \\; display-message 'source-file ${file}' # toggle mouse bind-key t set-option -g mouse \\; display-message 'mouse = #{mouse}' # ╭─╮ # ╰─╯ # 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 " }