Skip to content

Instantly share code, notes, and snippets.

@malefficient
Created June 13, 2019 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malefficient/231c7b4c683b640f99fa55a142f21569 to your computer and use it in GitHub Desktop.
Save malefficient/231c7b4c683b640f99fa55a142f21569 to your computer and use it in GitHub Desktop.
tmux.conf
## Cmd-q is the new cmd-a/b
unbind C-b
#This is the new escape key
set -g prefix C-q
## C-q C-q will goto last window instead of l
#unbind l
#bind-key C-q last-window
# Enable mouse support (toggle with M/m below)
set-option -g mouse-select-pane on
set-option -g mouse-resize-pane on
set-option -g mouse-select-window on
set-window-option -g mode-mouse on
## rebind the split commands to something more intuitive
unbind %
bind | split-window -h
bind - split-window -v
## Hitting 'A' top ren(A)me windows is just muscle memory from screen
## No need to fight it.
unbind ,
bind-key A command-prompt -I "#W" 'rename-window %%'
## Hitting '$' is completely context-less. How about 'S' for 'rename-(S)ession'
## This also has the nice feature of being the inverse of 's' 'choose-(s)ession'
unbind '$'
bind-key S command-prompt -I "" 'rename-session %%'
## Hitting 'q' to see the pane numbers is context-less. How about '#'
unbind 'q'
bind-key '#' display-panes
## 'Hit 'j' to (J)ump to a given pane no
bind-key j command-prompt -I "" 'select-pane -t %%'
## Elite short-cut. Since your had is probably just on top of '#' to get
## the pane id. set '3' to change it as well.
bind-key 3 command-prompt -I "" 'select-pane -t %%'
## Here we do our best to accomdate screen users accustomed esc-tab navigating windows
bind-key tab select-pane -t :.-
## Arrow keys can be used in two manners.
## In the first case we use them exclusively to naviate panes.
## We do this by using the (currently) undocumented ':' target for select-pane
## which conveniently refers to the one with the current focus..
#bind-key up select-pane -U -t :
#bind-key down select-pane -D -t :
#bind-key left select-pane -L -t :
#bind-key right select-pane -R -t :
##While the previous setup is very intuitive, realistically we dont need to navigate through
##panes with that much directional precision.
##It turns out that it is more effiecent to just use up/down to go to next/prev panes
##while freeing up left/right for windows..This lets you quickly go through all the panes
##without having to navigate the directional carefulle.
## we map these left left/right
bind-key left previous-window
bind-key right next-window
bind-key up select-pane -t :.-
bind-key down select-pane -t :.+
##Resizing panes is handy sometimes.
bind-key -r '<' resize-pane -D 5
bind-key -r '>' resize-pane -U 5
##Its a strech, but think of the slashes pointing the way the window should grow
bind-key -r '/' resize-pane -R 5
bind-key -r "\\" resize-pane -L 5
## Take care of some housekeeping before getting on to colors on the status bar###
## (These are session variables, hence the set -g)
set -g base-index 1
set -g pane-base-index 1
set -g status-keys vi
##We'd rather name our windows ourselves..
set -g allow-rename off
## We might not want this on embedded boxes.
## Or do we just ant to make them havea 256 color termcap entry?
#TERM=screen-256color
TERM=linux
set-option -g default-terminal $TERM
set -g history-limit 1000
## that covers the last of the little quirks. Now for the color scheme
# THEME
set -g status-interval 1
set -g status-bg black
set -g status-fg green
set -g status-left-length 30
#set -g status-left ‘#[fg=green]#H’
#set -g status-left '#[fg=white](#S) #[fg=green]#(whoami)@#H#[default]' # A little more verbose..
#set -g status-right '#[fg=white]#(uptime | cut -f 2 -d\ | cut -f1-2 -d:) #[fg=green]#H#[default]'
set -g status-right '#[fg=white] |#(cat /proc/loadavg | cut -f 1-3 -d\" \")| #(uptime |cut -f 2 -d\" \" | cut -f1-2 -d: )|'
set -g status-left '#[fg=white](#S) |#I.#P| #[fg=green]#H#[default]'
#set-window-option -g window-status-current-bg red
set-window-option -g window-status-fg blue
set -g window-status-format ' #I:#W '
set-window-option -g window-status-current-fg cyan
set -g window-status-current-format '[#I:#W]'
#Automatic renaming sounds great, till you try it for a while..
set-window-option -g automatic-rename off
# Toggle mouse on with m
bind m \
set -g mode-mouse on \;\
set -g mouse-resize-pane on \;\
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
display 'Mouse: ON'
# Toggle mouse off with M
bind M \
set -g mode-mouse off \;\
set -g mouse-resize-pane off \;\
set -g mouse-select-pane off \;\
set -g mouse-select-window off \;\
display 'Mouse: OFF'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment