论坛: UNIX系统 标题: 如何在emacs的c语言文件编辑模式下面设置Tab 复制本贴地址    
作者: kert_t8 [kert_t8]    论坛用户   登录
问题是现在我一按Tab是八个空格(space),怎么样才能是一个'\t'?
我在网上找到一段 .emacs的配置:
代码:

(require 'cc-mode)
(defun my-build-tab-stop-list (width)
  (let ((num-tab-stops (/ 80 width))
(counter 1)
(ls nil))
    (while (<= counter num-tab-stops)
      (setq ls (cons (* width counter) ls))
      (setq counter (1+ counter)))
    (set (make-local-variable 'tab-stop-list) (nreverse ls))))
(defun my-c-mode-common-hook ()
  (setq tab-width 8) ;; change this to taste, this is what K&R uses :)
  (my-build-tab-stop-list tab-width)
  (setq c-basic-offset tab-width)
  (setq indent-tabs-mode nil)) ;; force only spaces for indentation
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)


但是不管用

请教,谢谢

地主 发表时间: 05-02-11 12:39

回复: kert_t8 [kert_t8]   论坛用户   登录
以前pico用惯了,现在想换个高级的,结果玩不转

B1层 发表时间: 05-02-11 12:41

回复: NetDemon [netdemon]   ADMIN   登录
emacs 没用过

用vim好了,比较标准

B2层 发表时间: 05-02-11 21:01

回复: SysHu0teR [syshunter]   版主   登录
vim确实棒,支持C语法自动缩进,set cindent,省得按TAB。而且打开一个凌乱不堪的c文件,按下gg=G,你会有一个惊喜。

B3层 发表时间: 05-02-12 10:21

回复: kert_t8 [kert_t8]   论坛用户   登录
算了,都用了一段时间了,感觉也庭好的

用vi的都是 

B4层 发表时间: 05-02-12 16:15

回复: TecZm [teczm]   版主   登录


B5层 发表时间: 05-02-12 17:19

论坛: UNIX系统

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号