将邪恶的移位宽度设置为 emacs 中的缓冲区本地缩进
我使用邪恶,它让
(defcustom evil-shift-width 4
"The offset used by \\<evil-normal-state-map>\\[evil-shift-right] \
and \\[evil-shift-left]."
:type 'integer
:group 'evil)
我想将邪恶移位宽度设置为缓冲区本地缩进宽度(变量indent
)。
(add-hook 'after-change-major-mode-hook
(function (lambda ()
(setq evil-shift-width indent))))
我错过了什么?
I use evil, which got
(defcustom evil-shift-width 4
"The offset used by \\<evil-normal-state-map>\\[evil-shift-right] \
and \\[evil-shift-left]."
:type 'integer
:group 'evil)
I'd like to set evil-shift-width to the buffer-local indent width (the variable indent
).
(add-hook 'after-change-major-mode-hook
(function (lambda ()
(setq evil-shift-width indent))))
What did I miss?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有更多信息,我相信我理解问题是希望将
evil-shift-width
在python-mode
中设置为 4,在中设置为 2 ruby-mode
(举两个例子),但它始终设置为 2。这种情况下的问题来自于
indent
在 Emacs 中没有全局定义,当然也没有定义在Python模式下。在python-mode
中有一个变量python-indent
,它被设置为4,这就是要使用的变量。虽然必须为每种主要模式使用自定义变量很烦人,但这就是每种模式实际使用的变量,并且这可能是实际有效的解决方案:
为您想要支持的每种主要模式添加一个新变量。
Without more information, I believe I understand the problem to be that desire is for
evil-shift-width
to be set to 4 inpython-mode
and 2 inruby-mode
(for two examples), yet it is always set to 2.The problem in this case comes from the fact that
indent
isn't defined globally in Emacs, and certainly not inpython-mode
. Inpython-mode
there is a variablepython-indent
, which is set to 4, and that is the variable to use.While annoying to have to use custom variables for each of the major modes, that's what each of the modes actually use, and that's probably the solution that will actually work:
Adding a new one for each major-mode you want supported.