Create a gist now

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.

Show comment
Hide comment
@rsanheim

rsanheim Sep 20, 2011

Do you have 100% code coverage for this?

Do you have 100% code coverage for this?

@spicycode

This comment has been minimized.

Show comment
Hide comment
@spicycode

spicycode Sep 20, 2011

Owner

spicycode commented Sep 20, 2011

@rsanheim

This comment has been minimized.

Show comment
Hide comment
@rsanheim

rsanheim Sep 20, 2011

@instantaphex

This comment has been minimized.

Show comment
Hide comment
@instantaphex

instantaphex Apr 24, 2014

I'm a huge fan of this tmux config.

I'm a huge fan of this tmux config.

@tucano

This comment has been minimized.

Show comment
Hide comment
@tucano

tucano May 21, 2014

thanks for sharing

tucano commented May 21, 2014

thanks for sharing

@IanVaughan

This comment has been minimized.

Show comment
Hide comment
@IanVaughan

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

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.

Show comment
Hide comment
@arppl

arppl Jun 7, 2014

@IanVaughan check out the meta key option in iTerm2 preferences

iTerm2 Meta Key Options

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.

Show comment
Hide comment
@sreeisalso

sreeisalso Aug 4, 2014

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

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.

Show comment
Hide comment
@vajapravin

vajapravin Dec 18, 2014

Best tmux from I have seen, thx ;)

Best tmux from I have seen, thx ;)

@axsuul

This comment has been minimized.

Show comment
Hide comment
@axsuul

axsuul May 18, 2015

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

Many thanks!

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.

Show comment
Hide comment
@craigfurman

craigfurman May 30, 2015

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

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

@leonnardo

This comment has been minimized.

Show comment
Hide comment
@leonnardo

leonnardo Sep 22, 2015

Nice file, using here too 😄
Thanls 👍

Nice file, using here too 😄
Thanls 👍

@lijunle

This comment has been minimized.

Show comment
Hide comment
@lijunle

lijunle Oct 31, 2015

line 13, change to

setw -g mouse on

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

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.

Show comment
Hide comment
@hozkok

hozkok Dec 5, 2015

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

hozkok commented Dec 5, 2015

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

@her

This comment has been minimized.

Show comment
Hide comment
@her

her Dec 24, 2015

this is smart, thanks!

her commented Dec 24, 2015

this is smart, thanks!

@isthisthat

This comment has been minimized.

Show comment
Hide comment
@isthisthat

isthisthat May 17, 2016

what versions of tmux and environment is this tested on?

what versions of tmux and environment is this tested on?

@danielmanesku

This comment has been minimized.

Show comment
Hide comment
@danielmanesku

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

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.

Show comment
Hide comment
@hmngwy

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

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.

Show comment
Hide comment
@rhn89

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

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.

Show comment
Hide comment
@cfoutstd

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

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.

Show comment
Hide comment
@yubo56

yubo56 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

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.

Show comment
Hide comment
@sshadmand

This comment has been minimized.

Show comment
Hide comment
@sshadmand

sshadmand 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

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.

Show comment
Hide comment
@jhonatanpiffer

jhonatanpiffer Dec 22, 2016

Thanks for share man.

Thanks for share man.

@ziyan-junaideen

This comment has been minimized.

Show comment
Hide comment
@ziyan-junaideen

ziyan-junaideen Jan 26, 2017

Thanks man... made tmux so much better

Thanks man... made tmux so much better

@mxjxn

This comment has been minimized.

Show comment
Hide comment
@mxjxn

mxjxn 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!

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.

Show comment
Hide comment
@cirelli94

This comment has been minimized.

Show comment
Hide comment
@cirelli94

cirelli94 May 26, 2017

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

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

@Normence

This comment has been minimized.

Show comment
Hide comment
@Normence

Normence Jul 11, 2017

Learning tmux and its configuration, thanks a lot for sharing

Learning tmux and its configuration, thanks a lot for sharing

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 13, 2017

Thank you!

ghost commented Jul 13, 2017

Thank you!

@Hasani2015

This comment has been minimized.

Show comment
Hide comment
@Hasani2015

Hasani2015 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

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.

Show comment
Hide comment
@jonmackenzie

jonmackenzie 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 👍

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.

Show comment
Hide comment
@JamesTheHacker

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

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.

Show comment
Hide comment
@bbagno

bbagno Nov 2, 2017

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

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.

Show comment
Hide comment
@olimorris

olimorris Nov 8, 2017

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

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

@mandyzore

This comment has been minimized.

Show comment
Hide comment

Nice

@Gromina

This comment has been minimized.

Show comment
Hide comment
@Gromina

Gromina Nov 10, 2017

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

Gromina commented Nov 10, 2017

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

@lucj

This comment has been minimized.

Show comment
Hide comment
@lucj

lucj Jul 16, 2018

Thanks a lot for sharing !

lucj commented Jul 16, 2018

Thanks a lot for sharing !

@dblyon

This comment has been minimized.

Show comment
Hide comment
@dblyon

dblyon Jul 18, 2018

Thanks !!

dblyon commented Jul 18, 2018

Thanks !!

@rowbot1

This comment has been minimized.

Show comment
Hide comment
@rowbot1

rowbot1 Jul 28, 2018

How do you select and copy text from the window

rowbot1 commented Jul 28, 2018

How do you select and copy text from the window

@jeffvandyke

This comment has been minimized.

Show comment
Hide comment
@jeffvandyke

jeffvandyke 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"

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.

Show comment
Hide comment
@kepkin

kepkin Aug 14, 2018

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

kepkin commented Aug 14, 2018

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

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