Last Updated: June 24, 2016
·
252
· ryrych

Finding inside current gemset with GEM_HOME

Code archaeology, or code searching is an indispensable skill a developer should have. If you know how to move around git blob, projects or libraries you can be more productive.

Current gemset path is stored in $GEM_HOME. Suppose that you’d like to find all occurrences of enqueue as you’re writing tests for a background job. In Vim it’s very simple. Just type: Ag enqueue $GEM_HOME, press <kbd>TAB</kbd> and the path will expand to something like this:

:Ag enqueue -w /Users/user-name/.rvm/gems/ruby-2.2.4@ntbackend/gems/activejob-4.2.6/

All found occurences will pop into quickfix list. That’s it!