*This article was originally posted on June 18th, 2019 at: https://nickjanetakis.com/blog/using-tmux-sessions-windows-panes-and-vim-buffers-together
Now that I've been using Vim for a few months, I figured it would be a good time to share my day to day work flow on how I’m using it with tmux (something I've been using for years).
While figuring all of this out, I occasionally struggled between choosing to launch multiple terminal applications, tmux sessions, windows, split panes, Vim buffers and / or tabs. This is what I came up with in the end, and it’s been working great so far.
As a freelance developer, open source enthusiast and someone who likes hacking on my own projects, it’s no surprise that I have a lot of active projects.
This 10 minute video shows how I manage all of these projects on the command line.
Demo Video Showing How It Works
Timestamped Table of Contents
- 1:14 – Listing out a few tmux sessions
- 1:43 – Having 1 tmux session per project
- 2:22 – Attaching to a specific session
- 2:33 – Splitting individual files with Vim buffers
- 3:35 – Using tmux windows for separating Vim from your web server
- 3:47 – Splitting a window in half with tmux panes
- 4:01 – Using tabs in Vim to split up your buffers into groups
- 5:32 – Leveraging a second tmux window for running other processes
- 6:21 – Zooming in and out of a specific pane with tmux
- 6:53 – Recapping the workflow for developing and deploying my blog
- 8:03 – Switching between different projects / sessions is where tmux shines
- 9:43 – Persist, save and restore sessions with tmux-resurrect
Reference Links
- Intro to tmux
- https://github.com/tmux-plugins/tmux-resurrect
- https://github.com/nickjj/dotfiles
- https://github.com/mintty/wsltty
What's your favorite tmux / Vim workflow? Let me know below!