diff --git a/tmux/clean.sh b/tmux/clean.sh new file mode 100755 index 0000000..49780ce --- /dev/null +++ b/tmux/clean.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +rm -rf ~/.tmux.conf diff --git a/tmux/install.sh b/tmux/install.sh new file mode 100755 index 0000000..7165dd2 --- /dev/null +++ b/tmux/install.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +rm -rf ~/.tmux.conf + +ln -s $HOME/dotfiles/tmux/tmux.conf $HOME/.tmux.conf diff --git a/tmux/tmux.conf b/tmux/tmux.conf new file mode 100644 index 0000000..caaa2bb --- /dev/null +++ b/tmux/tmux.conf @@ -0,0 +1,79 @@ +############################################################################### +## 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