I have the following in my .emacs
file. But it doesn't change the tab width in .json
files.
(setq-default indent-tabs-mode nil) (setq-default tab-width 2) (setq standard-indent 2)
I'm using emacs 24.3 on OS X 10.8.4
Type “Indentation” into the search field then head to the “Editor: Tab Size” section. Replace the default space number with your preferred one: Your setting will be applied and reflected immediately.
VS Code lets you control text indentation and whether you'd like to use spaces or tab stops. By default, VS Code inserts spaces and uses 4 spaces per Tab key. If you'd like to use another default, you can modify the editor.insertSpaces and editor.tabSize settings.
(add-hook 'json-mode-hook (lambda () (make-local-variable 'js-indent-level) (setq js-indent-level 2)))
Make the variable buffer local so that it does not conflict with js-mode
for JavaScript files.
I used M-x customize
as mentioned here: How to change the indentation width in emacs javascript mode
It inserted '(js-indent-level 2))
into my .emacs file.
But thanks for the response anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With