Hardscrabble 🍫

By Max Jacobson

terminal multiplexing with tmux

03 Jan 2015

I made this video a few months back with my friend Alex Au. It’s a crash course in how to use tmux. We made another, shorter, video about why you might want to use tmux as well:

If you find yourself with more than a couple of terminal tabs or windows open all the time, I think you should consider using tmux instead. In the last few months I feel like I’ve hit a sweet groove with my terminal use, where I pretty much never have more than one tab or window open. Instead, I have one tmux session per project, and several virtual tabs (“windows” in tmux parlance) per project. The thing I learned most recently that makes this really fly is the keyboard shortcut for switching from one tmux session to another without ever leaving tmux. I only ever really leave tmux to navigate to a different directory and start a new tmux session.

Here’s what that looks like:

tmux flow

(I gotta look back into those failing tests in film snob…)

The keyboard shortcut that takes you to the session switcher is ctrl+b s (s for switch). For me, it’s super useful. Hopefully you’ll find it useful, too.

A cleaner file browsing interface for vim

02 Jan 2015

A cleaner file browsing interface for vim from Max Jacobson on Vimeo.

TLDW: add this to your ~/.vimrc:

" hide the giant banner at the top of netrw
let g:netrw_banner=0
" hide gitignored files from netrw
let g:netrw_list_hide=netrw_gitignore#Hide()

And then use netrw instead of NERDTree.

useful tool: storm

01 Jan 2015

I’ve been sort of passively looking out for something like this for a while. Here’s the problem: there are a lot of remote servers I may want to SSH into at any given time, and I am not going to remember all of their usernames or IP addresses. Not gonna happen.

I’ve been dealing with this by creating custom aliases. So I put something like this in my ~/.bash_profile:

alias 'eug'='ssh pair@some.ip.address'

Then, whenever I want to connect to Eugene’s server so we can pair program, I just type eug and hit enter, and I’m there. Not bad! It even tab-completes.

Not great either. It’s hard to keep track of them. I can type alias at any time to list all of the defined aliases, and that’s pretty sweet, but it includes several things, not just ssh aliases. I’ve kind of wanted a tool that was more tailored to this job.

Sooo, enter storm. I found it via one thing well, a sweet blog for nerdy stuff like this.

Storm lets you define aliases to remote servers like this:

storm add eug pair@some.ip.address

Once you do that, you just type ssh eug to connect. It has some other helpful subcommands like storm list to tell you all of your aliases even storm web to spin up a nice local web server to provide a web interface for managing your aliases…

Hey, wait a second. Somehow it’s hooking into the normal main ssh command!

After some poking around, I found that it’s saving the information in ~/.ssh/config as a plain text configuration file that looks like this:

Host eug
    hostname some.ip.address
    user pair
    port 22

And that I could’ve been using a similarly-structured file all along, and didn’t really need storm at all!

Hot dog.

Well, I’m going to use it anyway because it has a sweet interface and I’m kind of just grateful to have learned something from it? I’m guilt-tripping myself into using it.