1

I want to set the indentation of conditional comments to 2 space, like this:

<!--[if lt IE 9]>
  <script src="https://...) 

The default is 4, like this:

<!--[if lt IE 9]>
    <script src="https://...) 

NOTE:

I have tried without web-mode, just builtin HtmlMode and SgmlMode, and the behavior is the same: I can't modify conditional comments indentation.

1

It is currently not possible to do so. Please open an issue on github and describe very precisely the behavior you expect. Do not forget in your issue to link to a complete example on gist.

0

Here are examples of how to customize indentation settings for web-mode in your init file from the web-mode documentation:

HTML element offset indentation

(setq web-mode-markup-indent-offset 2)

CSS offset indentation

(setq web-mode-css-indent-offset 2)

Script/code offset indentation (for JavaScript, Java, PHP, Ruby, VBScript, Python, etc.)

(setq web-mode-code-indent-offset 2)

By default, tag attributes are indented like this:

<img src="pix.png"
     class="noborder"/>

You can force a fixed indentation with web-mode-attr-indent-offset

<img src="pix.png"
  class="noborder"/>

I think one of these should work for you. If none of these works for you, it might be related to this issue.

  • I have tried all that before. None works for me. Specially I tried the last one, but seem not to apply to conditional comments. I've tried set variable standard-indent to 2, as is mentioned in the web-mode docs but doesn't work. – Ignacio Jan 7 '16 at 16:05
  • @Ignativs See the issue on github that I linked to in my answer. Even though it is talking about javascript block comments, I think it is still relevant. – elethan Jan 7 '16 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.