Skip to content

Instantly share code, notes, and snippets.

@jexchan
Created May 12, 2014 09:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jexchan/69445b073aeb3fc1d473 to your computer and use it in GitHub Desktop.
Save jexchan/69445b073aeb3fc1d473 to your computer and use it in GitHub Desktop.
my tmux configuration
unbind C-b
set -g prefix C-a
setw -g mode-keys vi
set -s escape-time 1
set -g base-index 1
set -g pane-base-index 1
bind r source-file ~/.tmux.conf \; display "reloaded config file!"
# set -g pane-active-border-fg white
# set -g pane-active-border-bg yellow
# set -g status-left "Session:#S"
set -g status-right "#H #[fg-white,bg=default]%a %l:%M:%S %p, %d %b#[default] "
set -g status-justify centre
# split window like vim
# vim's defination of a horizontal/vertical split is revised from tumx's
bind s split-window -h
bind v split-window -v
# move arount panes wiht hjkl, as one would in vim after C-w
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# resize panes like vim
# feel free to change the "1" to however many lines you want to resize by,
# only one at a time can be slow
bind < resize-pane -L 10
bind > resize-pane -R 10
bind - resize-pane -D 10
bind + resize-pane -U 10
# bind : to command-prompt like vim
# this is the default in tmux already
bind : command-prompt
# ============ All about mouse manuplate =====================
# Make mouse useful in copy mode
setw -g mode-mouse on
# Allow mouse to select which pane to use
set -g mouse-select-pane on
# Allow mouse dragging to resize panes
set -g mouse-resize-pane on
# Allow mouse to select windows
set -g mouse-select-window on
# Allow xterm titles in terminal window, terminal scrolling with scrollbar, and setting overrides of C-Up, C-Down, C-Left, C-Right
# (commented out because it disables cursor navigation in vim)
#set -g terminal-overrides "xterm*:XT:smcup@:rmcup@:kUP5=\eOA:kDN5=\eOB:kLFT5=\eOD:kRIT5=\eOC"
# Scroll History
set -g history-limit 30000
# Set ability to capture on start and restore on exit window data when running an application
setw -g alternate-screen on
# Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access.
set -s escape-time 50
# 参考: http://foocoder.com/blog/zhong-duan-huan-jing-zhi-tmux.html/
# Copy and paste like in vim
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-selection
# getting tmux to copy a buffer to system clipboard
set-option -g default-command "reattach-to-user-namespace -l zsh" # or bash...
bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy" \; display-message "Copied tmux buffer to system clipboard"
bind C-v run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment