如何在emacs的文本模式下更改缩进 [英] How to change indentation in text-mode for emacs
本文介绍了如何在emacs的文本模式下更改缩进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的文本显示如下:
$ b $一行第二行
光标位于'L':第二行之前,我点击 TAB ,它将缩进6个空格,而不是所需的2个空格。 p>
我尝试过的操作:
-
我已经尝试更新变量:
tab-stop-list
(setq tab-stop-list'(2 4 6 8 10 12 14 16))
- p>我尝试添加一个
文本模式钩子
(add-hook'text-mode-hook
'(lambda()
(setq tab-width 2)))
解决方案
将此添加到您的.emacs:
(add-hook'text-mode-hook
'(lambda()
(setq indent-tabs-mode nil)
(setq tab-width 2)
(setq indent-line-function(quote insert-tab))))
I'm in text mode and want my tab key to indent a line to two spaces.
The file looks like this:
Line one
Line two
The cursor is situated before the 'L' : "Line two", and I hit TAB and it gets indented 6 spaces as opposed to the desired 2 spaces.
Actions I've tried:
I've tried updating the variable:
tab-stop-list
(setq tab-stop-list '(2 4 6 8 10 12 14 16))
I've tried adding a
text-mode-hook
(add-hook 'text-mode-hook '(lambda () (setq tab-width 2)))
解决方案
Add this to your .emacs :
(add-hook 'text-mode-hook
'(lambda ()
(setq indent-tabs-mode nil)
(setq tab-width 2)
(setq indent-line-function (quote insert-tab))))
See Emacs Indentation Tutorial.
这篇关于如何在emacs的文本模式下更改缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文