2024-01-23 15:55:40 +03:00
|
|
|
# Remap <C-b> to <C-t>.
|
2023-08-08 16:24:15 +03:00
|
|
|
unbind-key C-b
|
|
|
|
set-option -g prefix C-t
|
|
|
|
bind-key C-t send-prefix
|
|
|
|
|
2024-01-23 15:55:40 +03:00
|
|
|
# Disable escape delay.
|
2023-08-08 16:24:15 +03:00
|
|
|
set -sg escape-time 0
|
|
|
|
|
2024-01-23 15:55:40 +03:00
|
|
|
# Remap split keys.
|
2023-12-14 00:13:26 +03:00
|
|
|
bind -n M-\\ split-window -h -c "#{pane_current_path}"
|
2024-02-13 04:07:58 +03:00
|
|
|
bind -n M-- split-window -v -c "#{pane_current_path}"
|
2023-12-14 00:13:26 +03:00
|
|
|
bind -n M-= select-layout tiled
|
2024-02-04 02:23:36 +03:00
|
|
|
bind -n M-W resize-pane -U 1
|
|
|
|
bind -n M-S resize-pane -D 1
|
|
|
|
bind -n M-A resize-pane -L 1
|
|
|
|
bind -n M-D resize-pane -R 1
|
2023-08-08 16:24:15 +03:00
|
|
|
unbind '"'
|
|
|
|
unbind %
|
|
|
|
|
2024-01-23 15:55:40 +03:00
|
|
|
# Reload config.
|
2023-11-18 05:42:23 +03:00
|
|
|
bind -n M-r source-file ~/.config/tmux/tmux.conf
|
2023-08-08 16:24:15 +03:00
|
|
|
|
2024-01-23 15:55:40 +03:00
|
|
|
# Swith panes with alt + hjkl.
|
2023-08-08 16:24:15 +03:00
|
|
|
bind -n M-a select-pane -L
|
|
|
|
bind -n M-d select-pane -R
|
|
|
|
bind -n M-w select-pane -U
|
|
|
|
bind -n M-s select-pane -D
|
|
|
|
|
2024-01-23 15:55:40 +03:00
|
|
|
# Close pane.
|
2023-08-08 16:24:15 +03:00
|
|
|
bind -n M-c kill-pane
|
2023-12-28 20:39:23 +03:00
|
|
|
bind -n M-C kill-pane -a
|
2023-08-08 16:24:15 +03:00
|
|
|
|
2024-01-23 15:55:40 +03:00
|
|
|
# Create new window.
|
2023-11-08 02:59:01 +03:00
|
|
|
bind -n M-Escape new-window -c "#{pane_current_path}"
|
2024-02-13 04:07:58 +03:00
|
|
|
bind -n M-t new-window -c "#{pane_current_path}" # NOTE: for compatibility with Termux as it does not support <C-Esc> yet.
|
2023-08-08 16:24:15 +03:00
|
|
|
|
2024-01-23 15:55:40 +03:00
|
|
|
# Close window.
|
2023-08-08 16:24:15 +03:00
|
|
|
bind -n M-x kill-window
|
2023-12-28 20:39:23 +03:00
|
|
|
bind -n M-X kill-window -a
|
2023-08-08 16:24:15 +03:00
|
|
|
|
2024-01-23 15:55:40 +03:00
|
|
|
# Switch window.
|
2023-08-08 16:24:15 +03:00
|
|
|
bind -n M-e next-window
|
|
|
|
bind -n M-q previous-window
|
|
|
|
|
2024-01-23 15:55:40 +03:00
|
|
|
# Move window.
|
2023-08-08 16:24:15 +03:00
|
|
|
bind -n M-E swap-window -t +1\; select-window -t +1
|
|
|
|
bind -n M-Q swap-window -t -1\; select-window -t -1
|
|
|
|
|
2024-01-23 15:55:40 +03:00
|
|
|
# Detach.
|
2023-08-08 16:24:15 +03:00
|
|
|
bind -n M-z detach-client
|
2023-12-28 20:39:23 +03:00
|
|
|
bind -n M-Z detach-client -a
|
2023-08-08 16:24:15 +03:00
|
|
|
|
2024-01-23 15:55:40 +03:00
|
|
|
# Scroll.
|
2023-08-08 16:24:15 +03:00
|
|
|
bind -n M-p copy-mode -u
|
|
|
|
bind -n M-n send-keys Pagedown
|
|
|
|
|
2024-01-23 15:55:40 +03:00
|
|
|
# Copy mode.
|
2023-08-08 16:24:15 +03:00
|
|
|
setw -g mode-keys vi
|
|
|
|
bind -n M-v copy-mode
|
2024-02-13 03:53:28 +03:00
|
|
|
bind -n M-P choose-buffer
|
2024-02-13 04:07:58 +03:00
|
|
|
bind -T copy-mode-vi v send -X begin-selection
|
2023-08-08 16:24:15 +03:00
|
|
|
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
|
|
|
|
|
2024-01-23 15:55:40 +03:00
|
|
|
# Switch sessions.
|
|
|
|
bind -n M-9 switch-client -p
|
|
|
|
bind -n M-0 switch-client -n
|
|
|
|
bind -n M-g choose-session
|
2023-12-14 00:13:26 +03:00
|
|
|
|
2023-12-09 01:10:04 +03:00
|
|
|
# Resize to smallest client.
|
|
|
|
set -g window-size smallest
|
|
|
|
|
2024-01-23 15:55:40 +03:00
|
|
|
# Statusbar.
|
2024-02-13 04:07:58 +03:00
|
|
|
set -g status-interval 2
|
2023-08-08 16:24:15 +03:00
|
|
|
set -g status-position bottom
|
2024-02-13 04:19:44 +03:00
|
|
|
set -g status-justify left
|
2024-02-13 03:39:00 +03:00
|
|
|
set -g status-style 'bg=color236 fg=color187'
|
2024-02-13 04:07:58 +03:00
|
|
|
|
|
|
|
set -g status-left ' #[bold]#H-#S #(count=$(tmux list-clients -t #S | wc -l); [ ${count} -gt 1 ] && echo "(${count}) ")'
|
2024-01-04 18:36:24 +03:00
|
|
|
set -g status-left-length 50
|
2024-02-13 04:07:58 +03:00
|
|
|
set -g status-right '#[fg=color187,bg=color239] #(head -c -1 /sys/class/power_supply/BAT*/capacity 2> /dev/null && echo -n "% ")%Y-%m-%d #[bold]%H:%M '
|
|
|
|
set -g status-right-length 50
|
2023-08-08 16:24:15 +03:00
|
|
|
|
2024-02-13 04:07:58 +03:00
|
|
|
setw -g window-status-current-style 'fg=black bg=color143 bold'
|
2024-02-13 04:19:44 +03:00
|
|
|
setw -g window-status-current-format ' #[fg=black]#W#[fg=black]#F '
|
2023-08-08 16:24:15 +03:00
|
|
|
|
2024-02-13 04:07:58 +03:00
|
|
|
setw -g window-status-style 'fg=black bg=color138'
|
|
|
|
setw -g window-status-format ' #[fg=black]#W#[fg=black] '
|
2023-08-08 16:24:15 +03:00
|
|
|
|
|
|
|
setw -g window-status-bell-style 'fg=black bg=white bold'
|
2024-01-04 19:27:33 +03:00
|
|
|
|
2024-02-13 04:07:58 +03:00
|
|
|
# Selection style.
|
|
|
|
set -g mode-style 'fg=black,bg=yellow bold'
|
|
|
|
|
|
|
|
# Update environment from client.
|
2024-02-06 20:32:53 +03:00
|
|
|
set-option -g update-environment "SSH_CLIENT SSH_TTY DOCKER_CONFIG DOCKER_HOST DISPLAY XAUTHORITY"
|