Skip to content

Instantly share code, notes, and snippets.

@iamsaso
Created August 23, 2016 21:03
Show Gist options
  • Save iamsaso/2750b5e3e8526651cdefda9d3f19fa77 to your computer and use it in GitHub Desktop.
Save iamsaso/2750b5e3e8526651cdefda9d3f19fa77 to your computer and use it in GitHub Desktop.
#unbind-key -a
set -g default-terminal "screen-256color"
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind | split-window -h
bind - split-window -v
bind r source-file ~/.tmux.conf
# don't rename windows automatically
set-option -g allow-rename off
# Smart pane switching with awareness of vim splits
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind \ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# vim
setw -g mode-keys vi
bind [ copy-mode
bind -t vi-copy v begin-selection
bind -t vi-copy y copy-selection
bind -t vi-copy V rectangle-toggle
bind ] paste-buffer
#set -g pane-border-style fg=defaut
#set -g pane-active-border-style fg=green
#set -g pane-active-border-style bg=default
set-option -g pane-border-fg white
set-option -g pane-active-border-fg green
set-option -g status-bg green
bind -n C-k send-keys -R \; clear-history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment