For those who are just getting started with tmux: I advise looking around others' .tmux.conf files for some sensible settings. Like Vim, Tmux ships with a lot of powerful features disabled by default.
My absolute favorite has to be binding a hotkey to opening URLs in the current window [0]. See [1] for a small demo I just recorded.
As long as the comment is useful and contributes, I think it's fair game. This definitely qualifies. That said, if it's not free, I personally would prefer that be mentioned, (and at the same time a link to a free sample chapter or equivalent if it exists would be useful).
One tweak I can't live without is having the same key bindings to seamlessly switch between tmux panes and Vim split windows. (https://gist.github.com/mislav/5189704)
My prefix key is Ctrl-Space. It's very convenient to press on the keyboard, I'm surprised to not see it used more widely (maybe because it's commonly bound to some OS utilities?).
> One tweak I can't live without is having the same key bindings to seamlessly switch between tmux panes and Vim split windows.
YES, THIS! Setting up directional pane navigation to work with both tmux and vim panes as first-class entities was a huge workflow boon for me as well. It was a significant change that helped kick my setup over into vim+tmux+zsh as IDE vs. merely a collection of separate parts.
It's worth noting that some relevant bits of @mislav's stuff has been packaged up nicely as a Vim plugin:
I also just noted that @tarruda (of neovim fame) chimed in on @mislav's gist with his own independently created version of the Vim-side of things. It looks worth comparing some of the implementation details from @tarruda's work, he's done some stuff to eliminate redraws in Vim, etc.
> It was a significant change that helped kick my setup over into vim+tmux+zsh as IDE vs. merely a collection of separate parts.
Same thing here :) I also set `tmux attach -t base || tmux new -s base` as my start command in iTerm which kind of forces me to use tmux windows/panes/sessions instead of iTerm tabs. It took a while to lose the habit of hitting `cmd-t` but was definitely worth it.
The thing that sucks now is that I'm really not sure which parts of my environment can be optimised further other than learning new Vim commands :)
Heh, I have something similar, with a tmux session-start script[1] that's the first thing run by my default iTerm windows. It displays and lets me select from existing sessions via prompt tab completion. Or I can just enter a new session name at the prompt.
Or used directly from a normal command line (with zsh completion [2]) as:
mux <session_name>
Apologies to tmuxinator users for conflicting with 'mux'; obviously feel free to rename it. This is really just a part of my personal setup vs. a formally published utility, and I don't use tmuxinator.
Honest question: Is there any benefit of using tmux over a proper tiling window manager? Or, why would I want to delegate some of the window manager tasks to a terminal emulator?
I use both a tiling window manager (xmonad) and tmux. The main reason I started using tmux was to do pair programming sharing the same terminal via ssh. If you pair program and have never tried this before, I highly recommend trying it. I live in Japan and even pair with people in London using tmux and vim. It's the next best thing to being there.
After I started getting used to using tmux, I found that my workflow naturally separated between things I'm doing on my terminal and things that require X (like my browser). These days I use a separate workspace for X apps and terminal (occasionally moving them around).
To make my life easy, I've added xmonad-like key bindings and window layout to tmux. Since other people are sharing:
I often work while travelling and when I'm on the road I often don't bother cranking up X -- just work in the Linux console. Using tmux I barely notice a difference in my workflow and it helps extend the battery.
For me it's having two different terminals connected to same tmux session. I use tiling window manager and work on two monitors. Sometimes there is some stuff that I'm working on on my main monitor but I want to have quick look at the terminal. Because I have two terminals opened on both monitors I can just switch to the other one, press ctrl+f(my prefix)+number and have exactly same window as in my main terminal.
For anyone wondering you can achieve above by typing tmux new-session -t and giving it number/name of your current session.
Also there are minor things that are nice. Like if you need to open another terminal instance in the same directory as you're currently in.
I use <C-s> for my local machine, and I make the servers I login to use <C-a>. I bind the caps-lock key to ctrl, so it works out pretty well, and lets me work with both local and remote contexts at the same time fairly nicely.
> My absolute favorite has to be binding a hotkey to opening URLs in the current window.
I suppose this stops working if you SSH into some box and run tmux there? I've implemented something similar, but as an urxvt plugin instead, which avoids that limitation: http://www.cs.helsinki.fi/u/tmtynkky/urxvt.png (Once Alt-O is pressed, the hotkeys with the red background appear next to each link; pressing the hotkey opens the link in browser and copying to clipboard is also possible)
For a while I ran a setup where I did all of my work in a local tmux session, but part of this work involved SSH-ing and attaching to a screen session.
When using both, especially nested, I found it beneficial to have a different leader for each.
I also use <^-a> to go to the start of the line, so I'd miss that.
My absolute favorite has to be binding a hotkey to opening URLs in the current window [0]. See [1] for a small demo I just recorded.
To get started, here's my current config: [1]
[0]: https://github.com/jbnicolai/tmux/blob/master/.tmux.conf#L12...
[1]: http://recordit.co/vdxy09GpYG
[2]: https://github.com/jbnicolai/tmux/blob/master/.tmux.conf