Raymond Camden
Raymond Camden

Reputation: 10857

How to disable autoindent on enter

I see multiple settings for Code in terms of how to indent (spaces vs tabs), but nothing about how to disable indents. So for example, I enter a <p> tag, hit enter, and Code auto indents the next line. I'd like to disable that but cannot find the setting to do so.

Upvotes: 11

Views: 4224

Answers (2)

Dave Ankin
Dave Ankin

Reputation: 1291

You can now set the configuration property editor.autoIndent in your settings.json file (which for me was in C:\Users\$USER\AppData\Roaming\Code\User\settings.json). the value you want to set it to is the string "none".

see this thread for more details https://github.com/microsoft/vscode/issues/5446#issuecomment-559145939

Upvotes: 0

Jurijs Kovzels
Jurijs Kovzels

Reputation: 6220

No, there is no option to disable auto indent on enter. But if you need to insure that inline elements remain without extra spaces because it affects the layout you can use the new option, introduced in v1.0: html.format.unformatted - comma separated list of tags that shouldn't be reformatted. Default value null means that all inline elements should remain as you formatted them.

In addition, instead of typing <p> + Enter you can type just p and press tab which will give you a nice <p><\p> and will place the cursor in the middle.

Hope this helps.

Upvotes: 1

Related Questions