Getting Into Tmux
I had tried out screen on OS X and failed to make it stick with me as a day to day tool, but recently I started using tmux and can’t imagine going back. Some of the things that set tmux apart are it’s ability to do vertical splits w/o any screwy patches and scriptability.
So lets start with the basics, installation.
You can surely install this other ways, but using homebrew is super easy and you should be using it anyway.
Like any tool there is some stuff that I got into the config file right away to make it feel more homey. First, I switched out the default command prefix C-b for C-a. From what I’ve read the only reason C-b is the default is so that it doesn’t conflict with scree. C-b is torture for your fingers though so there’s no reason to stick with that.
Next, because I use vim as my editor, I told tmux to us vi mode keys.
Finally, I setup some bindings so that I can move around splits using the vim movement keys.
1 2 3 4
That’s it. That’s everything in my ~/.tmux.conf right now. Like I said I just started with tmux so I’m sure my customizations will grow but as a vim user this is what I needed to make tmux feel more like home.
As I got into using tmux there was definitely a point at which I learned just enough so that I was comfortable using it all the time and didn’t think to myself “Why am I using this, if I was using straight terminal I could do x so easily”.
Here’s the rundown of my most used commands…
Note: I use C-a in all the examples below, but if you have a different prefix set up substitute that for C-a.
Creating a new session from the command line:
Creating a new session from within a running session:
What’s cool here is that while in tmux you can hit
C-a : and get a tmux command prompt and execute any of the normal tmux commands.
Attaching to running session:
or if you know you only have one running session just:
Creating new windows while in a session:
Naming your current window
A note on copy-mode… I kind of think of this as entering normal mode in vim.Being in copy mode allows you to move around the terminal just like normal mode in vim. To be honest, I’m pretty sure I’m not using copy-mode to it’s full potential yet. I mainly use it to scroll up to see things that have gone out of view in my terminal window.