在Emacs中设置选项卡大小 [英] Setting tab size in Emacs

查看:197
本文介绍了在Emacs中设置选项卡大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Emacs作为编辑器。我想将标签大小设置为四个空格。在 .emacs 文件中,我有以下内容:

 (setq default-tab-width 4) 

我也试过:

 (set-default tab-width 4)

无论哪种方式,当我打开emacs并尝试选项卡时,它插入两个空格。我做错了吗?几乎看起来它没有看到我的 .emacs 文件。



任何建议都会很棒!谢谢!

解决方案

tab-width 变量不会确定每级别的缩进量,而 TAB 键不会插入选项卡:它将大多数语言模式中的当前行缩进到正确的缩进级别。



如果您使用C,C ++或Java编程(还有一些,基于 cc-mode ),请尝试设置 c-basic-offset 至4.或者点击 Cc。并选择另一个缩进样式;可能有一个符合你的口味。


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!

解决方案

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 setting c-basic-offset to 4. Or hit C-c . and select another indentation style; there might be one that matches your taste.

这篇关于在Emacs中设置选项卡大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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