dotfiles/tmux/.tmux.conf

86 lines
3.2 KiB
Bash

set -g status-bg colour0
set -g status-fg colour7
set -sg escape-time 0
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9
bind-key -n M-0 select-window -t 10
bind-key -n M-! swap-window -t 1
bind-key -n M-@ swap-window -t 2
bind-key -n M-# swap-window -t 3
bind-key -n M-$ swap-window -t 4
bind-key -n M-% swap-window -t 5
bind-key -n M-^ swap-window -t 6
bind-key -n M-& swap-window -t 7
bind-key -n M-* swap-window -t 8
bind-key -n M-( swap-window -t 9
bind-key -n M-) swap-window -t 10
bind-key S new-session
bind-key T switch-client -l
bind-key Right resize-pane -R 8
bind-key Left resize-pane -L 8
bind-key Up resize-pane -U 4
bind-key Down resize-pane -D 4
set -g default-terminal "screen-256color"
set -as terminal-features ",*:RGB"
set -g base-index 1
setw -g base-index 1
set -g set-titles on
set -g set-titles-string "#H [#S]"
set -g status-justify centre
set -g status-left " #[fg=green]#[bg=green]#[fg=black] #H #[bg=default]#[fg=green]#[fg=default] #S"
set -g status-left-length 50
set -g status-right "#[fg=green]#[bg=green]#[fg=black] %H:%M #[bg=default]#[fg=green] "
set-window-option -g window-status-current-format '#[fg=green]#[bg=green]#[fg=black] #I:#W#F #[fg=green]#[bg=black]'
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'"
bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R'
bind-key -n 'M-n' if-shell "$is_vim" 'send-keys M-n' 'select-window -n'
bind-key -n 'M-p' if-shell "$is_vim" 'send-keys M-p' 'select-window -p'
bind-key -T copy-mode-vi 'M-h' select-pane -L
bind-key -T copy-mode-vi 'M-j' select-pane -D
bind-key -T copy-mode-vi 'M-k' select-pane -U
bind-key -T copy-mode-vi 'M-l' select-pane -R
bind-key -T copy-mode-vi 'M-n' select-window -n
bind-key -T copy-mode-vi 'M-p' select-window -p
bind -n 'M-H' if-shell "$is_vim" 'send-keys M-H' 'resize-pane -L 1'
bind -n 'M-J' if-shell "$is_vim" 'send-keys M-J' 'resize-pane -D 1'
bind -n 'M-K' if-shell "$is_vim" 'send-keys M-K' 'resize-pane -U 1'
bind -n 'M-L' if-shell "$is_vim" 'send-keys M-L' 'resize-pane -R 1'
bind-key -T copy-mode-vi M-H resize-pane -L 1
bind-key -T copy-mode-vi M-J resize-pane -D 1
bind-key -T copy-mode-vi M-K resize-pane -U 1
bind-key -T copy-mode-vi M-L resize-pane -R 1
bind -n 'C-M-h' if-shell "$is_vim" 'send-keys C-M-h' 'swap-pane -s "{left-of}"'
bind -n 'C-M-j' if-shell "$is_vim" 'send-keys C-M-j' 'swap-pane -s "{down-of}"'
bind -n 'C-M-k' if-shell "$is_vim" 'send-keys C-M-k' 'swap-pane -s "{up-of}"'
bind -n 'C-M-l' if-shell "$is_vim" 'send-keys C-M-l' 'swap-pane -s "{right-of}"'
bind-key -T copy-mode-vi C-M-h swap-pane -s "{left-of}"
bind-key -T copy-mode-vi C-M-j swap-pane -s "{down-of}"
bind-key -T copy-mode-vi C-M-k swap-pane -s "{up-of}"
bind-key -T copy-mode-vi C-M-l swap-pane -s "{right-of}"