How to insert line feed above/below and move to caret to it (like CTRL + Enter in Sublime)


Hello! I am trying out PHPStorm and I am noticing I am missing one feature that I usually use all the time in Sublime Text. It is the CTRL + Enter and CTRL + Shift + Enter functionality. CTRL + Enter in Sublime inserts a line below the current line and moves the caret to it. CTRL + Shift + Enter does the same, but with the line above. In PHPStorm it appears to do different things, from breaking the line (if you are inside a string) to inserting a line feed below without moving the caret to it, to simply nothing and staying put.

I would like to know if there is a way to make these key combinations do the same as they do in Sublime Text. I have tried Google and this forum, and searching in the preferences in PHPStorm, but I can't seem to find which setting I can modify to make this work. Help is much appreciated!

Comment actions Permalink

Hi there,

Shift+Enter (here on Windows using Default keymap) adds a new line after current and moves caret to the beginning of it (indented).

On your PC/Mac you can check and change shortcut at "Settings/Preferences | Keymap". The action that does the aforementioned is "Editor Actions | Start New Line"

To do the same but before current line is Ctrl+Alt+Enter and appropriate action is called "Editor Actions | Start New Line Before Current"

P.S. That settings screen has local search box (+ search by shortcut next to it) so it should be no problem for you to quickly locate those actions in the list.

Comment actions Permalink

Andriy Bazanov Thanks for the reply. I just realized that you guys are talking about phpstorm whereas I'm looking for an ansnwer for resharper :D 

Comment actions Permalink

This was exactly what I was looking for, thanks!

Comment actions Permalink

I'm confused... which documentation should I turn to for such information? The official shorcut cheatsheet obviously contains only a small part of the shortcuts. Also, in this cheatsheet, `Ctrl + Alt + Enter` does "Reformat code", which is consistent with my env's behavior.

Comment actions Permalink


This depends on the Keymap used. My comment was about Default / Windows keymap.

You can check and adjust (add/remove/replace) any shortcuts at "Settings / Preferences (on Mac) | Keymap"



Please sign in to leave a comment.