0

I don't want to use tabs for indent, so I add (setq-default indent-tabs-mode nil) in my emacs init file.

With the setting indents are created by spaces in web-mode, but it doesn't change already existing tabs to spaces.

Is there a config like overwrite-tab-indent-by-space-indent? Or must I replace tabs to spaces by command every time I encounter tab-indented HTML?

  • I'm not sure I understand your question--is running M-x untabify after selecting the whole buffer acceptable, or are you seeking an automated solution? – dhag Mar 16 '15 at 6:44
0

To untabify the whole buffer upon opening a file that uses web-mode, you could add something like this to your init file:

(add-hook 'web-mode-hook
  (lambda () (untabify (point-min) (point-max))))

This assumes that web-mode is the name of the mode you want this setting to apply to; adjust to taste.

  • I didn't know the untabify, thanks! – ironsand Mar 16 '15 at 11:37

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.