Skip to content

Instantly share code, notes, and snippets.

@yilenpan
Created March 12, 2017 08:07
Show Gist options
  • Save yilenpan/5362740ec67baa9e23f4f6bae1f157e6 to your computer and use it in GitHub Desktop.
Save yilenpan/5362740ec67baa9e23f4f6bae1f157e6 to your computer and use it in GitHub Desktop.
tmux
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# prefix key to backtick (`)
# unbind C-b
# set-option -g prefix `
# So we can still use ` when needed (prefix + )
# prefix + ctrl+a
# bind-key C-a set-option -g prefix C-a
# prefix + ctrl+b
# bind-key C-b set-option -g prefix `
# split panes using \ and -
bind \ split-window -h
bind - split-window -v
unbind '"'
unbind %
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf \; display-message ".tmux.conf reloaded.."
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# bind -n C-left previous-window
# bind -n C-right next-window
bind -n C-pageup previous-window
bind -n C-pagedown next-window
# vim-like copy nad paste
# unbind [
# bind Escape copy-mode
# unbind p
# bind p paste-buffer
# bind-key -t vi-copy 'v' begin-selection
# bind-key -t vi-copy 'y' copy-selection
# list panes
# bind-key Space list-panes
# bind-key S command-prompt -p ssh: "new-window -n %1 'ssh %1'"
# break-pane into a new window
bind-key Enter break-pane
# join-pane
bind-key Space command-prompt -p "merge to:" "joinp -t:%%" # %% = prompt for window.pane [-V|H] # vert|hor split
# fix move
unbind '.'
bind-key . command-prompt -p "move to:" "swap-window -t '%%'"
# switch to previous panel (like screen) (messes with panel navigation prefix + arrow)
# bind-key C-a last-window
bind -n C-end last-window
# mouse mode
set -g mouse on
# scroll on hover
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
# new stuff
set -s escape-time 0
setw -g aggressive-resize on
set -g history-limit 100000
######################
### DESIGN CHANGES ###
######################
# start window index from 1
set -g base-index 1
# start pane index from 1
setw -g pane-base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g renumber-windows on
set-option -g set-titles on
# set-option -g set-titles-string '#H:#S.#I.#P #W #T' # window number,program name, active(or not)
# '[#I/#P]: #W (#(whoami)@#h)
set-option -g set-titles-string "[#I/#P]: #W@#h"
# vi mode
setw -g mode-keys vi
# panes
set -g pane-border-fg black
set -g pane-active-border-fg brightred
## Status bar design
# status bar
set -g status-utf8 on
set -g status-justify left
set -g status-bg default
set -g status-fg colour12
set -g status-interval 5
# window mode
setw -g mode-bg colour6
setw -g mode-fg colour0
# window status
setw -g window-status-format " #F#I:#W#F "
setw -g window-status-current-format " #F#I:#W#F "
setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W "
setw -g window-status-current-bg colour0
setw -g window-status-current-fg colour11
setw -g window-status-current-attr dim
setw -g window-status-bg green
setw -g window-status-fg black
setw -g window-status-attr reverse
# Info on left (I don't have a session display for now)
set -g status-left ''
# loud or quiet?
set-option -g visual-activity on
set-option -g visual-bell on
set-option -g visual-silence on
set-window-option -g monitor-activity off
set-option -g bell-action none
setw -g mode-bg black
# options: "xterm-256color" "screen-256color"
set-option -g default-terminal "screen-256color"
# modes
setw -g clock-mode-colour colour135
setw -g clock-mode-style 24
setw -g mode-attr bold
setw -g mode-fg colour196
setw -g mode-bg colour238
# panes
set -g pane-border-bg colour235
set -g pane-border-fg colour238
# set -g pane-active-border-bg colour236
set -g pane-active-border-bg blue
set -g pane-active-border-fg colour51
# statusbar
set -g status-position bottom
set -g status-bg colour234
set -g status-fg colour137
# set -g status-attr dim
# #[bg=default]
set -g status-left "#[fg=white,bold,bg=green] #S "
# set -g status-right '#[fg=colour92] %d-%m #[fg=colour233,bg=colour245,bold] %H:%M:%S #h '
# set -g status-right "#[fg=black,bold]« #[fg=colour92]%d %b %H:%M #[fg=cyan,bold,bg=colour4] #(whoami)@#h "
set -g status-right "#[fg=black,bold]« #[fg=colour92]%d %b %H:%M #[fg=cyan,bold,bg=colour4] #h "
set -g status-right-length 50
set -g status-left-length 20
# setw -g window-status-content-attr bold,blink,reverse
setw -g window-status-current-fg colour81
setw -g window-status-current-bg colour17
setw -g window-status-current-attr bold
# setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '
setw -g window-status-current-format " #[fg=colour255]#I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F "
setw -g window-status-fg colour138
setw -g window-status-bg colour235
setw -g window-status-attr none
setw -g window-status-format ' #[fg=white,dim]#I:#[fg=white,dim]#W'
setw -g window-status-bell-attr bold
setw -g window-status-bell-fg colour255
setw -g window-status-bell-bg colour1
# messages
set -g message-attr bold
setw -g utf8 on
set -g status-utf8 on
# set -g message-fg colour232
# set -g message-bg colour166
set -g message-fg white
set -g message-bg red
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment