Create a gist now

Instantly share code, notes, and snippets.

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
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]'

Do you have 100% code coverage for this?


spicycode commented Sep 20, 2011

I'm a huge fan of this tmux config.

tucano commented May 21, 2014

thanks for sharing

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 commented Jun 7, 2014

@IanVaughan check out the meta key option in iTerm2 preferences

iTerm2 Meta Key Options

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

Best tmux from I have seen, thx ;)

axsuul commented May 18, 2015

Stole some stuff to put in my dotfiles @

Many thanks!

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

Nice file, using here too πŸ˜„
Thanls πŸ‘

lijunle commented Oct 31, 2015

line 13, change to

setw -g mouse on


hozkok commented Dec 5, 2015

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

her commented Dec 24, 2015

this is smart, thanks!

what versions of tmux and environment is this tested on?

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 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 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?

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 commented Sep 30, 2016

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

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 and it worked like a charm πŸ˜„

Updated tmux.conf forked here:

Thanks for share man.

Thanks man... made tmux so much better

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!

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

Learning tmux and its configuration, thanks a lot for sharing

jbabbra commented Jul 13, 2017

Thank you!

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 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 πŸ‘

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 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.

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


Gromina commented Nov 10, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment