Enable Soft Wrap in Zed | Generated by AI
Zed, like many modern text editors, uses the concept of “soft wrap” to wrap lines. This means that lines will appear wrapped in the editor, but no actual newline characters are inserted into your file.
Here’s how to enable line wrapping in Zed:
-
Open Zed’s Settings:
- Press
Command + Shift + P
(macOS) orCtrl + Shift + P
(Windows/Linux) to open the Command Palette. - Type “local” and select “zed: Open Local Settings”. This will open your
settings.json
file.
- Press
-
Add the
soft_wrap
setting:-
In your
settings.json
file, add or modify the"soft_wrap"
setting. You have a few options:"editor_width"
: This is the most common and generally recommended option. It will wrap lines to fit the current width of your editor window.{ "soft_wrap": "editor_width" }
"preferred_line_length"
: This will wrap lines based on a specifiedpreferred_line_length
(e.g., 80 characters). You’ll also need to definepreferred_line_length
.{ "soft_wrap": "preferred_line_length", "preferred_line_length": 80 }
"bounded"
: This option provides a more advanced wrapping behavior, thougheditor_width
orpreferred_line_length
are usually sufficient for most users."none"
: This disables line wrapping.
-
-
Save the file:
- Press
Command + S
(macOS) orCtrl + S
(Windows/Linux) to save thesettings.json
file.
- Press
Zed should now wrap lines according to your chosen setting.
Important Notes:
- Project-level settings: You can also enable word wrap at the project level by creating a
.zed
folder in your project directory and placing asettings.json
file inside it with the desiredsoft_wrap
configuration. This will override your global settings for that specific project. - Language-specific settings: You can even configure
soft_wrap
for specific languages. For example, to set soft wrap for Markdown files:{ "languages": { "Markdown": { "soft_wrap": "editor_width" } } }
- “Rewrap” command: If you’re looking for a command to “hard wrap” text (insert actual newlines) rather than just visually wrapping, Zed also has a “Rewrap” command (often bound to
Alt-Q
orAlt-W
). This is useful for formatting comments or long lines of prose.