Skip to content

Instantly share code, notes, and snippets.

@Apsu
Created November 20, 2013 17:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Apsu/7567592 to your computer and use it in GitHub Desktop.
Save Apsu/7567592 to your computer and use it in GitHub Desktop.
WIP tmux config
# Prefix and cycle
set-option -g prefix C-\\
bind C-\ last-window
# Reload config
bind r source-file ~/.tmux.conf
# vi copy-mode
setw -g mode-keys vi
# Add expected vim keybindings
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
# Smart pane switching with awareness of vim splits
bind -n M-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n M-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n M-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n M-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-l) || tmux select-pane -R"
# Quick copy-mode access
bind -n M-` copy-mode
# New window
bind -n M-t new-window
# Window naviation
bind -n M-n next-window
bind -n M-p previous-window
# Move windows
bind -n C-M-n swap-window -t +1
bind -n C-M-p swap-window -t -1
# Copy to clipboard
bind -t vi-copy Enter copy-pipe 'xclip -i -sel p -f | xclip -i -sel c'
# Move panes
bind -n M-, rotate-window -U
bind -n M-. rotate-window -D
# Cycle layouts
bind -n M-Space next-layout
# Split windows into panes
bind -n M-- split-window
bind -n M-| split-window -h
# Zoom!
bind -n M-z resize-pane -Z
# Parse URLs for launching
bind -n M-u capture-pane \; save-buffer /tmp/tmux-buffer \; new-window -n urlscan '$SHELL -c "urlscan -b < /tmp/tmux-buffer"'
# QUIET!!
set -g quiet on
# UTF8 is great
set -g status-utf8 on
# Less delay for commands; might disable complex chords
set -s escape-time 0
# Clamp TERM
set -g default-terminal "screen-256color"
# Show me your history
set -g history-limit 10000
# Set title
set -g set-titles on
set -g set-titles-string "#T"
# Renumber windows on deletion
set -g renumber-windows on
# Tweak pane borders a smidge
set -g pane-active-border-fg "#ffffff"
set -g pane-border-fg "#555555"
# Set default shell
set default-shell "/usr/bin/zsh"
# Powerline ahoy!
source '.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment