Instantly share code, notes, and snippets.

Embed
What would you like to do?
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
setw -g mode-keys vi
setw -g mode-mouse on
setw -g monitor-activity on
bind-key v split-window -h
bind-key s split-window -v
bind-key J resize-pane -D 5
bind-key K resize-pane -U 5
bind-key H resize-pane -L 5
bind-key L resize-pane -R 5
bind-key M-j resize-pane -D
bind-key M-k resize-pane -U
bind-key M-h resize-pane -L
bind-key M-l resize-pane -R
# Vim style pane selection
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Use Alt-vim keys without prefix key to switch panes
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
# Use Alt-arrow keys without prefix key to switch panes
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
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# No delay for escape key press
set -sg escape-time 0
# Reload tmux config
bind r source-file ~/.tmux.conf
# THEME
set -g status-bg black
set -g status-fg white
set -g window-status-current-bg white
set -g window-status-current-fg black
set -g window-status-current-attr bold
set -g status-interval 60
set -g status-left-length 30
set -g status-left '#[fg=green](#S) #(whoami)'
set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]'
@rsanheim

This comment has been minimized.

rsanheim commented Sep 20, 2011

Do you have 100% code coverage for this?

@spicycode

This comment has been minimized.

Owner

spicycode commented Sep 20, 2011

@rsanheim

This comment has been minimized.

rsanheim commented Sep 20, 2011

@instantaphex

This comment has been minimized.

instantaphex commented Apr 24, 2014

I'm a huge fan of this tmux config.

@tucano

This comment has been minimized.

tucano commented May 21, 2014

thanks for sharing

@IanVaughan

This comment has been minimized.

IanVaughan commented May 23, 2014

Shift arrow to switch windows works a treat, cheers.

But the "Alt-arrow keys without prefix key to switch panes" I can't seem to get working?
I'm on OSX, iTerm2, and no matter what key I hold plus arrow, it doesn't switch panes?

@arppl

This comment has been minimized.

arppl commented Jun 7, 2014

@IanVaughan check out the meta key option in iTerm2 preferences

iTerm2 Meta Key Options

@sreeisalso

This comment has been minimized.

sreeisalso commented Aug 4, 2014

set-environment -g 'IGNOREEOF' 2
include this into the config file, this will prevent unwanted exit with Ctrl-d

@vajapravin

This comment has been minimized.

vajapravin commented Dec 18, 2014

Best tmux from I have seen, thx ;)

@axsuul

This comment has been minimized.

axsuul commented May 18, 2015

Stole some stuff to put in my dotfiles @ http://github.com/axsuul/dotfiles

Many thanks!

@craigfurman

This comment has been minimized.

craigfurman commented May 30, 2015

Alt+Arrow keys to switch panes is great, thanks!

@leonnardo

This comment has been minimized.

leonnardo commented Sep 22, 2015

Nice file, using here too 😄
Thanls 👍

@lijunle

This comment has been minimized.

lijunle commented Oct 31, 2015

line 13, change to

setw -g mouse on

Reference: http://stackoverflow.com/a/33336609/1436671

@hozkok

This comment has been minimized.

hozkok commented Dec 5, 2015

very simplistic and all the stuff I was looking for... thanks

@her

This comment has been minimized.

her commented Dec 24, 2015

this is smart, thanks!

@isthisthat

This comment has been minimized.

isthisthat commented May 17, 2016

what versions of tmux and environment is this tested on?

@danielmanesku

This comment has been minimized.

danielmanesku commented Jun 12, 2016

If you modify this line:
set -g status-left '#[fg=green](#S) #(whoami)'
to this one (added spaces at the end)
set -g status-left '#[fg=green](#S) #(whoami) '
it looks nicer IMO.

@hmngwy

This comment has been minimized.

hmngwy commented Jun 17, 2016

set -g status-left '#[fg=green](#S) #(whoami) '

To anyone wondering, the above change from @danielmanesku seems to be needed for 2.1, but on 1.9 seems this was not needed. This conf was written for 1.9, as deduced from the mode-mouse line.

@rhn89

This comment has been minimized.

rhn89 commented Jul 11, 2016

How to we enable a simple linux style copy paste in tmux? Using emacs style copy paste is too cumbersome. Can you help?

@cfoutstd

This comment has been minimized.

cfoutstd commented Sep 23, 2016

I'm new to tmux, and am using it on a Mac. For switching panes w/o the prefix, I press option+up_arrow, for example, since option=alt, but nothing happens?

@yubo56

This comment has been minimized.

yubo56 commented Sep 30, 2016

http://osxdaily.com/2013/02/01/use-option-as-meta-key-in-mac-os-x-terminal/

