Skip to content

Instantly share code, notes, and snippets.

@calvinf
Last active June 2, 2017 01:40
Show Gist options
  • Save calvinf/6243987 to your computer and use it in GitHub Desktop.
Save calvinf/6243987 to your computer and use it in GitHub Desktop.
Tmux Configuration
# C-b is not acceptable -- Vim uses it
set-option -g prefix C-a
bind-key C-a last-window
# Copy mode stuff
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'x' copy-selection
bind-key 'p' run-shell "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
bind-key 'y' send-keys x\; run-shell "tmux save-buffer - | reattach-to-user-namespace pbcopy"\; display-message "copied"
# C-@ for join pane shortcut
bind-key @ command-prompt -p "create pane from:" "join-pane -s ':%%'"
# urxvt tab like window switching (-n: no prior escape seq)
bind -n S-down new-window
bind -n S-left prev
bind -n S-right next
bind -n C-S-left swap-window -t -1
bind -n C-S-right swap-window -t +1
# navigation with ctrl-{h,j,k,l}
# # https://gist.github.com/mislav/5189704
bind -n C-k run-shell 'tmux-vim-select-pane -U'
bind -n C-j run-shell 'tmux-vim-select-pane -D'
bind -n C-h run-shell 'tmux-vim-select-pane -L'
bind -n C-l run-shell 'tmux-vim-select-pane -R'
bind -n "C-\\" run-shell 'tmux-vim-select-pane -l'
# reload tmux config
unbind r
bind r \
source-file ~/.tmux.conf \;\
display 'Reloaded tmux config.'
# turn mouse on (tmux 2.0+)
set -g mouse on
# turn mouse on (tmux < 2.0)
# 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 mouse on \;\
display 'Mouse: ON'
# Toggle mouse off
bind M \
set -g mouse off \;\
display 'Mouse: OFF'
# send control-A so it can work in bash
bind a send-prefix
# detach key
bind-key -n C-j detach
# start window numbering at 1
set -g base-index 1
# highlight active window
set-window-option -g window-status-current-bg blue
# Watch for activity in background windows
setw -g monitor-activity on
# Renumber windows automatically
set-option -g renumber-windows on
# terminal overrides
set -ga terminal-overrides 'xterm*:smcup@:rmcup@'
# mouse wheel
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
@calvinf
Copy link
Author

calvinf commented Aug 15, 2013

I got at lot of these from here:
http://mutelight.org/practical-tmux

@calvinf
Copy link
Author

calvinf commented Aug 15, 2013

Great place for overall Tmux info is here:
https://wiki.archlinux.org/index.php/Tmux

It's available on a lot of other distros, but the arch wiki seems to be the place I keep ending up at after doing a search for Tmux docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment