Skip to content

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.

Copy link

@rsanheim rsanheim commented Sep 20, 2011

Do you have 100% code coverage for this?

@spicycode

This comment has been minimized.

Copy link
Owner Author

@spicycode spicycode commented Sep 20, 2011

@rsanheim

This comment has been minimized.

Copy link

@rsanheim rsanheim commented Sep 20, 2011

@instantaphex

This comment has been minimized.

Copy link

@instantaphex instantaphex commented Apr 24, 2014

I'm a huge fan of this tmux config.

@tucano

This comment has been minimized.

Copy link

@tucano tucano commented May 21, 2014

thanks for sharing

@IanVaughan

This comment has been minimized.

Copy link

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

@agrlh

This comment has been minimized.

Copy link

@agrlh agrlh commented Jun 7, 2014

@IanVaughan check out the meta key option in iTerm2 preferences

iTerm2 Meta Key Options

@sreeisalso

This comment has been minimized.

Copy link

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

Copy link

@vajapravin vajapravin commented Dec 18, 2014

Best tmux from I have seen, thx ;)

@axsuul

This comment has been minimized.

Copy link

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

Copy link

@craigfurman craigfurman commented May 30, 2015

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

@leonnardo

This comment has been minimized.

Copy link

@leonnardo leonnardo commented Sep 22, 2015

Nice file, using here too 😄
Thanls 👍

@lijunle

This comment has been minimized.

Copy link

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

Copy link

@hozkok hozkok commented Dec 5, 2015

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

@her

This comment has been minimized.

Copy link

@her her commented Dec 24, 2015

this is smart, thanks!

@isthisthat

This comment has been minimized.

Copy link

@isthisthat isthisthat commented May 17, 2016

what versions of tmux and environment is this tested on?

@danielmanesku

This comment has been minimized.

Copy link

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

Copy link

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

Copy link

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

Copy link

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

Copy link

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

Copy link

@c02y c02y commented Nov 17, 2016

@sshadmand

This comment has been minimized.

Copy link

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

Copy link

@jhonatanpiffer jhonatanpiffer commented Dec 22, 2016

Thanks for share man.

@ziyan-junaideen

This comment has been minimized.

Copy link

@ziyan-junaideen ziyan-junaideen commented Jan 26, 2017

Thanks man... made tmux so much better

@mxjxn

This comment has been minimized.

Copy link

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

Copy link

@gvlasov gvlasov commented Apr 17, 2017

@cirelli94

This comment has been minimized.

Copy link

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

Copy link

@Normence Normence commented Jul 11, 2017

Learning tmux and its configuration, thanks a lot for sharing

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Jul 13, 2017

Thank you!

@Hasani2015

This comment has been minimized.

Copy link

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

Copy link

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

Copy link

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

Copy link

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

Copy link

@olimorris olimorris commented Nov 8, 2017

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

@mandyzore

This comment has been minimized.

Copy link

@mandyzore mandyzore commented Nov 10, 2017

Nice

@Gromina

This comment has been minimized.

Copy link

@Gromina Gromina commented Nov 10, 2017

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

@lucj

This comment has been minimized.

Copy link

@lucj lucj commented Jul 16, 2018

Thanks a lot for sharing !

@dblyon

This comment has been minimized.

Copy link

@dblyon dblyon commented Jul 18, 2018

Thanks !!

@rowbot1

This comment has been minimized.

Copy link

@rowbot1 rowbot1 commented Jul 28, 2018

How do you select and copy text from the window

@jeffvandyke

This comment has been minimized.

Copy link

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

Copy link

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

Copy link

@Royalsspirit 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}'  
@silveiralexf

This comment has been minimized.

Copy link

@silveiralexf silveiralexf commented Jan 3, 2019

How do you select and copy text from the window

just comment the following line:

setw -g mode-mouse on

@hschne

This comment has been minimized.

Copy link

@hschne hschne commented Jan 21, 2019

1000th !

@disrupted

This comment has been minimized.

Copy link

@disrupted disrupted commented Mar 7, 2019

@Royalsspirit thanks for the great recommendation!

@sphericalwave

This comment has been minimized.

Copy link

@sphericalwave sphericalwave commented Mar 29, 2019

Not having a success getting the window switching to work.
Any suggestions for a Tmux 2.4 newb?

# Shift arrow to switch windows
bind -n S-Left  previous-window
bind -n S-Right next-window
@tngebauer

This comment has been minimized.

Copy link

@tngebauer tngebauer commented May 7, 2019

Since tmux 2.9 the following options:

set -g window-status-current-bg white
set -g window-status-current-fg black
set -g window-status-current-attr bold

don't work anymore. They were renamed to

set -g window-status-current-style bg=white
set -g window-status-current-style fg=black
set -g window-status-current-style bold

Issue opened at the tmux repo

@juvenal

This comment has been minimized.

Copy link

@juvenal juvenal commented May 11, 2019

Since tmux 2.9 the following options:

set -g window-status-current-bg white
set -g window-status-current-fg black
set -g window-status-current-attr bold

don't work anymore. They were renamed to

set -g window-status-current-style bg=white
set -g window-status-current-style fg=black
set -g window-status-current-style bold

Issue opened at the tmux repo

More precisely, the three replacement lines could be reduced to a single one:

set -g window-status-current-style bg=white,fg=black,bold
@cmdcolin

This comment has been minimized.

Copy link

@cmdcolin cmdcolin commented May 31, 2019

I'm a fan of the wttr.in tmux status line...it's just fun

set -g status-left '#(curl "wttr.in/?format=3") '
@ScottA38

