ChatGPT解决这个技术问题 Extra ChatGPT

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?

It's a shame that you can't specifically set it to soft wrap for certain file types. I only ever want to wrap if it's a HTML file, and it would be so much handier if I could set it to do that automatically instead of having to click through the menu each time.
@Maccath it appears you can do that now. See the "soft-wrap files" setting in PHPStorm.

P
Peter Mortensen

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

https://i.stack.imgur.com/kk723.png

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

https://i.stack.imgur.com/OfbHP.png

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):

https://i.stack.imgur.com/UViKn.png

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

Search Everywhere (Shift 2x times) or menu Help → Find 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).

https://i.stack.imgur.com/oDkSW.png


right click on the left gutter (line numbers area) and choose Soft Wraps. a ver quick way to enable soft wraps per file
File > Settings > Editor > Use Soft wraps in Editor.
File > Settings > Editor > General > "Use soft wraps in editor"
@Ryan that option does not seem to exist anymore. Under General the option is not there.
phpStorm for Mac v10.0: PhpStorm > Preferences > Editor > Use Soft wraps in Editor (as opposed to under the File menu)
P
Peter Mortensen

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

Menu View → Active Editor → Use Soft Wraps

https://i.stack.imgur.com/waEox.jpg


P
Peter Mortensen

Right click on the line number area and choose:

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

https://i.stack.imgur.com/4sITy.jpg


P
Peter Mortensen

Menu File → Settings → Editor → Use 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).


this helped me out. It was driving me mad with the editor auto wrapping my code when I didnt want it to. I couldnt find the option but this helped so ty ^^.
This must be really old, i could not find it
S
Steve Putala

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.


S
Sithu

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

https://i.stack.imgur.com/pk3sd.jpg


P
Peter Mortensen

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

Go to Settings → Editor → General → Soft-wrap files, and then add any types you want:

https://i.stack.imgur.com/P3a8C.png


you can actually use *.* for all type of file and extension.
P
Peter Mortensen

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 :-)


P
Peter Mortensen

If using PhpStorm 2019 and higher

https://imgyukle.com/i/screenshot-1.ECpKnj

Menu File → Settings → Editor → General.

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


P
Peter Mortensen

WebStorm 10.0.4

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


But the question is about PhpStorm. Please explain.
P
Peter Mortensen

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

From the top navigation menu:

View → Active Editor → Soft-Wrap

That's it so simple.


It is not, you have to do it per file.
P
Peter Mortensen

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.


P
Peter Mortensen

For word wrapping in PhpStorm:

Select File from the menu From File select Setting From Setting, select Editor Select General from Editor In general, checked Use soft wraps in editor from the Soft wraps section


Please add some explanation to your answer - is this triggered for all files with the same extension?