如何在emacs的文本模式下更改缩进 [英] How to change indentation in text-mode for emacs

查看:180
本文介绍了如何在emacs的文本模式下更改缩进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的文本显示如下:

$ b $一行

第二行

光标位于'L':第二行之前,我点击 TAB ,它将缩进6个空格,而不是所需的2个空格。 p>

我尝试过的操作:


  1. 我已经尝试更新变量: tab-stop-list

     (setq tab-stop-list'(2 4 6 8 10 12 14 16))


  2. 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))))

Emacs缩进教程


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:

  1. I've tried updating the variable: tab-stop-list

    (setq tab-stop-list '(2 4 6 8 10 12 14 16))
    

  2. 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屋!

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