Recently I’ve been working with a kick-ass combination of Vim, tmux, and my cloud virtual machine that has increased my productivity.
Workflow
- Open terminal
- ssh into cloud VM
- Create a new tmux session (
tmux new -s [session name]
) or attach to an existing one (tmux attach -t [session name]
) - List tmux sessions with
tmux list-sessions
- Use Vim, open like 50 tabs, don’t care about it
- Lose network connection, put computer to sleep, abruptly or accidentally close terminal
application because you’re like F**k this. I’m going home, or intentionally detach from tmux
session (
ctrl-b d
) - Reattach to tmux session
- BAM, it’s like you never left!
Advantages
- Your cloud VM is almost always on, unlike local machine, so your tmux sessions never die
- Vim is installed on most machines; with most GUI editors, you’ll need to mount a filesystem if you’re working on a remote machine
- If your cloud VM has a public IP or you’re inside a VPN, you can share your environment and in-progress work with others; and if you’re developing for the web and want to test your site on various hardware and browser combinations, just point them to one URL – no more shitty simulators
- You’re not tied down to hardware. Install your ssh key on various computers and never carry around a laptop ever! The way cloud computing should be.
Basic tmux Commands
The below commands should be run within a tmux session.
- New window
ctrl-b + c
- Switch window
ctrl-b + n
- Split pane vertically
ctrl-b + %
- Split pane horizontally
ctrl-b + "
- Switch pane
ctrl-b + o
Post your own tips, circle-jerk comments, or contrarian drivel below.