I'd like tab-width
to be set to 2 in all programming modes. I use prelude
(which might be one of the problems), but I have this in my custom.el
(which is sort of the analogue to .emacs
):
(setq my-tab-width 2)
(setq standard-indent my-tab-width)
(setq tab-width my-tab-width)
(setq c-basic-offset my-tab-width)
(setq js2-basic-offset my-tab-width)
(setq web-mode-attr-indent-offset my-tab-width)
(setq web-mode-code-indent-offset my-tab-width)
(setq web-mode-css-indent-offset my-tab-width)
How can I avoid all the duplication?
tab-width
everywhere, usesetq-default
. If you want to set the value oftab-width
in all modes that inherit fromprog-mode
then do what @dan suggested. – Drew Jan 12 '16 at 2:09'(
but(setq
instead. I'll change that. – Avery Jan 12 '16 at 6:10