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 <%= %>
:
You can also use code completion:
After accepting this choice you’ll get:
<%= | %>
Another option is to define a live template:
Type re
, then Tab to expand.
Finally, you can define a keyboard shortcut for any text/template using the following trick:
Edit
|Macros
|Start Macro Recording
- Type
re
, then Tab Edit
|Macros
|Stop Macro Recording
- Save it under
RubyExpression
name
Now go to Keymap
settings and assign a shortcut to RubyExpression
under Edit
, Macros
.