Skip to content

Instantly share code, notes, and snippets.

@devth
Created July 25, 2014 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devth/8bc3d73fa8a9b7792bea to your computer and use it in GitHub Desktop.
Save devth/8bc3d73fa8a9b7792bea to your computer and use it in GitHub Desktop.
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
set-window-option -g mode-mouse on
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# Copying {{{
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
set-option -g default-command "reattach-to-user-namespace -l zsh"
# }}}
# hsplit
unbind %
bind | split-window -h
# vsplit
unbind '"'
bind - split-window -v
# Panes
bind up resize-pane -U 5
bind down resize-pane -D 5
bind left resize-pane -L 5
bind right resize-pane -R 5
# Smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l"
# Resize panes
bind H resize-pane -L 5
bind J resize-pane -D 5
bind K resize-pane -U 5
bind L resize-pane -R 5
# clear screen
bind C-l send-keys 'C-l'
# highlight status bar on activity
set -g visual-activity on
# change foreground-background for the current window
setw -g window-status-current-attr reverse
setw -g monitor-activity on
setw -g mode-keys vi
# Titles {{{
set-option -g set-titles on
set-option -g set-titles-string '#W(#P) - #T'
set-window-option -g automatic-rename on
# }}}
# Options {{{
set-option -g base-index 1
#set-option -g default-command "exec /usr/bin/login -pf superflo"
set-option -g mouse-select-pane on
set-option -g pane-active-border-fg black
set-option -g pane-active-border-bg cyan
set-option -g pane-border-fg white
set-option -g pane-border-bg black
#set-option -g default-shell /bin/bash
set-option -g status-keys vi
set-option -g history-limit 4096
set-option -s escape-time 100
# Set status bar
# set -g status-bg black
set -g status-fg white
set -g status-left '#[fg=green]#'
set-window-option -g window-status-current-bg red
# Set window notifications
setw -g monitor-activity on
set -g visual-activity on
# }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment