如何在js2-mode中将缩进设置为2个空格? [英] How do I set indent to 2 spaces in js2-mode?

查看:75
本文介绍了如何在js2-mode中将缩进设置为2个空格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.emacs结尾处有这个:

I have this at the end of my .emacs:

(setq-default indent-tabs-mode nil)

(setq tab-stop-list (number-sequence 2 120 2))

它在其他模式下也可以正常工作-每当我按Tab时,它将添加两个空格.但是在js2模式下,它增加了4.

It works fine in other modes – whenever I tab, it adds two spaces. But in js2-mode, it adds 4.

推荐答案

您可以将 js2-basic-offset 设置为2.

  1. M-x自定义变量
  2. 输入 js2-basic-offset
  3. 将值设置为2

然后在自定义选项缓冲区中应用并保存按钮.这将添加一个项目,将变量设置为 .emacs init.el 文件.

Then Apply and Save button in the customize option buffer. This will add an item to set the variable into .emacs or init.el file.

这篇关于如何在js2-mode中将缩进设置为2个空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