10

I'm doing some documentation in Markdown using Visual Studio Code. The problem is that I'm used to hard wrapping.

The only way I've found for setting hard wrapping in Visual Studio Code is by the EditorConfig extension. EditorConfig is not a Microsoft extension and sometimes you can see weird things happening such as wrapping some inline code (between backticks: ``) for instance.

Is there some built-in way of setting hard wrapping in Visual Studio Code? If not, how do people set soft wrapping in Visual Studio Code in order to make Markdown look great (for instance, keep the indentation after a wrap in a bulleted list long paragraph)? Is it scheduled for a future release built-in hard-wrapping in Visual Studio Code?

Thanks

Update: In hard-wrapped text each new line is actually a line, has a different number. Soft wrapping is wrapping only for display: you change the viewport and lines changes, but each paragraph is just a line, a number ---as in VS Code.

Update2: You can hard wrap with the VSCodeVim extension now the same way you wrap in Vim: g, q, } or any other combination with g, q.

sudo bangbang
  • 19,198
  • 7
  • 64
  • 71
ctafur
  • 105
  • 1
  • 5
  • It would help if you were to provide a precise definition of "hard wrapping". – Bill_Stewart Oct 17 '16 at 17:05
  • When the line is wrapped, a carriage-return/linefeed character(s) is inserted into the text. – Matt Nov 02 '16 at 01:30
  • This doesn't seem to be part of EditorConfig anymore, found another solution? – nietras Dec 01 '16 at 09:05
  • My mistake, the extension I used for hard wrapping was Rewrap, but I think you can't have the same control as in Vim or Emacs. Maybe you can make it by settings.json. – ctafur Dec 01 '16 at 11:49
  • 1
    This is really a critical question imho! Doing this in vim is quick and painless. I spent the night yesterday finding out if there is a possibility ! No there isn't. I need such functionality for latex (with git). It seems its just not possible with VSCODE ! That doesn't seem right. – umayfindurself May 27 '17 at 11:21
  • Possible duplicate of [Automatically hard wrap lines at column in VSCode](https://stackoverflow.com/questions/43122175/automatically-hard-wrap-lines-at-column-in-vscode) – banan3'14 May 16 '18 at 13:24
  • I have found that you can do it with a formatter or a linter also. – ctafur Dec 24 '18 at 19:18

2 Answers2

3

I currently use the ReWrap extension for creating hard text wraps.

I'm happy with the defaults. However, the plugin does offer settings you can configure to your liking.

Khalid Hussain
  • 295
  • 2
  • 16
1

To quickly toggle word wrapping, you can use Alt+Z.

You can find the following setting, after going to Preferences: User Preferences:

"editor.wordWrap": "wordWrapColumn",
"editor.wordWrapColumn": 100

It will put EOL in the 100th column of every line.

If you want to use it only for markdown, you can use

"[markdown]": {
    "editor.wordWrap": "wordWrapColumn",
    "editor.wordWrapColumn": 100
}
banan3'14
  • 2,096
  • 1
  • 14
  • 35