Word wrapping in PhpStorm

Intellij IdeaPycharmPhpstormWebstormJetbrains Ide

Intellij Idea Problem Overview


How can I enable word wrapping in PhpStorm?

I need to enable it only for some of my files (with extension .txt). Is it possible?

Intellij Idea Solutions


Solution 1 - Intellij Idea

For all files (default setting for opened files): Settings/PreferencesEditorGeneralUse soft wraps in editor. You can now specify file names/extensions where this option will be enabled by default:

Enter image description here


For the currently opened file in the editor: menu → ViewActive EditorUse Soft Wraps (Note: I've assigned custom Ctrl + Alt + R + shortcut for that)

Enter image description here

For quite a while (since v2016 or so) you can also access this option via the context menu for the editor gutter area (the area with line numbers on the left side of the editor):

Enter image description here

(Note: I have customised this menu quite a bit; by default it has much less items here)


Search Everywhere (Shift 2x times) or menu HelpFind Action... (Ctrl + Shift + A on Windows using the Default keymap) can also be used to quickly change this option (instead of going into Settings/Preferences).

Enter image description here

Solution 2 - Intellij Idea

You have to enable Soft Wraps. Find that option through this path.

Menu ViewActive EditorUse Soft Wraps

Wrap words in PhpStorm

Solution 3 - Intellij Idea

Right click on the line number area and choose:

Soft-Wrap All Files or Soft-Wrap Current File, i.e.:

Enter image description here

Solution 4 - Intellij Idea

  • Menu FileSettingsEditorUse soft wraps in editor: to turn them on for all files by default.

Menu *File* → *Settings* → *Code Style* → *General* → *Wrap when typing reaches right margin*

.. but that's different (it will make new line).

Solution 5 - Intellij Idea

In addition to Settings -> Editor -> Use soft wraps in editor I recommend Use soft wraps in console and Use custom soft wraps indent with a setting of 4 to make the wraps indented to match the line they started on.

Solution 6 - Intellij Idea

In PhpStorm 2019.1.3, it is possible to enable soft wrap for some file types only.

enter image description here

Solution 7 - Intellij Idea

In PhpStorm 2019.1.3, you should add the file type you want to make soft wrapping on.

Go to SettingsEditorGeneralSoft-wrap files, and then add any types you want:

Enter image description here

Solution 8 - Intellij Idea

You may also want to consider the Wrap to Column plugin, which implements the equivalent to Alt + Q in Emacs and gq in Vim. This may be preferable to having very long lines that are wrapped by the editor.

This plugin can be installed from any IntelliJ IDEA-based IDE by searching for Wrap to Column.

It has the additional benefit that you can choose to wrap only sections of text that you want :-)

Solution 9 - Intellij Idea

If using PhpStorm 2019 and higher

PhpStorm word wrapping settings screenshot

Menu FileSettingsEditorGeneral.

There is the 'Soft-wrap files' input under the 'Soft Wraps' Header.

> *.md; *.txt; *.rst; .adoc;

Add the file types to this field in which files you want them to be used.

> *.md; *.txt; .rst; .adoc;.php;.js

Solution 10 - Intellij Idea

WebStorm 10.0.4

For wrapping text/code line by default, but for all types of file: menu FileSettingsEditorGeneral → section "Soft Wraps" → checkbox "Use soft wraps in editor".

Solution 11 - Intellij Idea

For word wrapping in PhpStorm 2019.1.3, just follow below steps:

From the top navigation menu:

ViewActive EditorSoft-Wrap

That's it so simple.

Solution 12 - Intellij Idea

I want to soft-wrap .php files. Putting that in the allowed list still was not working. (For a screenshot, see Mohammed Zayan's answer.)

I entered *.* there, allowing all the files (I am fine with that) and soft wrap worked fine.

Solution 13 - Intellij Idea

For word wrapping in PhpStorm:

  1. Select File from the menu
  2. From File select Setting
  3. From Setting, select Editor
  4. Select General from Editor
  5. In general, checked Use soft wraps in editor from the Soft wraps section

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHastView Question on Stackoverflow
Solution 1 - Intellij IdeaLazyOneView Answer on Stackoverflow
Solution 2 - Intellij IdeaJGallardoView Answer on Stackoverflow
Solution 3 - Intellij IdeaPedro LobitoView Answer on Stackoverflow
Solution 4 - Intellij IdeaHueston RidoView Answer on Stackoverflow
Solution 5 - Intellij IdeaSteve PutalaView Answer on Stackoverflow
Solution 6 - Intellij IdeaSithuView Answer on Stackoverflow
Solution 7 - Intellij IdeaMohammed ZayanView Answer on Stackoverflow
Solution 8 - Intellij IdeaAndrew MaoView Answer on Stackoverflow
Solution 9 - Intellij IdeaEmrah TuncelView Answer on Stackoverflow
Solution 10 - Intellij IdeaMikhail LosView Answer on Stackoverflow
Solution 11 - Intellij IdeaMuhammad A.View Answer on Stackoverflow
Solution 12 - Intellij IdeaSohel Ahmed MesaniyaView Answer on Stackoverflow
Solution 13 - Intellij IdeaMiraj KhandakerView Answer on Stackoverflow