TMUX Fun

After opening up 10+ terminal sessions on my macbook every day, I started to think there must be a better way.  Turns out there is. My guru buddies Lamont, Oliver, John, and Chris use Screen.  My first thought was to copy them.  Lamont joked that he has been using the same screen config file since 1995!  Wow, I thought, a technology that solid has to be the right one for me.  Then I tried to install and use it on my Mac.  While OSX comes with a version of screen pre-installed, it doesn’t include some custom options I wanted (vertical splitting) without downloading the latest bits from SourceForge and compiling it on OSX.  I didn’t want to spend too much time on this endeavor and just wanted to install all the options I wanted fast (using Homebrew in my case).

So, after doing a little research, I discovered that TMUX had almost identical command sequences as SCREEN, installed fast via Homebrew, and had simple global configuration files that I can setup (just like SCREEN).  Yay!  So I decided to just install TMUX and get going.  After surprisingly little effort reading other nice folk’s blogs and the man page, I was up and running.  I thought I would share my global configuration file for TMUX for others looking to do the same.

It is on github here:

https://github.com/jbpadgett/tmux-config

For those wishing to just view it here on the blog, here you go:


#########################################################################
#########################################################################
# JBPadgett's custom tmux configuration
# Borrowed heavily from various nice people on the internets
# Put everything global here: ~/.tmux.conf
# Put environment specific tmux config here: ~/.tmux/ # Example: ~/.tmux/chef
#########################################################################
#########################################################################

#########################################################################
# Reset The Command Prefix
#########################################################################
# Not that I don’t like change, but now you know screen and tmux!
# set the command prefix to match screen (good ‘ol CTRL+a)
unbind C-b
set -g prefix C-a
bind-key C-a last-window

#########################################################################
# Unbindings
#########################################################################
#unbind C-b # unbind default leader key

#########################################################################
# Global options
#########################################################################
# utf8
set-window-option -g utf8 on

# large history
set-option -g history-limit 10000

#########################################################################
# Status Bar
#########################################################################
set-option -g status-utf8 on
set-option -g status-justify right
set-option -g status-bg black # colour213 # pink
set-option -g status-fg cyan
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-right ‘#[fg=red,bold][ TMUX-SESSION ] #[fg=cyan]»» #[fg=blue,bold]###S #[fg=magenta]%R %m-%d#(acpi | cut -d ‘,’ -f 2)#[default]’
set-option -g visual-activity on

# Titles (window number, program name, active (or not)
set-option -g set-titles on
set-option -g set-titles-string ‘#H:#S.#I.#P #W #T’

# statusbar background to black, foreground to white
#set-option -g status-fg white
#set-option -g status-bg black

# set the current window name to a nice bold yellow text
#setw -g window-status-current-attr bold
#setw -g window-status-current-fg yellow

# hostname is printed on the left
set-option -g status-left-length 40
set -g status-left “#H”

# be notified when there is activity in one of your windows
setw -g monitor-activity on

# don’t rename windows automatically
#set-window-option -g automatic-rename off

#########################################################################
# Bindings
#########################################################################
# reload tmux conf
bind-key r source-file ~/.tmux.conf

# Navigation ————————————————————
# Pane Switching with Alt+Arrow keys
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

# Begin Mouse Section
# Cheating with el mouso. Pray for forgiveness. You should know why —-
# Global mouse enablement (needs to be first)
set-window-option -g mode-mouse on

# Mouse pane switching
set-option -g mouse-select-pane on
set-option -g mouse-select-window on

# Allows terminal scorolling to not override vim/editor scrolling
set -g terminal-overrides ‘xterm*:smcup@:rmcup@’

# Initialize custom session configs
#bind S source-file ~/.tmux/session1
#bind s source-file ~/.tmux/session2

 



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s