10 RubyMine Shorcuts you Shouldn’t Miss
Last update: Dec 5, 2018
RubyMine shortcuts help you do your routine tasks significantly easier and faster. In this post we’d like to go over 10 of the most common and useful shortcuts you should know and use in RubyMine on a daily basis.
- Search Everywhere (
- Navigate to declaration (
⌘+Click / ⌘Bor
Ctrl+Click / Ctrl+B)
- Show intention actions (
- Run Rake tasks (
- Run Popup (
- Run Anything (
- Refactor this (
- VCS Operations Popup (
Alt + BackQuote)
- Insert ERB expression-printing tags (
- Surround with HTML tag (
- Reformat code (
- More shortcuts
Search Everywhere: Shift+Shift
Search Everywhere is the first shortcut you should learn when you start with RubyMine. It helps a lot as it literally searches everywhere, be it files, classes, “symbols” (Ruby & Rails methods), or options, and jumps to the entity you need:
As you can see on the gif, Search Everywhere also allows you to find and enable different actions, and navigate to the settings.
Note that you can use Tab to navigate between the search scopes, and look only for classes, files, actions, or “symbols”:
Navigate to declaration: ⌘+Click / ⌘B or Ctrl+Click / Ctrl+B
One of the most used shortcuts, this allows you to jump to the definition of any class, method, variable, asset, or any other object. Hold Cmd/Ctrl and click on the object to jump to its definition:
If an object has multiple usages, RubyMine will display a dropdown list allowing you to navigate to any of those usages:
By the way, there’s also a special shortcut for finding all usages of an object: ⌥F7 / Alt+F7
Note that RubyMine also allows you to navigate to the entities defined in Ruby, Rails, or other gems used in your projects:
Show intention actions: Alt+Enter
Static analysis is one of RubyMine’s most essential features. If you see highlighted/underlined code in your project, it means the IDE is suggesting a possible change. Place the caret on the highlighted code and press ⌥Enter / Alt+Enter to see the available intention actions and apply one if appropriate:
Some intentions may be annoying, excessive, or debatable. In this case you can turn a specific inspection off for a particular code line, file, or the whole project:
Read Intention Actions in RubyMine to learn more useful and newly added quick-fixes.
Run Rake tasks: ⌥R or Ctrl+Alt+R
In RubyMine you can look up your routes, run database migrations, and launch any other common or custom rake tasks with a simple shortcut ⌥R / Ctrl+Alt+R:
However, if you prefer doing it the old-school way, you can always open the embedded Terminal via ⌥F12 / Alt+F12 and run Rake tasks (or any other tasks) from there.
Run Popup: ⌃⌥R or Alt+Shift+F10
The best way to choose a process to launch, run the app, or edit your Run configurations is to press ⌃⌥R / Alt+Shift+F10 and open the Run popup:
Tip: Hold Shift and press Enter to debug the configuration instead of running it.
Run Anything: Ctrl+Ctrl
One of the previous RubyMine updates introduced a new way of running any command or script in RubyMine– Run anything. Press Ctrl twice to invoke it, and use it to run rake tasks, rails server, generators, configurations, or even terminal commands:
You can also hold Shift to run a debug configuration:
Refactor this: ⌃T / Ctrl+Alt+Shift+T
Refactorings are another reason people choose RubyMine. Select a piece of code, press ⌃T / Ctrl+Alt+Shift+T to open a list of refactorings relevant to it, and choose the desired option:
Learn more about refactorings in RubyMine Refactorings: Overview & Improvements.
VCS Operations Popup: ⌃V or Alt + BackQuote
Great VCS integration is another killer feature favored by many users across all JetBrains IDEs. Should you enter your local history, switch to a different branch, compare your version with the rep, or push/update your project, ⌃V / Alt + BackQuote is the shortcut you are looking for:
Insert ERB expression-printing tags: ⇧⌘. / Ctrl+Alt+
This shortcut is very useful when you are working with view files. When starting an ERB expression, press ⇧⌘. / Ctrl+Alt+. RubyMine will insert expression-printing tags so that you don’t waste your time typing that out manually:
Surround with HTML tag: ⌥⌘J / Ctrl+Alt+J
To wrap text in your view files with HTML tags, select it, press ⌥⌘J / Ctrl+Alt+J, and type the desired tag. RubyMine will also provide completion for the tags:
Reformat code: ⌥⌘L / Ctrl+Alt+L
This simply reformats your code according to the Ruby code style and your current preferences (Settings / Preferences | Editor | Code style). You can either hit ⌥⌘L / Ctrl+Alt+L anywhere in the editor to reformat the whole current file, or select a specific part of code inside the file and then use the shortcut to reformat the selection only:
Finally, you can always find and assign your own shortcuts in the IDE settings (Preferences / Settings | Keymap). Searching is available both by name and key bindings:
What are your favorite and most used shortcuts? Let us know in the comments below!
Don’t forget to join our users and the team on Slack if you haven’t yet.
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 …