Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 206 lines (156 sloc) 5.16 KB
# PastLeo's tmux.conf
# =============================
# -----------------------------
# Global settings
# -----------------------------
# scrollback buffer n lines
set -g history-limit 5000
# listen for activity on all windows
set -g bell-action any
# start window indexing at 1 window so the <prefix> 1 is easier to reach
set -g base-index 1
# tell tmux to use 256 colour terminal
set -g default-terminal "screen-256color"
# xterm-style function key sequences
setw -g xterm-keys on
# control automatic window renaming
setw -g automatic-rename off
# enable wm window titles
set -g set-titles on
# remove <esc> key press delay
set -sg escape-time 0
# -----------------------------
# Key bindings
# -----------------------------
# set <prefix> key to C-a
set-option -g prefix C-a
# use C-a again to send ctrl-a to inner session
bind-key C-a send-prefix
# detach session, keeping the program running
bind-key d detach
# Create and delete
#
# Create window
bind-key -n C-n new-window
# use C-n to create new windows because C-c is to interrupt
# split windows (create pane)
bind-key _ split-window -v -c '#{pane_current_path}'
bind-key | split-window -h -c '#{pane_current_path}'
# kill current pane when the inner process is unable to exit for whatever reason
bind-key q confirm-before kill-pane
# Navigation
#
# <prefix> or Ctrl- or <prefix> Ctrl-
# k --- previous pane
# h l --- previous window / next window
# j --- next pane
# navigate windows
unbind-key l
bind-key h select-window -t :-
bind-key C-h select-window -t :-
bind-key -n C-h select-window -t :-
bind-key l select-window -t :+
bind-key C-l select-window -t :+
bind-key -n C-l select-window -t :+
# navigate panes
bind-key j select-pane -t :.-
bind-key C-j select-pane -t :.-
bind-key -n C-j select-pane -t :.-
bind-key k select-pane -t :.+
bind-key C-k select-pane -t :.+
bind-key -n C-k select-pane -t :.+
# Modify - rename, resize and reorder
#
# rename title
bind-key , command-prompt "rename-window %%"
# move the split line (resize pane)
# <prefix> shift-
# k --- up
# h l --- left / right
# j --- down
bind-key -r H resize-pane -L 3
bind-key -r L resize-pane -R 3
bind-key -r K resize-pane -U 1
bind-key -r J resize-pane -D 1
# move (swap) panes and windows
# <prefix> alt-
# k --- move pane next
# h l --- move window left / move window right
# j --- move pane previous
bind-key -r M-h swap-window -t :-
bind-key -r M-j swap-pane -D
bind-key -r M-k swap-pane -U
bind-key -r M-l swap-window -t :+
# change window pane layouts
bind-key -r M-f next-layout
# toogle a pane between full-screen and pane-size
bind-key f resize-pane -Z
bind-key C-f resize-pane -Z
bind-key -n C-f resize-pane -Z
# Copy-mode (vi-mode)
#
# vi-style controls for copy mode
setw -g mode-keys vi
# C-v (the original '[' is still availible) to enter vi-mode
bind-key [ copy-mode
bind-key -n C-v copy-mode
bind-key C-v copy-mode
# select and copy like vi in vi-mode
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi y send -X copy-selection
# if encounter incompatible with send-keys/send -X, use lagacy setting:
# bind-key -t vi-copy 'v' begin-selection
# bind-key -t vi-copy 'y' copy-selection
# pasting
bind-key ] paste-buffer
bind-key -n C-p paste-buffer
bind-key C-p paste-buffer
# enable navigation in vi mode
bind-key -T copy-mode-vi C-h select-window -t :-
bind-key -T copy-mode-vi C-l select-window -t :+
bind-key -T copy-mode-vi C-j select-pane -t :.-
bind-key -T copy-mode-vi C-k select-pane -t :.+
## Other useful commands
# open a man page in new pane, using q to leave
bind-key / command-prompt -p 'man ' "split-window -h 'exec man %%'"
bind-key r command-prompt -p 'Command >> ' "split-window -c '#{pane_current_path}' -h '%%; echo \"Press enter to continue.\"; read;'"
# reload settings
bind-key R source-file ~/.tmux.conf
# Prevent terminal freezing by C-s
bind-key -n C-s display 'Terminal freezing by C-s prevented'
# -----------------------------
# Statusbar settings
# -----------------------------
# use vi-style key bindings in the status line
set -g status-keys vi
# amount of time for which status line messages and other indicators
# are displayed. time is in milliseconds.
set -g display-time 2000
# default statusbar colors
set -g status-fg white
set -g status-bg default
set -g status-attr default
# default window title colors
setw -g window-status-fg white
setw -g window-status-bg default
setw -g window-status-attr dim
# active window title colors
setw -g window-status-current-fg cyan
setw -g window-status-current-bg default
setw -g window-status-current-attr bright
setw -g window-status-current-attr underscore
# command/message line colors
set -g message-fg white
set -g message-bg black
set -g message-attr bright
# what to be displayed on the right status
set -g status-interval 1
set -g status-right ' } %Y-%m-%d %H:%M:%S'
set -g status-right-length 60
# what to be displayed on the left status
set -g status-left-length 30
set-option -g status-left "#[fg=green]#(echo $USER)#[default].#[fg=blue]#h#[default] { "
# -----------------------------
# Platform fix
# -----------------------------
if-shell "hash reattach-to-user-namespace 2> /dev/null" 'set-option -g default-command "reattach-to-user-namespace bash"'