Navigate in RubyMine like a pro

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

tool_windows_navigation_rubymine

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 folder.

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:

editor_mode_rubymine

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 install:

find_action_rubymine

  • Navigate to file — ⇧⌘O / Ctrl+Shift+N

Use this shortcut to navigate to any file or directory in your project:

go_to_file_rubymine

  • Navigate to class — ⌘O / Ctrl+N
  • Navigate to symbol — ⌥⌘O / Ctrl+Shift+Alt+N

Navigate to class will send you to any class or module in your project. Navigate to symbol is a fast way to jump to any method:

go_to_class_symbol_rubymine

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

Navigation bar

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

navigation_bar_rubymine

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:

open_recent_file_rubymine

Navigate between Rails entities

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:

navigate_rails_entity_rubymine

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

go_to_test_rubymine

Navigate to previous/next method or tag

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

navigate_between_methods

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 performs different actions like verbose controllers:

toggle_brace_rubymine

Breadcrumbs

In one of our latest Early Access Programs, we also added breadcrumbs for structure elements in Ruby. This feature will be available in v2017.2 due out this July, but you can already jump to the related post to see how it works and try this feature in the latest EAP build.

Navigating with bookmarks

Shocking, but some users don’t know that RubyMine allows creating bookmarks and navigating 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:

bookmarks_rubymine

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

This entry was posted in Productivity. Bookmark the permalink.

2 Responses to Navigate in RubyMine like a pro

  1. Junichi Ito says:

    Hello, this post is also very useful! There are many shortcuts I did not know.

    And I also translated this into Japanese:

    【翻訳】プロ並みに生産性を上げる!RubyMineのナビゲーション用ショートカット集 – Qiita
    http://qiita.com/jnchito/items/297173e671a069772804

    I think it will help Japanese RubyMine users :)

Leave a Reply

Your email address will not be published. Required fields are marked *