缩放和标签在emacs [英] Indentation and tabs in emacs
问题描述
然而,我对于Emacs来说相当新鲜,我发现整个制表符与空格定制有点混淆。
这是我朋友的 Visual Studio代码
的设置文件看起来像
//将您的设置放在此文件中以覆盖默认设置
{
editor.tabSize:4,
editor.insertSpaces:false,
files.trimTrailingWhitespace:true
}
如何复制相同Emacs的设置?
这是我迄今作为我的〜/ .emacs / init.el
文件的一部分,但仍然无法按预期方式工作。 p>
;; Tab和空格
(setq-default indent-tabs-mode nil)
(setq default-标签宽度4)
任何帮助来解决这个和/或正确的链接以了解更多将不胜感激
你的conf(也许粘贴pb)有一个错误
;; Tab和空格
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4);;不是(setq default-tab-width 4)
此配置很好,但有时候另一个配置模式或次模式配置)可以覆盖您的默认值。
例如
- python使用
python-indent-offset
或python-indent
(自24.3以来已经过时)。 - C ++使用
c-indent级别
- nxml使用
nxml-child-indent
和nxml-attribute-indent
。 - ...
所以解决方案取决于语言。你需要一个正确的语言配置。
我希望这有助于
In our company, we have people who use Windows,OS-X and Ubuntu for writing code (mainly javascript) and I use mainly Emacs as my text editor.
However, I am quite new to Emacs, and I find the whole tab vs spaces customisation a bit confusing.
This is what the settings files for my friend's Visual Studio Code
looks like
// Place your settings in this file to overwrite the default settings
{
"editor.tabSize": 4,
"editor.insertSpaces": false,
"files.trimTrailingWhitespace": true
}
How do I replicate the same settings on Emacs?
This is what I have so far as part of my ~/.emacs/init.el
file, but it still doesn't work as expected.
;;Tab and spaces
(setq-default indent-tabs-mode nil)
(setq default-tab-width 4)
Any help to solve this and/or proper links to learn more will be appreciated..
There is an error in your conf (maybe paste pb)
;;Tab and spaces
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4) ;; not (setq default-tab-width 4)
This configuration is good but sometime another configuration (major-mode or minor-mode configuration) could overwrite your defaults.
For example
- python use
python-indent-offset
orpython-indent
(obsolete since 24.3). - C++ use
c-indent-level
- nxml use
nxml-child-indent
andnxml-attribute-indent
. - ...
So the solution depends on the languages. You need a proper configuration by language.
I hope this helps
这篇关于缩放和标签在emacs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!