How can I switch word wrap on and off in Visual Studio Code?

Jeroen picture Jeroen · Jun 24, 2015 · Viewed 329.8k times · Source

When using code files, you typically don't need longer lines to wrap around. However, with .md files this is in fact rather useful. However, I can't seem to find the option to enable word wrap so longer lines will be wrapped.

To reproduce, open Visual Studio Code resized to a small-enough window, and enter the following text in a new document:

This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum.
A linebreak before this. 

The effect is this:

Example of missing word wrap

I'm trying to get the horizontal scrollbar to stay away, having line 1 wrap around at the right side of the window.

I've done a few things to answer my own question:

  • Search Stack Overflow: zero results at the time of writing this;
  • Meticulously going through the menu of Visual Studio Code: didn't find it;
  • Using the Command Palette with "wrap": gives no matching commands.

Perhaps it's not possible, and I'd need to file a feature request? Or am I missing something?

Note that I'd like to be able to turn it on and off quickly. For one, @PanagiotisKanavos mentioned in comments this solution to change wrapping behavior in the settings, but I'm looking for a quick command or menu option to do this (much like Notepad++ and Sublime Text 2 have).

Answer

Benjamin Pasero picture Benjamin Pasero · Jun 24, 2015

Since v1.0 you can toggle word wrap:

  • with the new command editor.action.toggleWordWrap, or
  • from the View menu (*View** → Toggle Word Wrap), or
  • using the ALT+Z keyboard shortcut (for Mac: +Z).

It can also be controlled with the following settings:

  • editor.wordWrap
  • editor.wordWrapColumn
  • editor.wrappingIndent

Known issues:

  1. renderLineHighlight should highlight the entire logical line

If you'd like these bugs fixed, please vote for them.