Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VScode: word wrap for markdown not working

I try to have an automatic word wrap when I write markdown text: I expect that lines are automatically broken when I type a line longer than the wrap line length set, by a hard break (i.e. a newline character).

I have set

  • word wrap to wordWrapColumn
  • word wrap column to 50
  • wrappingIndent to same
  • wrapping Strategy to simple
  • wrap attributes to auto and nothing set to markdown.

Nevertheless, lines extend to the end of the editor (much more than 50) and nothing happens. I have tried the toggle word wrap with no effect (it would be great if the state of the toggle would be shown, like for auto save).

What is wrong?

like image 680
user855443 Avatar asked Jun 01 '20 07:06

user855443


Video Answer


1 Answers

VSCode automatically sets some Markdown-specific settings behind the scenes that override general user settings, which is why the "editor.wordWrap" setting is seemingly ignored.

To get around this, you can add the setting as language-specific for markdown files.

i.e. try adding the following to your settings.json file and it should work!

"[markdown]": {
    "editor.wordWrap": "bounded",
    "editor.wordWrapColumn": 80
}

NOTE: There is an open feature-request to make it more obvious when language settings override user defaults. At least they are aware of the issue!

like image 78
Stephen Avatar answered Jan 04 '23 05:01

Stephen