Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable word-wrap in VS Code for a specific file?

I am using windows and VS Code, I have few files that I do not need to wrap them wherever I press Alt+Shift+F, is there a way to disable auto format wrapping for specific files?

like image 860
Ehsan Zargar Ershadi Avatar asked Jun 02 '19 14:06

Ehsan Zargar Ershadi


People also ask

How to enable word wrap in Visual Studio Code?

Visual Studio Code: Enable Word Wrap For All Files 1 Go to File > Preferences > Setting (Windows) or Code > Preferences > Settings (macOS). 2 Type word wrap in the search field and you will see the search results immediately. 3 Select on from the drop-down. More ...

How to disable word wrapping in HTML?

In this snippet, we’re going to demonstrate how you can disable word wrapping in HTML. Actually, this can be done with a few steps using some CSS properties. To prevent the text from wrapping, you can use the CSS white-space property with the “nowrap” or “pre” value. In this snippet, you can see examples with both of them.

How to manage word wrap in the editor?

How to: Manage word wrap in the editor. You can set and clear the Word wrap option. When this option is set, the portion of a long line that extends beyond the current width of the Code Editor window is displayed on the next line.

How to word wrap Markdown in VSCode?

which means, out of the box, word wrapping is enabled for markdown. When opening a file that is dominated by long lines, VSCode will also word wrap. e.g. try opening jquery-3.2.1.min. In such cases we show a button at the top of the editor: Now, all of that is the default, out-of-the-box behaviour.


2 Answers

Explained here Language-specific editor settings but specifically:

  1. CTRL+SHIFT+P and type "Preferences: Configure Language Specific Settings"
  2. Select the language or add section in the file (start typing [ to see list of suggestions) or edit if already there.
  3. If wrapping, depending on columns available in your editor you might want to update editor.wordWrapColumn. Lines will wrap at the minimum of viewport and editor.wordWrapColumn

Example:

   ...
    "editor.wordWrapColumn": 200,
    "[typescript]": {
        "editor.tabSize": 2,
        "editor.wordWrap": "off",
    },
    "[plaintext]": {
        "editor.wordWrap": "bounded",
    },
   ...
like image 96
Riga Avatar answered Sep 20 '22 19:09

Riga


Looks like VSCode allows for this. You can tweak it as you prefer for each file type.

However note that there have been reports of it not working for markdown files. I guess it is something still being tweaked.

like image 36
Luke Avatar answered Sep 21 '22 19:09

Luke