将emacs ruby-mode缩进更改为4个空格 [英] change emacs ruby-mode indent to 4 spaces
问题描述
我们公司使用4个空格缩进,而不是默认值2.我无法使此工作。
这是我的.emacs文件
(add-to-list'
(require'ruby-mode)
(setq indent-tabs-mode nil);总是用空格替换标签
(setq-default tab-width 4);将所有缓冲区的标签宽度设置为4
有没有人看到我做错了什么?
谢谢!
tab-width
仅控制制表符的宽度,即在缓冲区中显示时,Tab字符等于多少空格。它不影响用于缩进代码的空格(或制表符)数量。
对于Ruby代码,缩进由 ruby控制-intent-level
变量:
(setq ruby-indent-level 4)
From a previous post I got Ruby mode working in emacs. This is working great.
Setting up .emacs file for mac ruby development
Our company uses 4 spaces for indents though instead of the default 2. I am having difficulty getting this to work.
Here is my .emacs file
(add-to-list 'load-path "~/rdoc-mode.el")
(require 'ruby-mode)
(setq indent-tabs-mode nil) ; always replace tabs with spaces
(setq-default tab-width 4) ; set tab width to 4 for all buffers
Does anyone see what I am doing wrong?
Thanks!
The tab-width
setting only controls the width of a tab character, i.e. how many spaces a tab character is equivalent to when displayed in your buffer. It does not affect the number of spaces (or tabs) used for indenting your code.
For Ruby code, the indentation is controlled by the ruby-indent-level
variable:
(setq ruby-indent-level 4)
这篇关于将emacs ruby-mode缩进更改为4个空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!