Vim – Navigating files in vertical splits
Posted 12 March 2012 @ 11am in vim
The two most useful native vim mappings for navigation are arguably
gf (go to file, use it over any reference to a file, such as a Rails partial), and
Ctrl-] (go to tag, use it over any class or function name). But one problem in vim is that by doing these commands, you lose your previous place. Sure it’s easy to go back to with Ctrl-O or similar, but I find it much more useful to open the new location in a split, as you are usually exploring them while retaining the current context. Here are two mappings that do that for you:
If you like these, you might want to check out my Yet Another Dotfile Repo project, which includes these and more!