This comment has been minimized.

Copy link

@ScottA38 ScottA38 commented Jun 2, 2019

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?

@IanVaughan I have been experiencing the same issue on mac - it is explained here: https://askubuntu.com/questions/109293/editing-with-nano-alt-is-caught-by-the-window-menus-how-can-i-fix-that

I am not sure if there is a workaround but I am just going to stick with esc instead of alt in tmux for now

@flajann2

This comment has been minimized.

Copy link

@flajann2 flajann2 commented Jun 30, 2019

Most interesting. I should share my own .tmux.conf. :) In fact, tmux and tmuxinator is something I use all the time, and is an unbeatable combination.

In fact, I should not only share my tmux, but also my emacs config and bash setup. If anyone's interested, please let me know.

@AvinashMV

This comment has been minimized.

Copy link

@AvinashMV AvinashMV commented Aug 18, 2019

Sorry , am new to tmux. I used this file in my Mac. Some of them doesn't seem to work. Can anyone help?

@s4ln1x

This comment has been minimized.

Copy link

@s4ln1x s4ln1x commented Aug 29, 2019

Thanks!

@sac0

This comment has been minimized.

Copy link

@sac0 sac0 commented Oct 30, 2019

In case anyone uses this for 2.9a versions and later and it doesn't work. This is the update needed
set -g window-status-current-style bg=white,fg=black,bold

@schadha17

This comment has been minimized.

Copy link

@schadha17 schadha17 commented Jan 15, 2020

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

These don't work in MAC OSX. Please help!

@ScottA38

This comment has been minimized.

Copy link

@ScottA38 ScottA38 commented Jan 16, 2020

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

These don't work in MAC OSX. Please help!

@schadha17 you could try this instead, provided you don't already use these keys within tmux:
`

 bind -n Home select-pane -L

 bind -n End select-pane -R

 bind -n Pageup select-pane -U

 bind -n Pagedown select-pane -D

`
(They are the arrow keys but using 'fn' instead. The 'M' (alt) key does not really play ball with any shortcuts inside of tmux or text editors seemingly - see my above comment)

@Axiangel

This comment has been minimized.

Copy link

@Axiangel Axiangel commented Feb 4, 2020

Looks great man. I cannot however for the love of my life understand how i can paste text from clipboard into nano or vim using this conf. Can anyone please help me?

@cerebrux

This comment has been minimized.

Copy link

@cerebrux cerebrux commented Feb 4, 2020

Looks great man. I cannot however for the love of my life understand how i can paste text from clipboard into nano or vim using this conf. Can anyone please help me?

Use Ctrl+Shift+V to paste in terminal (vim or nano)

@PhilDim1

This comment has been minimized.

Copy link

@PhilDim1 PhilDim1 commented Feb 12, 2020

Looks great man. I cannot however for the love of my life understand how i can paste text from clipboard into nano or vim using this conf. Can anyone please help me?

Try Shift-Insert to paste.

@HadowStark

This comment has been minimized.

Copy link

@HadowStark HadowStark commented Mar 5, 2020

Looks great man. I cannot however for the love of my life understand how i can paste text from clipboard into nano or vim using this conf. Can anyone please help me?

Try press the Shift before you paste your text.

@HadowStark

This comment has been minimized.

Copy link

@HadowStark HadowStark commented Mar 5, 2020

Not having a success getting the window switching to work.
Any suggestions for a Tmux 2.4 newb?

# Shift arrow to switch windows
bind -n S-Left  previous-window
bind -n S-Right next-window

I have the same question, anyone help?

@ethereal-sandeep

This comment has been minimized.

Copy link

@ethereal-sandeep ethereal-sandeep commented Apr 23, 2020

set -g window-status-current-style bg=white,fg=black,bold

Thanks man !

@whyDontI

This comment has been minimized.

Copy link

@whyDontI whyDontI commented Jul 21, 2020

Can someone explain about the bottom right status information.
What is being displayed there with time?

BTW the its the best conf!
Thanks man

@panzerstrike

This comment has been minimized.

Copy link

@panzerstrike panzerstrike commented Aug 18, 2020

Can someone explain about the bottom right status information.
What is being displayed there with time?

BTW the its the best conf!
Thanks man

I believe it's CPU load

@whyDontI

This comment has been minimized.

Copy link

@whyDontI whyDontI commented Aug 18, 2020

yeah figured its /proc/loadavg

@disus

This comment has been minimized.

Copy link

@disus disus commented Sep 1, 2020

Thank you for sharing! For those poor souls, like me, who have found themselves beating their heads against the wall (or other hard surfaces) after trying an unholy amounts [ and combinations ] of key bindings, including reserving to utilizing AutoHotKey scripts, while utilizing Windows Terminal - there is a cure!

You will have to un-bind the default actions from the key combinations in the settings.json. Example :

{ "command": { "action": "", "input": "" }, "keys": [ "alt+up" ] },
{ "command": { "action": "", "input": "" }, "keys": [ "alt+down" ] }

I am not sure if it works on all versions (in my case, version 1.2.2381.0). However, hopefully this tip will give the suffering individuals a direction at root of the cause => to check if their CLI/Terminal app is hijacking the commands.

Cheers.

@premanuj

This comment has been minimized.

Copy link

@premanuj premanuj commented Sep 29, 2020

mode-mouse option is no more availble in new version. Instead you can use set -g mouse on at line 13.

@hasparus

This comment has been minimized.

Copy link

@hasparus hasparus commented Oct 2, 2020

I love this thread. Thank you so much @premanuj, @juvenal, @spicycode 🙇‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.