我找不到这个:如何在EMACS中使用4个SPACES而不是TAB? [英] I can't find this: How do I use 4 SPACES instead of a TAB in EMACS?

查看:207
本文介绍了我找不到这个:如何在EMACS中使用4个SPACES而不是TAB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在跳转到EMACS,我找不到我需要做的,在我的 .emacs 文件中获取php模式和所有其他模式可插入4个空格而不是TAB。帮助?



更新:



当我打标签时,我仍然会在给定的普通文件中获得8个空格答案。在php模式下,我仍然有2个空格。在php模式下打标签不做任何事情,常规EMACS中的标签添加8个空格。



更新2:



我在我的 .emacs 中的内容:

 (需要'主题)
(color-theme-calm-forest)

(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq c-basic-offset 4)

仍然在常规文件中的8个空格和PHP文件标签不起作用,或随机跳转。我的php模式是从Ubuntu 9.10 apt-get install php-mode






UDATE3:



确定这是我想要的...


  1. 当我打TAB键,当我总是打TAB键,我想要插入4个空格。

  2. 我想让TAB键跳到前一个行(自动标签到最后一行,再次输入SPACES)

这些规则需要应用于所有文件但是如果需要,首先应用于(文本)和PHP文件。

解决方案

更改变量indent-标签页模式为零。您可以通过 M-x设置变量以交互方式(仅一个缓冲区)来执行。为了使其成为永久性(并且对于所有缓冲区),将

 (setq-default indent-tabs-mode nil)$ b $您的初始化文件中的 



在大多数模式下只需要4个空格,还可以添加

 (setq-default tab-width 4)

对于基于C的模式(如PHP),您必须执行以下操作:

 (setq c-basic-offset 4)


I am making the jump to EMACS, and I can't find what I need to do in my .emacs file to get php-mode AND all other modes to insert 4 spaces instead of a TAB. Help?

UPDATE:

When I hit tab I still get 8 spaces in a plain file with the given answers. In php-mode I still get 2 spaces. Hitting tab in php mode does nothing, tab in regular EMACS adds 8 spaces.

UPDATE2:

This is what I have in my .emacs:

(require 'color-theme)
(color-theme-calm-forest)

(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq c-basic-offset 4)

Still in regular files 8 spaces, and in PHP files the tabbing doesn't work, or jumps around randomly now. My php-mode is from the Ubuntu 9.10 apt-get install php-mode


UDATE3:

OK Here is what I want...

  1. When I hit the TAB Key, and when I always hit the TAB key, I want 4 SPACES inserted.
  2. I want the TAB key to jump to the relative position of the previous line (auto tab up to the last line, again entering in SPACES)

These rules need to apply to all files but if necessary need to first and foremost apply to (text) and PHP files.

解决方案

Change the variable indent-tabs-mode to nil. You can do it interactively (for just one buffer) by M-x set-variable. To make it permanent (and for all buffers), put

 (setq-default indent-tabs-mode nil)

in your init file.

To make a tab do just 4 spaces in most modes, also add

 (setq-default tab-width 4)

For C based modes (like PHP) you will have to do:

(setq c-basic-offset 4)

这篇关于我找不到这个:如何在EMACS中使用4个SPACES而不是TAB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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