Custom shortcuts

Hello everyone. I'm trying PhpStorm, coming from PHPEd.

I cannot figure out if it's possible to have some shortcuts. Just for example in PHPEd pressing CTRL + Enter makes a <br/> on the editor. Can I do the same on PhpStorm?


You may try to record a macro and assign a shortcut to it.


Thank you Alexey, unfortunately I think that a bug exists on macro.
If I record a macro, IE: put <br/>, and I call it (via key binding or via menù interface) shows me only br;. If I close and reopen the IDE puts /lt.

I think it's time to file a bug: here is it!


hey folks.
i'm having trouble with this:
made a macro and assigned it to CTRL+ENTER

in some context (i guess if html is detected) my <br /> macro will autocomplete to <br />>. since this was more often the case, than the one without autocomplete i changed the macro to insert just <br / and then type > myself if it is missing. but this is the case way to often - like having text in a variable wich needs a linebreak.

so how can i work around this?


Better use another shortcut -- Ctrl+Enter, Ctrl+Shift+Enter etc have special meanings and can be also executed after executing the actual macro.

I would even say -- use Live Templates instead (e.g. b[TAB] will be transformed to <br />)


you're right, i took Ctrl+Shift+Enter, and probably changed the shortcut for the original action, or maybe removed it from the keymap - so there's not trouble with that.
well, pressing Ctrl+Shift+Enter is way faster then pressing any blah and then tab combination...
so: how to get rid of the autocompletition thing when inserting text with a macro. it's kind of a bug, isnt it? i mean, it seems to be simulating typing text, but shouldn't it rather paste a certain string in -i guess- 99% of insert-text-macro-cases?

ps: i do already use the templates for some stuff (eg. wrapping text with <b> or <p>) so i think i try one and assign it to the shortcut, but still i think, it's kind of a bug in the macro case... and well i did that macro after i googled and ended up here, and did the wrapping live templates later.


well.. i now got this macro for a <br /> livetemplate:

    <macro name="html-br">
      <action id="InsertLiveTemplate" />
      <typing text-keycode="66:0;82:0">br</typing>
      <action id="EditorChooseLookupItemReplace" />

assigned it to Ctrl+Shift+Enter and it works.
but this is too slow!
the typing variant was inserting the text instantly, now it takes a while because the dropdownmenu is opened, typing, selecting, inserting the template. (i've got a 4x2.2MHz, so thist shouldnt...)
i mean, this is ok for wrapping, but not acceptable when typing:
if i continue typing after having pressed Enter, which i usually do, this will be before the macro is done and things get f*d up.

so please, what else can i do?


Please sign in to leave a comment.