Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rubymine shortcut to insert <%= %>

Is there a shortcut for inserting a <%= %> in Rubymine?

I took a look in keymap and didn't see anything.

like image 557
Tyler DeWitt Avatar asked Mar 09 '12 18:03

Tyler DeWitt


People also ask

What is Ctrl Shift R in IntelliJ?

shift+F6. rename. ctrl+shift+r. ctrl+shift+N. find file / open resource.

What is Ctrl Alt L in IntelliJ?

Sometimes code formatting can get out of sync, but there's an easy fix in IntelliJ IDEA. You can use ⌘⌥L (macOS), or Ctrl+Alt+L (Windows/Linux) to reformat a selection of code according to your reformat settings.

What does Ctrl d do in IntelliJ?

I use Ctrl+D to add to selection (discrete multiple select) the next occurrence of the string (or substring) highlighted. And to skip adding next immediate selection to selection but the one after it, I use Ctrl+K, Ctrl+D.


1 Answers

The default shortcut is Ctrl+Shift+Period on Windows and Cmd+Shift+Period on Mac. It may not work on all the keyboards, in which case you can change it in Settings (Preferences on Mac) | Keymap: Main Menu, Tools, Erb, Insert <%= %>:

keymap

You can also use code completion:

completion

After accepting this choice you'll get:

<%= | %> 

Another option is to define a live template:

live template

Type re, then Tab to expand.

Finally, you can define a keyboard shortcut for any text/template using the following trick:

  1. Edit | Macros | Start Macro Recording
  2. Type re, then Tab
  3. Edit | Macros | Stop Macro Recording
  4. Save it under RubyExpression name

Now go to Keymap settings and assign a shortcut to RubyExpression under Edit, Macros.

like image 187
CrazyCoder Avatar answered Oct 04 '22 02:10

CrazyCoder