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
- Navigate to Action, Class, Symbol, or File
- Navigation bar
- Open Recent files / Recently edited files
- Navigate between Rails entities
- Navigate to previous/next method or tag
- Move to the start/end of any scope
- Navigating with bookmarks
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
- 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:
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:
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!
Your RubyMine Team
Subscribe to Blog updates
Thanks, we've got you!
Collaborative Programming in RubyMine
Hi everyone, We're back with a new how2pro blog post unveiling another cool RubyMine feature – the Code With Me plugin. When you're knee-deep in a complex task or tangling with an issue that's testing your limits, having someone by your side can make all the difference. Additionally, in an educati…
Working With RBS in RubyMine
Starting with v2021.2, RubyMine provides code assistance for working with RBS files, along with all of the essential features that make RBS code easier to read. Here’s a brief overview. Creating RBS code Code completion Formatting and readability Navigation Refactoring Inspections Do y…
RBS: How to Get the Most Out of RubyMine’s Code Assistance
The following article shows the benefits of investing some of your time into adding RBS declarations to your project. Catch type errors RubyMine performs real-time type checking based on the information stored in .rbs files. It will show a type error if there’s a mismatch between the RBS and Ruby co…
How to Run Ruby/Rails Commands from the IDE instead of the Terminal
In the Ruby/Rails community, using a terminal is the most popular way to perform various commands and tasks. These tasks include running scripts, tests, Rails generators, Git and Docker commands, and many other things. We also noticed this ourselves when we did some RubyMine usability testing among …