Skip to content

Instantly share code, notes, and snippets.

@abhayathapa
Created August 26, 2013 08:25
Show Gist options
  • Save abhayathapa/6339191 to your computer and use it in GitHub Desktop.
Save abhayathapa/6339191 to your computer and use it in GitHub Desktop.
Tmux config
# Last modified: 2012 Jul 19
# Author: Florian CROUZAT <[email protected]>
# Feel free to do whatever you want with this file.
# Just make sure to credit what deserve credits.
#killall tmux; tmux # kill tmux sessions
# make selection from mouse -OPT select
#PREFIX : -> bring command prompt
#PREFIX ? -> bring key-bindings
#PREFIX , -> rename current window
#PREFIX c -> new window &-> kill window
#PREFIX q -> Show pane numbers, when the numbers show up type the key to goto that pane
#PREFIX space-bar -> switch panes x-> kill pane
#PREFIX up/down/left/right -> change pane size
#PREFIX d -> detach session
unbind C-b
set-option -g prefix C-j # Prefix made as ctrlJ
bind j send-prefix
unbind l
bind C-a last-window # Last active window ctrlA
set-option -g base-index 1 # start window numbering at 1
# set -g set-titles on # enable wm window titles
#bind K confirm-before kill-pane #confirm kill
# hsplit
unbind %
bind '\' split-window -h
# vsplit
unbind '"'
bind - split-window -v
bind space select-pane -t:.+ #quick pane cycling
# Panes
bind up resize-pane -U 10
bind down resize-pane -D 10
bind left resize-pane -L 10
bind right resize-pane -R 10
bind tab next-layout
unbind C-o
bind r rotate-window
set-option -g pane-active-border-fg blue
set-option -g pane-active-border-bg black
set-option -g pane-border-fg white
set-option -g pane-border-bg black
# swap panes
bind-key -r J swap-pane -D #swap pane down
bind-key -r K swap-pane -U
# Mouse support
set-window-option -g mode-mouse on
set-option -g mouse-select-pane on
set-option -g mouse-resize-pane on
set-option -g mouse-utf8 on
set-option -g mouse-select-window on
# Allow xterm titles in terminal window, terminal scrolling with scrollbar, and setting overrides of C-Up, C-Down, C-Left, C-Right
# set -g terminal-overrides 'xterm*:smcup@:rmcup@'
set-option -s escape-time 100 #set delay time for escape
# Commands
set -g default-terminal "screen-256color" # tell tmux to use 256 colors
set-option -g history-limit 10000
#Reload config without killing server
bind R source-file ~/.tmux.conf \; display-message "Config reloaded"
# Use zsh as default shell 9851046040
set-option -g default-command "reattach-to-user-namespace -l zsh" #
set -g default-shell /bin/zsh
# chsh -s $(`which zsh`) $USER #set-option -g default-command "exec /bin/bash"
# set -g default-command /bin/zsh
# Monitor Activity
# setw -g monitor-activity on
# set -g visual-activity on
# bind / command-prompt -p "man page: " "split-window 'exec man %%'" #enable man page
# Copy mode
# unbind [
# unbind ]
# bind Escape copy-mode
# bind p paste-buffer
bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
bind C-v run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
# https://github.com/richo/dotfiles/blob/master/tmux.conf
# Create an environment that zsh can make sense of
# set-environment -g tmuxTERM $TERM
# set-environment -g INSCREEN yes
# set-environment TMUX_TITLE yes
# New shells should not inherit pwd
# set -g default-path "."
set-option -g allow-rename off # disable zsh autorenames window
# status bar
# set-option -g status-utf8 on
# set-option -g status-bg default
# set-option -g status-fg white
# set-option -g message-attr none
# set-option -g message-bg white
# set-option -g message-fg black
# set-window-option -g window-status-bell-bg cyan
# set-window-option -g window-status-bell-attr bright
# set-window-option -g window-status-activity-bg red
# set-window-option -g window-status-activity-attr bright
# set-option -g status-interval 5
# set-option -g status-left-length 30
# #set-option -g status-left '#[fg=magenta]» #[fg=blue,bold]#T#[default]'
# set-option -g status-left '#[fg=cyan][#S#[fg=black,bold]#P#[default]#[fg=cyan]]#[default]'
# set-option -g status-right "#[fg=red]#(battery Discharging)#[fg=blue]#(battery Charging) #[fg=$TMUX_SHELL_COLOR]$sHost#[default]#[fg=cyan] %d %b %R"
# set-window-option -g window-status-current-format "[#[fg=white]#I:#W#F#[fg=red]]"
# set-option -g visual-activity on
# set-window-option -g monitor-activity off
# set-window-option -g window-status-current-fg red
# set-window-option -g window-status-current-attr bright
#Statusbar https://gist.github.com/shinzui/866897
#set -g status-keys vi # use vi-style key bindings in the status line
#set -g display-time 2000 # time(milliseconds) for which status line messages are displayed
bind-key b set-option status # toggle statusbar
set -g status-justify centre # Center the window list
# default statusbar colors
set -g status-fg white
set -g status-bg red
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 black
setw -g window-status-current-attr underscore
set-option -g status-right "#[fg=red]#(battery Discharging)#[fg=blue]#(battery Charging) #[fg=$TMUX_SHELL_COLOR]$sHost#[default]#[fg=cyan] %d %b %R"
#Maximize and restore a pane
# unbind k
# bind k new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
# unbind l
# bind l last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
# even-vertical - Panes are spread evenly from top to bottom.
# main-vertical- large pane is placed on the left and the others spread from top to bottom along the right. Use the main-pane-width window option to specify the width of the left pane.
# setw main-pane-width 55
# select-layout -t 0 main-vertical
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment