Skip to content

Instantly share code, notes, and snippets.

@charud
Last active January 22, 2016 11:30
Show Gist options
  • Save charud/96cce2da91ac13bd0813 to your computer and use it in GitHub Desktop.
Save charud/96cce2da91ac13bd0813 to your computer and use it in GitHub Desktop.
# mouse support
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
set -g mouse-utf8 on
set -g mouse on
# ctrl+a instead of ctrl+b
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# use vim shortcuts
set -g status-keys vi
setw -g mode-keys vi
# selection mode
bind-key v copy-mode
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
# copy selection to clipboard by pressing y
bind-key -t vi-copy 'y' copy-pipe "pbcopy"
# no status line
set -g status off
# ctrl+a ctrl+a to switch between windows
bind-key C-a last-window
set -g default-terminal "screen"
# pane colors
set -g pane-border-fg colour23
set -g pane-active-border-fg colour23
set -g pane-active-border-bg default
bind-key C-j swap-pane -D
bind-key C-k swap-pane -U
# resize pane with hjkl rather than arrow keys
bind-key h resize-pane -L 5
bind-key j resize-pane -D 5
bind-key k resize-pane -U 5
bind-key l resize-pane -R 5
# Smart pane switching with awareness of vim splits
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# don't close pane with ctrl+d
set-environment -g 'IGNOREEOF' 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment