dotfiles/files/.tmux.conf

63 lines
2.1 KiB
Bash

# Set $TERM env
set -g default-terminal "screen-256color"
# No escape delay, so that one can still use vim
set -sg escape-time 0
# Set prefix to ^A
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Navigation
## Navigation in panes with C+hjkl integrated with vim
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
## Navigation in windows with alt+shift+jk
bind -n M-j select-window -p
bind -n M-k select-window -n
# Resizing
## Resize panes through C-M-{hjkl}
bind -n C-M-h resize-pane -L
bind -n C-M-j resize-pane -D
bind -n C-M-k resize-pane -U
bind -n C-M-l resize-pane -R
# Splitting
unbind %
unbind '"'
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# New windows use the same working directory
bind c new-window -c "#{pane_current_path}"
# Set window notifications
setw -g monitor-activity on
set -g visual-activity on
# Reload tmux conf
unbind r
bind r source-file ~/.tmux.conf \; display-message " Config reloaded".
# Reassign overloaded bindings
bind l send-keys 'C-l'
# Status bar
set -g status-bg colour237
set -g status-fg colour216
set -g status-attr dim
set-option -g status-left '#[fg=colour196][#[fg=default]#S#[fg=colour196]]#[fg=default] '
set-option -g status-right \
'#[fg=colour196][#[fg=default]#(echo $USER)#[fg=colour196]@\
#[fg=default]#h#[fg=colour196]]#[fg=default] \
#[fg=colour196][#[fg=default]#(date "+%H:%M %F")#[fg=colour196]]#[fg=defaultb'
# Current window
set-window-option -g window-status-current-bg colour215
set-window-option -g window-status-current-fg colour88
set-window-option -g window-status-current-format ' #I:#W#F '