Get Started with Vim & tmux
I recently switched to a Vim and tmux work environment. The transition was fairly straightforward, and the results are awesome. Vim and tmux will enable you to increase your productivity by:
- Keeping your fingers on home row
- Navigating and editing text incredibly fast
- Configuring a custom terminal layout
In case you don’t know, Vim is a free, open source text editor that can run from the command line. Vim is great because of its powerful text navigation and editing commands. tmux is a terminal multiplexer that provides you with the power to split a single terminal into many windows and panes, which is useful for keeping a coding environment organized.
Below are resources and steps that will help you configure a Vim and tmux coding platform.
Step 1: Confirm that Vim is installed on your system. Download it if it isn’t.
If Vim is installed, entering “vim” at the terminal will start a Vim session.
Step 2: Watch Mike Coutermarsh’s presentation on learning Vim.
Mike presents insight and advice that serves as a good intro to Vim, and I second Mike’s suggestion to remap your Caps Lock key to ESC.
Step 3: Configure Vim
I started by installing Mike’s dotfiles. After having worked with Vim for a bit, I changed the configuration a bit but kept most of the original content. My advice: start with Mike’s files, and customize as you learn. You can find my dotfiles here.
Step 4: Install Solarized color scheme (optional)
Step 5: Install tmux
Both tmuxinator and Tmux Resurrect allow you to reload a layout in tmux. With tmuxinator, you create a project, which loads a layout and initiates operations in a brand new tmux session. My development layout for tmux is here. Tmux Resurrect saves and reloads a tmux session. I use both because I like the flexibility that using both provides.
Step 7: Practice with Vim
Read through your .vimrc to see what mappings you have, then go through the Vim tutor by entering “vimtutor” in the terminal. Another good way to practice is to work alongside Vim Casts, starting at the beginning. If you’re hungry for more, watch Ben Orenstein’s presentation on intermediate to advanced Vim.
Other helpful plug-ins:
NERDtree — Open a filesystem navigation window in Vim.
NERDcommenter — Easily comment out sections of code in Vim.
emmet-vim — Quickly generate standard HTML code.
vim-obsession — Save Vim sessions much more easily.
Use Google & Stack Exchange to resolve any errors you encounter, and stay determined. If you’re on a different OS for which a program I listed isn’t available, search for popular alternatives. If you have any questions or suggestions, leave a comment!