Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
123 lines (95 sloc) 4.06 KB
# http://thedrearlight.com/blog/tmux-vim.html
# zsh is kinda tight
set-option -g default-shell $SHELL
# copy and paster
set-option -g default-command "reattach-to-user-namespace -l zsh"
# look good
set -g default-terminal "screen-256color"
# act like GNU screen
# `CTRL + a a` to go to the beginning of line annoys me.
# unbind C-b
# set -g prefix C-a
# http://robots.thoughtbot.com/tmux-copy-paste-on-os-x-a-better-future
# Use vim keybindings in copy mode
# https://github.com/Casecommons/casecommons_workstation/blob/master/templates/default/dot_tmux.conf.erb
set-window-option -g mode-keys vi
# Change cursor in vim to distinguish between insert and command mode
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'
# scrollback buffer size increase
set -g history-limit 500000
# https://github.com/tmux/tmux/issues/754#issuecomment-297452143
bind-key -T edit-mode-vi Up send-keys -X history-up
bind-key -T edit-mode-vi Down send-keys -X history-down
unbind-key -T copy-mode-vi Space ; bind-key -T copy-mode-vi v send-keys -X begin-selection
unbind-key -T copy-mode-vi Enter ; bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
unbind-key -T copy-mode-vi C-v ; bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
unbind-key -T copy-mode-vi [ ; bind-key -T copy-mode-vi [ send-keys -X begin-selection
unbind-key -T copy-mode-vi ] ; bind-key -T copy-mode-vi ] send-keys -X copy-selection
# http://pivotallabs.com/how-we-use-tmux-for-remote-pair-programming/
# Enable mouse support (works in iTerm)
# set-window-option -g mode-mouse on
# set-option -g mouse-select-pane on
# set-option -g mouse-resize-pane on
# set-option -g mouse-select-window on
# after copying to a tmux buffer, hit y again to copy to clipboard
# bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
bind a send-prefix
bind q confirm-before kill-session
bind d confirm-before detach
# https://gist.github.com/brunobuccolo/9bc40938b9c182662325
bind -n C-Right next-window
bind -n C-Left previous-window
bind -n C-Up new-window -c "#{pane_current_path}"
bind -n C-Down confirm-before kill-window
# swap window ctrl+shift+arrows(left/right)
# bind-key -n S-C-Left swap-window -t -1
# bind-key -n S-C-Right swap-window -t +1
bind-key -n C-Space swap-window -t +1
# http://unix.stackexchange.com/a/118381
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# switch panes ctrl+shift+arrows(up/down)
bind -n S-C-Up select-pane -U
bind -n S-C-Down select-pane -D
bind -n S-C-Left select-pane -L
bind -n S-C-Right select-pane -R
# https://github.com/LBRapid/dotfiles/blob/master/tmux.conf
# set the status line's colors
set -g status-fg white
set -g status-bg black
# set the color of the window list
setw -g window-status-fg cyan
setw -g window-status-bg default
setw -g window-status-attr dim
# set colors for the active window
setw -g window-status-current-fg white
setw -g window-status-current-bg red
setw -g window-status-current-attr bright
# command / message line colors
set -g message-fg white
set -g message-bg black
set -g message-attr bright
# pane colors
set -g pane-border-fg green
set -g pane-border-bg black
set -g pane-active-border-fg white
set -g pane-active-border-fg yellow
# set -g status-utf8 on
# status line left side
set -g status-left-length 40
set -g status-left "#[bold,fg=green]#S/#T:#[fg=yellow]#I"
# set -g status-left-length 100
# set -g status-left '#[fg=green] #T#[default]'
# status line right side
# 15% | 28 Nov 08:15AM
set -g status-right "#[bg=colour251,fg=colour240]%I:%M%p #[bg=colour240,fg=colour251] %d %b"
# update the status bar every sixty seconds
set -g status-interval 30
# center the window list
set -g status-justify centre
# http://unix.stackexchange.com/a/12091
# set -g default-path "$PWD"
# reload config without killing server
# ctrl+b+r
bind r source-file ~/.tmux.conf