Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

LABS
Searching Within a File in RubyMine

After opening a file, your next step is usually to search within that file for some text, or perhaps, a particular method. Like text editors, RubyMine supports simple text search. However, it also offers more powerful method and usage search. In this post, we’ll look at various ways to search within a file in RubyMine on OS X.

Text Search

Press command + F to search for text within the current file. Use command + G and command + shift + G to move forward and backward through the search results.

After selecting text, search for it with command + F.

After beginning a text search with command + F, press control + H to view recent searches.

recent-searches.png

Repeat the last text search by not entering a query into the search bar, and then pressing return.

Word Search

Enable quick word searching by adding a shortcut for the “Find Word at Caret” command. I map it to control + F3. If you use this mapping, then you may have to disable the OS X “Move focus to the the dock” shortcut.

Method Search

Use command + F12 to view the structure of the current file in a popup, then type the name of the method you’re looking for.

method-search.png

This is quicker and more accurate than using text search.

Usage Search

Find usages in the current file of the symbol under caret (e.g., a variable, method, or class) with command + F7. Use command + G and command + shift + G to move forward and backward through the usages.

Highlight usages in the current file of the symbol under caret with command + shift + F7. Use command + G and command + shift + G to move forward and backward through the usages.

highlight-usages-in-file.png

Press Esc to clear the highlighting.

Search for Code Not Text

By being aware of code, an IDE can allow you to search for a method, instead of performing a text search such as “def show”. Text search will always have its time and place, but use it as a last resort. Move on from old text editor habits and learn your IDE’s more powerful alternatives.

Comments
Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *