Skip to content

Instantly share code, notes, and snippets.

@jsplink
Created February 21, 2017 18:37
Show Gist options
  • Save jsplink/dc0e4d2ea10cf8eb5f4d4d7c6908e0b0 to your computer and use it in GitHub Desktop.
Save jsplink/dc0e4d2ea10cf8eb5f4d4d7c6908e0b0 to your computer and use it in GitHub Desktop.
# vim: ft=tmux
# index start from 1
set -g base-index 1
set -g pane-base-index 1
# 256 color
set -g default-terminal "screen-256color"
set -g terminal-overrides 'uxterm*:smcup@:rmcup@'
# prefix key
unbind C-b
set -g prefix ^O
bind o send-prefix
# screen-like
bind ^C new-window
bind ^D detach-client
bind ^N next-window
bind ^P previous-window
bind ^K confirm-before -p "kill-window #S? (y/n)" kill-window
bind ^O last-window
# rotate
bind ^R rotate-window -D
# set window notifications
setw -g monitor-activity on
set -g visual-activity on
# automatically set window title
setw -g automatic-rename on
# allows for faster key repetition
set -g repeat-time 0
# copy selection color
setw -g mode-fg black
setw -g mode-bg green
# alert message line
set -g message-fg black
set -g message-bg green
# status line
# set-option -g status on
# set-option -g status-interval 2
# set-option -g status-utf8 on
# set-option -g status-justify "centre"
# set-option -g status-left-length 60
# set-option -g status-right-length 90
# set-option -g status-left "#(~/.tmux/tmux-powerline/powerline.sh left)"
# set-option -g status-right "#(~/.tmux/tmux-powerline/powerline.sh right)"
# set-window-option -g window-status-current-format "#[fg=colour235, bg=colour27]⮀#[fg=colour255, bg=colour27] #I ⮁ #W #[fg=colour27, bg=colour235]⮀"
# set -g status-bg black
# set -g status-fg yellow
# set -g status-right "#[fg=white,bg=black] [#S]#[fg=red,bright] [ #[fg=cyan]#H #[fg=red,bright]] #[fg=blue,bright]%Y.%m.%d #[default] "
# set -g status-right-length 100
# setw -g window-status-current-fg green
# setw -g window-status-current-bg black
# setw -g window-status-current-format " [#I#F] #W "
# setw -g window-status-format "[#I#F#W]"
# setw -g window-status-activity-fg white
# setw -g window-status-activity-bg white
# setw -g window-status-activity-attr default
# set -g status-interval 10
# set -g status-left-length 30
# set -g status-left '#[fg=cyan]Session: #S #[fg=red]#(whoami)@#H#[default]'
# set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=magenta]#(battery) #[fg=cyan]%B %e %R'
# border
set -g pane-border-fg blue
set -g pane-border-bg black
set -g pane-active-border-fg blue
set -g pane-active-border-bg blue
# split
bind | split-window -h
bind _ split-window -v
bind s split-window -v
bind v split-window -h
# resize
setw -g aggressive-resize on
# history
set -g history-limit 100000
# vim copy selection
bind-key ESCAPE copy-mode
bind-key P command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
# vim key map
bind \; command-prompt
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# resize panes like vim
bind < resize-pane -L 18
bind > resize-pane -R 18
bind - resize-pane -D 18
bind + resize-pane -U 18
# bind : to command-prompt like vim
bind : command-prompt
# vi-style controls for copy mode
# setw -g mode-keys vi
# Make it use C-a, similar to screen..
unbind C-b
set -g prefix C-a
bind-key C-a last-window
# Reload key
bind r source-file ~/.tmux.conf
# clock
set-window-option -g clock-mode-colour cyan
set-window-option -g clock-mode-style 12
# battery status via https://raw.github.com/richoH/dotfiles/master/bin/battery
if-shell "uname | grep -q Darwin" "source-file ~/.tmux-osx"
set -g @shell_mode 'vi'
set -g @yank_selection 'primary'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-yank'
run-shell '~/.tmux/plugins/tpm/tpm'
# powerline-base
set -g status on
set -g status-interval 2
set -g status-left-length 20
set -g status-right '#(env "$POWERLINE_COMMAND" $POWERLINE_COMMAND_ARGS tmux right -R pane_id=\"`tmux display -p "#D"`\")'
set -g status-right-length 150
set -g window-status-format "#[$_POWERLINE_WINDOW_COLOR]$_POWERLINE_LEFT_HARD_DIVIDER_SPACES#I#F #[$_POWERLINE_WINDOW_DIVIDER_COLOR]$_POWERLINE_LEFT_SOFT_DIVIDER#[default]#W $_POWERLINE_LEFT_HARD_DIVIDER_SPACES"
set -g window-status-current-format "#[$_POWERLINE_WINDOW_CURRENT_HARD_DIVIDER_COLOR]$_POWERLINE_LEFT_HARD_DIVIDER#[$_POWERLINE_WINDOW_CURRENT_COLOR]#I#F $_POWERLINE_LEFT_SOFT_DIVIDER#[$_POWERLINE_WINDOW_NAME_COLOR]#W #[$_POWERLINE_WINDOW_CURRENT_HARD_DIVIDER_NEXT_COLOR]$_POWERLINE_LEFT_HARD_DIVIDER"
# Legacy status-left definition to be overwritten for tmux Versions 1.8+
set -g status-left "#[$_POWERLINE_SESSION_COLOR] #S #[$_POWERLINE_SESSION_HARD_DIVIDER_NEXT_COLOR]$_POWERLINE_LEFT_HARD_DIVIDER#(env \"\$POWERLINE_COMMAND\" tmux left -R pane_id=\"`tmux display -p '#D'`\")"
# vim: ft=tmux
# tmux-2.1+
# Starting from tmux-2.1 escaping of dollar signs inside #() is harmful
set -qg status-left "#{?client_prefix,#[fg=$_POWERLINE_SESSION_PREFIX_FG]#[bg=$_POWERLINE_SESSION_PREFIX_BG]#[$_POWERLINE_SESSION_PREFIX_ATTR],#[fg=$_POWERLINE_SESSION_FG]#[bg=$_POWERLINE_SESSION_BG]#[$_POWERLINE_SESSION_ATTR]} #S #{?client_prefix,#[fg=$_POWERLINE_SESSION_PREFIX_BG],#[fg=$_POWERLINE_SESSION_BG]}#[bg=$_POWERLINE_BACKGROUND_BG]#[nobold]$_POWERLINE_LEFT_HARD_DIVIDER#(env $POWERLINE_COMMAND $POWERLINE_COMMAND_ARGS tmux left --width=`tmux display -p '#{client_width}'` -R width_adjust=`tmux show-options -g status-right-length | cut -d' ' -f2` -R pane_id=\"`tmux display -p '#D'`\")"
if-shell 'env "$POWERLINE_CONFIG_COMMAND" tmux setup' '' 'run-shell "powerline-config tmux setup"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment