dotfiles/tmux/tmux.conf

80 lines
2.7 KiB
Plaintext
Raw Permalink Normal View History

2022-11-03 13:42:15 +01:00
###############################################################################
## Colorinchis
###############################################################################
set -g default-terminal "screen-256color"
# default window title colors
set-window-option -g window-status-style fg=white
set-window-option -g window-status-style bg=default
set-window-option -g window-status-style dim
# active window title colors
set-window-option -g window-status-current-style fg=white
set-window-option -g window-status-current-style bg=default
set-window-option -g window-status-current-style bright
# Highlight active window
set-window-option -g window-status-current-style bg=green
# clean status bar
set -g status-right ''
set -g status-left ' '
set -g status-bg colour240
###############################################################################
## Uso y abuso
###############################################################################
# change prefix from C-b to C-a as screen
set -g prefix C-a
unbind C-b
bind-key C-a send-prefix
# split vertically with v
unbind %
bind | split-window -h
# split horizontally with h
unbind '"'
bind - split-window -v
# resize with vi keys and full pannel with m
bind -r j resize-pane -D 5
bind -r k resize-pane -U 5
bind -r l resize-pane -R 5
bind -r h resize-pane -L 5
bind -r m resize-pane -Z
# reload tmux config
unbind r
bind r source-file ~/.tmux.conf
# use mouse to scroll
setw -g mouse on
# con copy mode (prefix [) use vi movements
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send -X begin-selection # start selecting text with "v"
bind-key -T copy-mode-vi 'y' send -X copy-selection # copy text with "y"
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l