Vim Tricks
Ways to make Vim even better.
Preamble
I love Vim. I use more powerful editors all the time (Sublime, PyCharm) and my first customization is always to get Vim emulation set up. Here's a collection of useful tricks I've picked up; some are Vim movements, others are just for the Vim editor.
(Last update: 2014-12-17)
Tabs (Vim editor)
Open multiple files in the same window with shared buffers. It's really easy:
- $ vim -p file1 file2 file3 opens three files in different tabs.
- Switch between tabs with gt and gT in command mode, or ngt (where n is the index of the tab starting at 1).
- The buffer is the same across tabs, so yanking/pasting across tabs is easy (just use y and p as you would in a single document).
- Close a tab with the usual :wq or :q!
- Add a tab with :tabe filename.
This information was gleaned from this Stack Overflow post. Happy tabbing!