HTML & Soft wrapping

Hi,

when editing HTML with PhpStorm, I frequently run into situations where PhpStorm’s wrapping behaviour is driving me mad.

For instance, I have a line like this one:

<label for="some-id">Field label<span>*</span></label>

Now, I insert the cursor before the closing “>” of the opening “span” tag, in order to insert “ ”. But, as soon as I hit the space bar, PhpStorm inserts a hard linebreak and the rest of the line (“>*</span></label>”) is moved to the next line. (Note aside: Of course, in reality, the line is much longer and the insertion point is actually near the right window boundary.)

No matter, what combination of Preferences > Code Style > HTML > “Wrap attributes” and Soft wrapping I use – I haven’t yet managed to turn this off. I’d like PhpStorm to just break the line visually in the editor, but not to insert any kind of newline and/or indentation. If that’s not possible I’d prefer to have very long lines instead of hard-wrapped lines.

For PHP, this works pretty well, but for HTML this is just annoying.

Any help is appreciated.

BTW, version is PhpStorm 3, 111.19.

Carsten

6 comments

Hi Carsten,

  • to turn off auto hard wrap on typing please uncheck 'Project Settings | Code Style | General | Wrap when typing reaches right margin';
  • to turn on soft wraps please check 'IDE Settings | Editor | Use soft wraps in editor'. I'd also recommend to check 'Use custom soft wraps indent' there and set it to, say, 2;


Regards, Denis

0

denis.zhdanov schrieb:

  • to turn off auto hard wrap on typing please uncheck 'Project Settings | Code Style | General | Wrap when typing reaches right margin';

Hi,

thanks a lot – this was the culprit!

Carsten

0

How do we turn this off in PhpStorm 2018? I can't find setting to turn this off and it is driving me batty.

0

@Philip Tyrer

"Settings/Preferences | Editor | Code Style"

It can then also be overridden for specific language (HTML is one of them):

1

Thank you Andriy. Those are my settings but you made me look under Code Style > HTML and I found that unchecking "Wrap text" does what I need.

0

@Philip Thank you!!! This has been driving me nuts for a long time. I have a WordPress blog and WP takes the hard wraps literally.

0

Please sign in to leave a comment.