How do I get js2-mode to use spaces instead of tabs in Emacs?

后端 未结 3 644
一向
一向 2021-02-07 01:53

I am using js2-mode to edit Javascript in Emacs, but I can\'t seem to get it to stop using tabs instead of spaces for indentation. My other modes work fine, just having issues w

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-07 02:33

    On my copy of GNU Emacs 24.2.1, setting:

    (setq-default indent-tabs-mode nil)
    

    in .emacs is not sufficient for javascript mode, presumably because the setting is somehow being over-ridden in a per-buffer context. The following change is sufficient:

    (custom-set-variables
     ;; custom-set-variables was added by Custom.
     ;; If you edit it by hand, you could mess it up, so be careful.
     ;; Your init file should contain only one such instance.
     ;; If there is more than one, they won't work right.
     '(indent-tabs-mode nil))
    

提交回复
热议问题