The escape key is the default meta key in OS X, so you probably need to configure the above

@c02y

This comment has been minimized.

c02y commented Nov 17, 2016

@sshadmand

This comment has been minimized.

sshadmand commented Nov 17, 2016

Update: in newer versions of tmux mode-mouse and mode-mouse-[term] are all simply "mouse". I got an error and had to make the change per http://stackoverflow.com/questions/11832199/tmux-set-g-mouse-mode-on-doesnt-work and it worked like a charm 😄

Updated tmux.conf forked here:

https://gist.github.com/sshadmand/70a9d339f49aeaf343de7ef8f74a54a2

@jhonatanpiffer

This comment has been minimized.

jhonatanpiffer commented Dec 22, 2016

Thanks for share man.

@ziyan-junaideen

This comment has been minimized.

ziyan-junaideen commented Jan 26, 2017

Thanks man... made tmux so much better

@mxjxn

This comment has been minimized.

mxjxn commented Feb 23, 2017

I hadnt really messed with tmux.conf except for remapping C-b to C-q, BUT i am an avid vim user and this config looks PERFECT. Thanks for the tmux.conf insight and workflow improvements!

@gvlasov

This comment has been minimized.

gvlasov commented Apr 17, 2017

@cirelli94

This comment has been minimized.

cirelli94 commented May 26, 2017

setw -g mode-mouse on is not working for me, set -g mouse on is needed.

@Normence

This comment has been minimized.

Normence commented Jul 11, 2017

Learning tmux and its configuration, thanks a lot for sharing

@ghost

This comment has been minimized.

ghost commented Jul 13, 2017

Thank you!

@Hasani2015

This comment has been minimized.

Hasani2015 commented Jul 20, 2017

how about display config? i.e. my tmux does not allow me to open pdf,pngs, etc. from the terminal, was wondering if there is a flag for it?
P.S. I'm sure it is tmux the display works just fine when not using tmux

@jonmackenzie

This comment has been minimized.

jonmackenzie commented Aug 26, 2017

Hey guys, so in my build of iTerm 2 (3.0.15 though this has probably been the case for a while) there is no longer an option "[left/right] alt key acts as meta" though there is an option "When you press an arrow key or other function key that transmits the modifiers, should Option be translated to Meta?"

I suppose that explains why alt-arrow keys work for switching panes but alt-hjkl does not; hjkl do not count as "keys that transmit the modifiers". Escape will work for either, though, as it is the "Meta" key.

Hope this saves someone trying to figure out why the hell alt-hjkl isn't switching their panes :)

And hey if anyone knows a way around this please let me know 👍

@JamesTheHacker

This comment has been minimized.

JamesTheHacker commented Sep 8, 2017

v and s for pane splitting is a little odd. I have- for horizontal, and | for vertical. But hey, whatever feels best for you is the most important.

@bbagno

This comment has been minimized.

bbagno commented Nov 2, 2017

@JamesTheHacker, v and s are aliases for vertical and horizontal splits in vim, so they are quite common for vim users.

@olimorris

This comment has been minimized.

olimorris commented Nov 8, 2017

I was in denial. I tried to hate this. But it's amazing.

@mandyzore

This comment has been minimized.

mandyzore commented Nov 10, 2017

Nice

@Gromina

This comment has been minimized.

Gromina commented Nov 10, 2017

Thanks for sharing. Going to use it as a start.

@lucj

This comment has been minimized.

lucj commented Jul 16, 2018

Thanks a lot for sharing !

@dblyon

This comment has been minimized.

dblyon commented Jul 18, 2018

Thanks !!

@rowbot1

This comment has been minimized.

rowbot1 commented Jul 28, 2018

How do you select and copy text from the window

@jeffvandyke

This comment has been minimized.

jeffvandyke commented Aug 4, 2018

For true color support, I also use:

set-option -g default-terminal "screen-256color"
set-option -ga terminal-overrides ",xterm-256color:Tc"
@kepkin

This comment has been minimized.

kepkin commented Aug 14, 2018

You can add bind-key Z resize-pane -Z to toggle pane full screen.

@Royalsspirit

This comment has been minimized.

Royalsspirit commented Aug 31, 2018

Thank you for this awesome tmux config and all comment.

I added this in my tmux config to open new pan|window with current pane path and it's change my life :).

work on tmux 2.6 :

#open window with currrent path                                                                   
bind c new-window -c '#{pane_current_path}'                                                     
#open panel with current path                                                                   
bind '%' split-window -h -c '#{pane_current_path}'                                        
bind '"' split-window -v -c '#{pane_current_path}'  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment