Skip to content

Instantly share code, notes, and snippets.

@nisc
Created December 8, 2011 16:56
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nisc/1447587 to your computer and use it in GitHub Desktop.
Save nisc/1447587 to your computer and use it in GitHub Desktop.
tmux config
###
### Bindings
###
unbind C-b
set -g prefix C-a
bind a send-prefix
# URL viewing
bind-key u capture-pane \; save-buffer /tmp/tmux-buffer \; run-shell "xterm -e 'cat /tmp/tmux-buffer | urlview'"
# Last active window
unbind l
bind C-a last-window
# Next window
bind C-s next-window
# Rename window
bind A command-prompt "rename-window %%"
# Set default-path
bind e send-keys " tmux set default-path $(pwd)" \; send-keys Enter
bind C-e send-keys " tmux set default-path $(pwd)" \; send-keys Enter
bind E send-keys " tmux set default-path $HOME" \; send-keys Enter
#bind C-e run " tmux set default-path $PWD \\;"
# Use Vi mode
setw -g mode-keys vi
set -g status-keys vi
# Turn off mouse-mode
#setw -g mode-mouse copy-mode
# Splitting
unbind %
unbind '"'
bind C-v split-window -v
bind C-b split-window -h
# Window, server list
bind '"' choose-window
bind * list-clients
bind C-W list-windows
bind w list-windows
# Pane change
unbind o
bind C-d select-pane -t :.+
# Pane navigation
unbind Down
unbind Up
unbind Left
unbind Right
bind j select-pane -D
bind k select-pane -U
bind h select-pane -L
bind l select-pane -R
bind -r C-j select-pane -D
bind -r C-k select-pane -U
bind -r C-h select-pane -L
bind -r C-l select-pane -R
# Pane resizing
unbind C-Up
unbind C-Down
unbind C-Left
unbind C-Right
unbind M-Up
unbind M-Down
unbind M-Left
unbind M-Right
# Shift: 3 line at a time
bind -r K resize-pane -U 3
bind -r J resize-pane -D 3
bind -r H resize-pane -L 3
bind -r L resize-pane -R 3
###
### Settings
###
# First window is 1
setw -g base-index 1
# Default terminal [remove this]
set -g default-terminal 'screen-256color-bce'
# History
set -g history-limit 1000
# Timing
set -g display-panes-time 1000
set -g display-time 1000
# Mouse pane resizing
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
# Terminal emulator title
set -g set-titles on
set -g set-titles-string '#S:#I.#P #W'
# Status Bar
set -g status-interval 1
set -g status-bg black
set -g status-fg white
set -g status-interval 1
#set -g status-left ''
set -g status-right '#[fg=green]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=cyan,bold]%d/%m %H:%M#[default]'
# Notification on activity
setw -g monitor-activity on
set -g visual-activity on
# Clipboard fun
# Only paste and set tmux's buffer with Primary's content
bind C-p run "tmux set-buffer \"$(xsel -o)\"; tmux paste-buffer"
# Copy to both Primary and Clipboard buffers
bind C-y run "tmux show-buffer | xsel -i ; tmux show-buffer | xsel -i -b"
# Clock
set -g clock-mode-style 24
set -g clock-mode-colour colour250
# Random styling
setw -g window-status-alert-attr underscore
setw -g window-status-current-attr bright,italics
@w32zhong
Copy link

w32zhong commented Jun 3, 2013

thanks for your sharing, I find send-keys very useful when you want to split a pane in the same directory of current tmux.

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