Learn RubyMine Tutorials

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

search_everywhere

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”:
search_scopes

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:

go_to_declaration

If an object has multiple usages, RubyMine will display a dropdown list allowing you to navigate to any of those usages:

show_usages_ruby_rails

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:

go_to_gem_declaration

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:

intention_actions

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:

disable_inspections_rubymine

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:

rake_tasks_rubymine

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:

run_debug_rails

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:

run_anything

You can also hold Shift to run a debug configuration:

debug_anything

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

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:

vcs_rubymine

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:

insert_erb_tags

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:

insert_html_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:
code_formatting

More shortcuts

We hope the list above will prove useful in your daily work. When you’re ready for more helpful shortcuts, consult the full keymap for Mac or Windows/Linux on our website.

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:

find_assign_shortcuts_rubymine

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.

Cheers!
Your RubyMine Team

image description