Edit

Share via


Manage word wrap in the editor

You can turn the Word wrap option on or off. When enabled, long lines that extend beyond the current width of the Code Editor window continue onto the next line. When disabled, you can scroll horizontally to view the rest of long lines. You can turn this option off to use line numbering.

To set word wrap preferences

  1. Open the Tools > Options pane, and expand the All Settings > Languages section.

  2. Expand the language section you're using (such as C# or Visual Basic) and then expand the General section.

  3. Select or clear the Word wrap checkbox.

    Screenshot that shows how to set the Word wrap option for a specific language.

    You can also configure word wrap for all supported programming languages. Expand the All Settings > Languages > Defaults > General section and select or clear the Word wrap option.

  1. On the Visual Studio menu bar, select Tools > Options.

  2. In the Options dialog, expand the Text Editor section.

  3. Expand the language section you're using (such as C# or Visual Basic) and then expand the General section.

  4. Select or clear the Word wrap checkbox, and then select OK.

    Screenshot of the word wrap option in Text Editor Settings.

    You can also configure word wrap for all supported programming languages. Expand the Text Editor > All Languages > General section and select the Word wrap option.

Note

When you select the Word wrap option, the Show visual glyphs for word wrap option is automatically enabled. You can clear the option, as needed. The option displays a return-arrow indicator where a long line wraps onto a second line. These reminder arrows aren't added to your code. They're for display purposes only.

To indent word wrap

Starting with Visual Studio 17.13, you can choose whether to indent wrapped lines in the editor.

To change word wrap indentation:

  1. In the Tools > Options pane, expand the All Settings > Text Editor > General > Display section.

  2. Select or clear the Automatically indent when word wrap is enabled checkbox.

  1. In the Tools > Options dialog, expand the Text Editor > General section.

  2. In the Display group, select or clear the Automatically indent when word wrap is enabled checkbox, and then select OK.

By default, word wrap indentation is enabled. If you prefer no indentation for wrapped lines, clear this option. Use this setting to help improve readability and maintain the desired formatting of your code.

Known issues

If you're familiar with word wrap in Notepad++, Sublime Text, or Visual Studio Code (VS Code), be aware of the following issues where Visual Studio behaves differently to other editors:

Features of the code editor