Skip to content

Instantly share code, notes, and snippets.

@szg251
Last active September 23, 2020 02:01
Show Gist options
  • Save szg251/2db3ccff05a4a2177d4a8eedd5cf294c to your computer and use it in GitHub Desktop.
Save szg251/2db3ccff05a4a2177d4a8eedd5cf294c to your computer and use it in GitHub Desktop.
tmux config
unbind C-o
#Terminal colors
set -g default-terminal "screen-256color"
#Vi mode
set-window-option -g mode-keys vi
##Panel switching
#bind h select-pane -L
#bind j select-pane -D
#bind k select-pane -U
#bind l select-pane -R
#Panel resizing
bind C-h resize-pane -L 5
bind C-j resize-pane -D 5
bind C-k resize-pane -U 5
bind C-l resize-pane -R 5
# 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"
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
#Panel swapping
bind J swap-pane -D
bind K swap-pane -U
bind-key -n C-a send-prefix
#bind-key -t vi-copy 'v' begin-selection
#bind-key -t vi-copy 'y' copy-selection
# scrollback buffer size increase
set -g history-limit 500000
# Highlight active window
set-window-option -g window-status-current-bg colour229
# Start tab numbering at 1
set -g base-index 1
set-option -sg escape-time 10
#Mouse
setw -g mouse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment