Skip to content

Instantly share code, notes, and snippets.

@stew
Created August 22, 2019 19:59
Show Gist options
  • Save stew/0e18fe5b162b41a6320b1ec90aef7e71 to your computer and use it in GitHub Desktop.
Save stew/0e18fe5b162b41a6320b1ec90aef7e71 to your computer and use it in GitHub Desktop.
# unbind some default keybindings
unbind C-b
# set prefix key to ctrl-a
set -g prefix C-o
# lower command delay
set -sg escape-time 1
# start first window and pane at 1, not zero
set -g base-index 1
set -g pane-base-index 1
bind C-o last-window
bind n next-window
bind C-n next-window
bind p previous-window
bind C-p previous-window
# bind r to reloading the config file
bind r source-file ~/.tmux.conf \; display "Reloaded tmux config file."
# pass through a ctrl-a if you press it twice
bind o send-prefix
# better mnemonics for splitting panes!
bind | split-window -h
bind - split-window -v
# vim / xmonad style bindings for pane movement
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
# vim / xmonad style bindings for window movement
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# shift-movement keys will resize panes
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# disable mouse support
#setw -g mode-mouse on
#set -g mouse-select-pane on
#set -g mouse-resize-pane on
#set -g mouse-select-window on
# turn on 256 color support in tmux
set -g default-terminal "xterm-256color"
# fiddle with colors of status bar
set -g status-style fg=white,bg=colour234
# fiddle with colors of inactive windows
setw -g window-status-style fg=cyan,bg=colour234,dim
# change color of active window
setw -g window-status-current-style fg=white,bg=colour88,bright
# set color of regular and active panes
#set -g pane-border-style fg=colour238,bg=default,fg=green,bg=default
set -g pane-border-style fg=white,bg=default,fg=green,bg=default
# set color of command line
set -g message-style fg=white,bg=colour22,bright
# configure contents of status bar
set -g status-left-length 40
set -g status-left "#[fg=green]\"#S\""
set -g status-right "#[fg=green] #h | %d %b %R"
set -g status-justify centre
setw -g monitor-activity on
set -g visual-activity on
# navigate using vim-style keys
setw -g mode-keys vi
# copy/paste using vim-style keys
bind Escape copy-mode
bind x copy-mode
unbind p
bind p paste-buffer
# xclip support (commented as this often doesn't make sense on remote servers)
#bind C-c run "tmux save-buffer - / xclip -i -sel clipboard"
#bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
# set up aliases for temporarily maximizing panes
unbind Up
bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
unbind Down
bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
# set up alias for turning on logging
bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"
bind C-k confirm kill-window
bind Tab last-pane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment