Skip to content

Instantly share code, notes, and snippets.

@mub
Last active December 27, 2015 07:19
Show Gist options
  • Save mub/7287571 to your computer and use it in GitHub Desktop.
Save mub/7287571 to your computer and use it in GitHub Desktop.
tmux goodies
# Whichever shell are now running
set-option -g default-shell $SHELL
set -g default-terminal "screen-256color"
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
# C-b is not acceptable -- Vim uses it (page back)
unbind C-b
set-option -g prefix C-a
bind-key C-a last-window
# Vim-like behavior:
setw -g mode-keys vi
#set -g mode-mouse on
#setw -g mouse-select-window on
#setw -g mouse-select-pane on
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
unbind [
bind ` copy-mode
unbind p
bind p paste-buffer
# Start numbering at 1
set -g base-index 1
# Allows for faster key repetition
set -s escape-time 0
# Set status bar
set -g status-bg black
set -g status-fg white
set -g status-left ""
set -g status-right "#[fg=green]#H"
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
setw -g aggressive-resize on
# Allows us to use C-a a <command> to send commands to a TMUX session inside
# another TMUX session
bind-key a send-prefix
# Activity monitoring
#setw -g monitor-activity on
#set -g visual-activity on
# Example of using a shell command in the status line
#set -g status-right "#[fg=yellow]#(uptime | cut -d ',' -f 2-)"
# Highlight active window
set-window-option -g window-status-current-bg red
# after copying to a tmux buffer, hit y again to copy to clipboard
bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"

With the properties defined by the .tmux.conf in this gist --

bind-key        C-a last-window                                                                                               bind-key -r     C-h select-window -t :-
bind-key -r     C-l select-window -t :+
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          ] paste-buffer
bind-key          ` copy-mode
bind-key          a send-prefix
bind-key          c new-window
bind-key          d detach-client
bind-key          f command-prompt "find-window '%%'"
bind-key          h select-pane -L
bind-key          i display-message
bind-key          j select-pane -D
bind-key          k select-pane -U
bind-key          l select-pane -R
bind-key          n next-window
bind-key          o select-pane -t :.+
bind-key          p paste-buffer
bind-key          q display-panes
bind-key          r refresh-client
bind-key          s choose-session
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          y run-shell "tmux save-buffer - | reattach-to-user-namespace pbcopy"
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment