在 Emacs 中设置制表符大小
我使用 Emacs 作为编辑器。我想将制表符大小设置为四个空格。在我的 .emacs 文件中,我有以下内容:
(setq default-tab-width 4)
我也尝试过:
(set-default tab-width 4)
无论哪种方式,当我打开 emacs 并尝试按 Tab 键时,它都会插入两个空格。我做错了什么吗?看起来好像没有看到我的 .emacs 文件。
任何建议都会很棒!谢谢!
I'm using Emacs as an editor. I want to set the tab size to four spaces. In my .emacs file I have the following:
(setq default-tab-width 4)
I've also tried:
(set-default tab-width 4)
Either way, when I open emacs and try to tab, it inserts two spaces. Am I doing something wrong? It almost seems like its not seeing my .emacs file.
Any suggestions would be great! Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
tab-width
变量无法确定每级的缩进量,并且 TAB 键不会插入制表符:它将当前行缩进到正确的缩进量大多数语言模式的水平。如果您使用 C、C++ 或 Java(以及其他一些基于
cc-mode
)进行编程,请尝试将c-basic-offset
设置为 4。或者点击Cc .
并选择另一种缩进样式;也许有一款适合您的口味。The
tab-width
variable doesn't determine the amount of indenting per level, and the TAB key doesn't insert a tab: it indents the current line to the correct indentation level in most language modes.If you're programming in C, C++ or Java (and a few more, based on
cc-mode
), try settingc-basic-offset
to 4. Or hitC-c .
and select another indentation style; there might be one that matches your taste.tab-width 变量控制制表位,而不是缩进偏移量,如果制表位不匹配,则根据需要用空格填充(假设您将 emacs 设置为插入物理制表符)。
如果你知道更多,请评论或编辑这篇文章。
The tab-width variable controls the tab stops, not the indentation offset which is padded with spaces as needed if the tab stop does not match (assuming you have emacs set to insert physical tabs).
If you know of any more, please comment or edit this post.