Vim goto file

VimEver have one of those days when you learn something so fundamental in a tool that you use that it leaves you shaking your head and wondering "why have I never known this before?"

Today was one such day for me. I use Vim, specifially console vim, as my daily development tool for multiple languages. I'm still in the process of "tooling up" for Elixir and Phoenix in Vim, but for Ruby and Ansible, which are what I work on most these days, it's perfect.

One of the tools that has spoiled me is vim-test. This wonderful tool makes running tests just plain easy and just a few keystrokes. From being able to run a specific test, a specific file, and more, it just makes running tests easy. Love it.

Vim also makes it easy to find files. I use a number of plugins, such as ctrl-p to do so. One of the things that I've always wanted to be able to do was to be able to directly go to a file where rspec has encountered an error. I've always used ctrl-p to open the file with a number of keystrokes. That's always been fine. Imagine my humble surprise to find the :gf command today while trying to figure out if I can do that. :gf 'goto file' makes it super easy to go to the filename under the cursor. Wow. What a game changer for me! It's amazing that I've been using vim for about 20 years and have never used that one.

Share this post