Skip to content

Auto wrap

Steve Baker edited this page Jan 14, 2018 · 3 revisions

Auto-wrap works like the auto-fill mode in Emacs. When pressing <space> or <enter> after the cursor is past the wrapping column, that line is wrapped onto the next.

Auto-wrap


Like in Emacs function, auto-wrap does not attempt to re-flow the entire paragraph; it only adds a break in the current line. It's handy when typing new text, but won't automatically fix a paragraph after inserting/removing text. For this you can always do a standard alt+q after making edits.

To suggest any improvements to this feature, please create an issue!

Activating

Auto-wrap is turned off by default. Turning it on is global: it affects all documents edited. In code files, only comments will be affected, so it's pretty safe to leave it on.

VSCode

The Command Rewrap: Toggle Auto-Wrap in the command palette (F1) toggles it on/off.

Auto-wrap


A message shows in the status bar for a few seconds indicating the status.

Auto-wrap


There's no default keybinding for this command, but you can add one by binding to the command ID rewrap.toggleAutoWrap.

{
    "key": "shift+alt+q",
    "command": "rewrap.toggleAutoWrap"
}

Visual Studio

On the Edit menu, under the Rewrap Lines command, is the Toggle Auto-Wrap item.

Auto-wrap


The check-mark shows the status and a brief statusbar message is shown when turning on/off.

Auto-wrap


To add a keybinding, go to Tools -> Options, then Environment -> Keyboard. In this dialog pane search for the command Edit.ToggleAutoWrap and you can assign a shortcut key to it.

You can’t perform that action at this time.