Skip to content

Instantly share code, notes, and snippets.

@hserang
Last active July 24, 2018 17:02
Show Gist options
  • Save hserang/9910da844db4583783afbef234ddc716 to your computer and use it in GitHub Desktop.
Save hserang/9910da844db4583783afbef234ddc716 to your computer and use it in GitHub Desktop.
# Control-a instead of Control-b
set -g prefix C-a
# Act like Vim
set-window-option -g mode-keys vi
# C-a and the vim directions select panes
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# use C-b v to paste the tmux buffer
bind v paste-buffer
# Look good
set-option -g default-terminal "screen-256color"
# mouse support (works in iTerm)
# Scroll your way into copy mode (scrollback buffer)
# and select text for copying with the mouse
#set-option -g mouse on
# scrollback buffer size increase
set -g history-limit 500000
# C-a C-a will swap to last used window
bind-key C-a last-window
# Start tab numbering at 1
set -g base-index 1
# Allows for faster key repetition
set -s escape-time 0
# status bar
set -g status-bg black
set -g status-fg white
set -g status-right '%m/%d %I:%M %p'
set-window-option -g window-status-current-fg yellow
# use | and - keys to split vertical and horizonal
bind | split-window -h
bind - split-window -v
# or vim it up with v and s
bind v split-window -h
bind s split-window -v -p 25
# dont split with %, thats dumb
unbind %
# Change cursor in vim to distinguish between insert and command mode
# Use in conjunciton with tmux-cursors.vim
set-option -g terminal-overrides '*88col*:colors=88,*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%p1%{2}%-%;%d\007'
# make pbcopy work like you want it to
# DEPENDENCY: brew install reattach-to-user-namespace
#set-option -g default-command "reattach-to-user-namespace -l bash"
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
# ???
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
# C-a and the direction keys resize panes
bind Right resize-pane -R 5
bind Left resize-pane -L 5
bind Up resize-pane -U 2
bind Down resize-pane -D 2
# C-a+y puts your tmux buffer in your clipboard
bind y send-keys "tmux showb | pbcopy\r"
# ssh
set -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION"
# Don't lose track of SSH_AGENT etc. from parent environment.
set -g update-environment -r
bind \ display-panes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment