Learn RubyMine Tutorials

Navigate in RubyMine Like a Pro

Last update: Dec 4, 2018

We hope you found our recent Most Important Shortcuts post useful, and we’ve decided to continue this series to make your everyday work with RubyMine more productive.

In this post we’ll go over the navigation features in RubyMine that will make you forget (or almost forget) about using a mouse or touchpad during development.

Navigating between tool windows

Everyone needs to navigate between tool windows. Here are the shortcuts for the most important ones:

  • Project tool window — ⌘1 / Alt+1
  • Run/Debug/Test/Console tool window — ⌘4 / Alt+4
  • Structure tool window — ⌘7 / Alt+7
  • Version control — ⌘9 / Alt+9
  • Terminal — ⌥F12 / Alt+F12
  • Editor — Esc

By the way, you can also use ⌥F1 / Alt+F1 to navigate between IDE components. This one comes very useful when, for example, you are working on a file, and then need to find it quickly in the project tool window, or open it in the file explorer.

Use ⇧⌘F12 / Ctrl+Shift+F12 to hide all tool windows and focus on the editor.

Finally, use ⌃` / Ctrl+Back Quote to enter the Switch pop up, and then choose View Mode | Enter Distraction Free Mode to get rid of any disturbing elements and focus on your code completely:

Navigate to Action, Class, Symbol, or File

In the previous post we mentioned Search Everywhere. For navigating to specific entities, there are more specific shortcuts. Let’s get started:

  • Navigate to action — ⇧⌘A / Ctrl+Shift+A. This shortcut lets you launch any action, from splitting your editor tabs to bundle commands:

  • Navigate to file — ⇧⌘O / Ctrl+Shift+N. Use this shortcut to navigate to any file or directory in your project.
  • Navigate to class — ⌘O / Ctrl+N. This shortcut will send you to any class or module in your project.
  • Navigate to symbol — ⌥⌘O / Ctrl+Shift+Alt+N. This one is a fast way to jump to any method.

While inside a file, use ⌘F12 / Ctrl+F12 to see the file structure and jump to the desired element.

This one probably doesn’t need any introduction. Use ⌘↑ / Alt+Home to jump to the navigation bar and choose the desired file or directory. You can navigate through your project with arrows, or just search by typing the characters

Note that by default the navigation bar works in floating mode. To attach it to the toolbar, enable it in View | Navigation Bar.

Open Recent files / Recently edited files

Simply click ⌘E / ⇧⌘E or Ctrl+E / Ctrl+Shift+E to access the popup with the recently opened/edited files, and navigate to the file you need. You can even search through files:

When working on a specific Rails entity, like a controller, you can navigate to the related test, view, model, and helper with ⌃⌘↑ / Ctrl+Alt+Home:

There’s also a separate shortcut for navigation to the related test and back: ⇧⌘T / Ctrl+Shift+T:

Navigate to previous/next method or tag

Use ⌃↑ / ⌃↓ or Alt+Up / Alt+Down to navigate between methods or tags in the file:

Note that on Mac, ⌃↑ / ⌃↓ can be used by default for Mission control and Application windows. You can turn off in your laptop’s System Preferences, or reassign next/previous method shortcuts in RubyMine (Preferences | Keymap).

Move to the start/end of any scope

You can toggle between any code block start/end, matching opening/closing brackets, or braces with ⌃M / Shift+Ctrl+M. This is very useful when you are working with heavy code that has a lot of blocks, hashes, and parameters:

Navigating with bookmarks

Shocking, but some users don’t know that RubyMine allows you to create bookmarks and navigate to them. Hit F3 / F11 to set a bookmark on a current line. If you want your bookmarks unique, set numbered or named bookmarks with ⌥F3 / Ctrl+F11. Then you can navigate to the bookmarks in your project with ⌘F3 / Shift+F11:

Finally, don’t forget that you can always add or reassign shortcuts in Preferences / Settings | Keymap.

Do you have other favorite navigation tricks in RubyMine? Let us know in the comments!

Cheers!
Your RubyMine Team

PS This blog post used Michael Hartl’s sample app to show all the navigation abilities of RubyMine. If you are new to Ruby on Rails, check out the rails tutorial.

image description