Skip to content

Instantly share code, notes, and snippets.

@nuance
Last active December 22, 2015 20:59
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 nuance/6529941 to your computer and use it in GitHub Desktop.
Save nuance/6529941 to your computer and use it in GitHub Desktop.
# First remove *all* keybindings
unbind-key -a
# Now reinsert all the regular tmux keys
bind-key C-b send-prefix
bind-key C-o rotate-window
bind-key C-z suspend-client
bind-key Space next-layout
bind-key ! break-pane
bind-key '"' split-window
bind-key '#' list-buffers
bind-key '$' command-prompt -I "#S" "rename-session '%%'"
bind-key % split-window -h
bind-key & confirm-before -p "kill-window #W? (y/n)" kill-window
bind-key "'" command-prompt -p index "select-window -t ':%%'"
bind-key ( switch-client -p
bind-key ) switch-client -n
bind-key , command-prompt -I "#W" "rename-window '%%'"
bind-key - delete-buffer
bind-key . command-prompt "move-window -t '%%'"
bind-key 0 select-window -t :0
bind-key 1 select-window -t :1
bind-key 2 select-window -t :2
bind-key 3 select-window -t :3
bind-key 4 select-window -t :4
bind-key 5 select-window -t :5
bind-key 6 select-window -t :6
bind-key 7 select-window -t :7
bind-key 8 select-window -t :8
bind-key 9 select-window -t :9
bind-key : command-prompt
bind-key \; last-pane
bind-key = choose-buffer
bind-key ? list-keys
bind-key D choose-client
bind-key L switch-client -l
bind-key [ copy-mode
bind-key ] paste-buffer
bind-key c new-window
bind-key d detach-client
bind-key f command-prompt "find-window '%%'"
bind-key i display-message
bind-key l last-window
bind-key n next-window
bind-key o select-pane -t :.+
bind-key p previous-window
bind-key q display-panes
bind-key r refresh-client
bind-key t clock-mode
bind-key w choose-window
bind-key x confirm-before -p "kill-pane #P? (y/n)" kill-pane
bind-key { swap-pane -U
bind-key } swap-pane -D
bind-key '~' show-messages
bind-key PPage copy-mode -u
bind-key -r Up select-pane -U
bind-key -r Down select-pane -D
bind-key -r Left select-pane -L
bind-key -r Right select-pane -R
bind-key M-1 select-layout even-horizontal
bind-key M-2 select-layout even-vertical
bind-key M-3 select-layout main-horizontal
bind-key M-4 select-layout main-vertical
bind-key M-5 select-layout tiled
bind-key M-n next-window -a
bind-key M-o rotate-window -D
bind-key M-p previous-window -a
bind-key -r M-Up resize-pane -U 5
bind-key -r M-Down resize-pane -D 5
bind-key -r M-Left resize-pane -L 5
bind-key -r M-Right resize-pane -R 5
bind-key -r C-Up resize-pane -U
bind-key -r C-Down resize-pane -D
bind-key -r C-Left resize-pane -L
bind-key -r C-Right resize-pane -R
unbind C-o
unbind C-b
set -g prefix C-o
# Ring the bell if any background window rang a bell
set -g bell-action any
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color
# Watch for activity in background windows
setw -g monitor-activity on
# Keep your finger on ctrl, or don't
bind-key ^D detach-client
bind-key ^C new-window
bind-key ^O last-window
bind-key ^N next-window
bind-key ^P previous-window
# Create splits and vertical splits
#bind-key v split-window -h
#bind-key ^V split-window -h
#bind-key s split-window
#bind-key ^S split-window
unbind -
unbind _
unbind '\'
unbind '|'
unbind s
unbind C-s
unbind v
unbind C-v
bind-key - split-window
bind-key _ split-window
bind-key s split-window
bind-key C-s split-window
bind-key \ split-window -h
bind-key | split-window -h
bind-key v split-window -h
bind-key C-v split-window -h
# Pane resize in all four directions using vi bindings.
# Can use these raw but I map them to Cmd-Opt-<h,j,k,l> in iTerm2.
# http://tangledhelix.com/blog/2012/04/28/iterm2-keymaps-for-tmux/
bind-key J resize-pane -D
bind-key K resize-pane -U
bind-key H resize-pane -L
bind-key L resize-pane -R
bind-key j previous-window
# Use vi keybindings for tmux commandline input.
# Note that to get command mode you need to hit ESC twice...
set -g status-keys vi
# Use vi keybindings in copy and choice modes
setw -g mode-keys vi
set -g history-limit 10000
setw -g aggressive-resize on
bind R refresh-client
bind a send-key C-a
# Vim-style copy/paste
unbind [
bind y copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy H start-of-line
bind -t vi-copy L end-of-line
bind -t vi-copy v begin-selection
bind -t vi-copy y copy-selection
bind -t vi-copy Escape cancel
# easily toggle synchronization (mnemonic: e is for echo)
# sends input to all panes in a given window.
bind e setw synchronize-panes on
bind E setw synchronize-panes off
# set first window to index 1 (not 0) to map more to the keyboard layout...
set -g base-index 1
setw -g pane-base-index 1
# + and - "zoom" and "unzoom" a pane.
# + breaks a pane out to its own window
# - restores a broken-out pane to being a pane
# This is native as of 1.8 (prefix z)
#unbind +
#bind + \
# new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' \;\
# swap-pane -s tmux-zoom.0 \;\
# select-window -t tmux-zoom
#
#unbind -
#bind - \
# last-window \;\
# swap-pane -s tmux-zoom.0 \;\
# kill-window -t tmux-zoom
# reload tmux config
unbind r
bind r \
source-file ~/.tmux.conf \;\
display 'Reloaded tmux config.'
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
# Toggle mouse on
bind m \
set -g mode-mouse on \;\
set -g mouse-resize-pane on \;\
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
display 'Mouse: ON'
# Toggle mouse off
bind M \
set -g mode-mouse off \;\
set -g mouse-resize-pane off \;\
set -g mouse-select-pane off \;\
set -g mouse-select-window off \;\
display 'Mouse: OFF'
# pass through xterm keys
set -g xterm-keys on
# color scheme (style based on vim-powerline)
set -g status-left-length 52
set -g status-right-length 451
set -g status-fg white
set -g status-bg colour234
set -g window-status-activity-attr bold
set -g pane-border-fg colour245
set -g pane-active-border-fg colour46
set -g message-fg colour16
set -g message-bg colour221
set -g message-attr bold
set -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S #[fg=colour252,bg=colour238,nobold]⮀#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold]⮀'
set -g window-status-format "#[fg=white,bg=colour234] #I #W "
set -g window-status-current-format "#[fg=colour234,bg=colour39]⮀#[fg=colour25,bg=colour39,noreverse,bold] #I ⮁ #W #[fg=colour39,bg=colour234,nobold]⮀"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment