10 RubyMine Shorcuts you Shouldn’t Miss

RubyMine shortcuts can make 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

Double shift 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, or options, and jumps to the entity you need:

search_everywhere_rubymine

Double Shift can also find other actions, show their own shortcuts, and let you run them:

search_everywhere_actions

Moreover, you can also find and adjust your IDE settings via “Search everywhere”:

search_everywhere_IDE_settings

Navigate to declaration/implementation: ⌘+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:

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

Show intention actions: ⌥Enter or 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

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 … : ⌃⌥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.

Refactor this: ⌃T / Ctrl+Alt+Shift+T

Refactorings are some a popular favorite among RubyMine users. 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

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_1

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

This entry was posted in Comfort, Productivity, Uncategorized. Bookmark the permalink.

6 Responses to 10 RubyMine Shorcuts you Shouldn’t Miss

  1. Scott Smith says:

    Wow, didn’t know about shift/shift. Also didn’t know about how easy intentions are to manage on a granular level. Thanks!

  2. Andrey says:

    Shift/shift is a godsend!

  3. Junichi Ito says:

    Hello, I translated this post to Japanese:

    【翻訳】絶対見逃せない!RubyMineのショートカット10選 – Qiita http://qiita.com/jnchito/items/6eda2cd54038ffa829ef

    While translation, I found a wrong shortcut here:

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

    I think ⌃R should be corrected to ⌥R.

  4. Pingback: Navigate in RubyMine like a pro | RubyMine Blog

  5. Victor Ivanov says:

    I find Cmd + [ indispensable – once you travelled somewhere with Cmd+b you need to go back, and Cmd + [ does exactly that!

Leave a Reply

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