‘Word Wrap’ is a feature that allows you to limit text content to a certain width on the row in the editor window.
If you have a long line of text on a single line, for example, the user will have to scroll horizontally to see the content. With word wrap, the text is spread into multiple lines, and the content is limited to fit within the code window.
Any editor provides this as a basic feature. Out of the box, VSCode supports word wrap.
This is an important tip that the developer must know when working with Atom Editor.
How to limit column limit with word wrap in Visual Studio Code editor automatically
There are multiple ways, we can do this by configuring settings
First, Use settings
- In the left bar, click on the manage icon >
Settings
- Select
Text Editor
and the right side contains the below optionsEditor: Word Wrap
- It enables how lines should wrap in a rowEditor: Word Wrap Column
: 60 - Limit the column character length when word-wrap is enabled.Editor: Wrapping Indent
: It controls the indentation of wrapping lines
The second way, use the Word Wrap
option in the File Menu.
The following are steps to enable the Word Wrap.
View
>Word Wrap
or use short cutAlt
+Z
- This wraps the lines with a default limit of 80 characters.
- These changes are saved and applied to the editor permanently.
Third ways, project-specific settings
- Create a
.vscode
folder under a project - Create a file settings.json
- update the
setttings.json
file with the below configuration
{
"editor.wordWrap": "wordWrapColumn",
"editor.wrappingIndent": "same",
"editor.wordWrapColumn": 80
}
Here column length is provided as 80 character length that wraps into a new line.
- save these settings and Restart VSCode to make changes.