(defun my-c-mode-common-hook()
(c-set-style "K&R")
(setq tab-width 4 indent-tabs-mode nil)
(c-toggle-auto-hungry-state 1)
(setq indent-tabs-mode t)
(setq c-basic-offset 8) //将这里的8改为4即可
(define-key c-mode-base-map [(control \`)] 'hs-toggle-hiding)
(define-key c-mode-base-map [(return)] 'newline-and-indent)
(define-key c-mode-base-map [(f7)] 'compile)
(define-key c-mode-base-map [(meta \`)] 'c-indent-command)
;; (define-key c-mode-base-map [(tab)] 'hippie-expand)
(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
(setq c-macro-shrink-window-flag t)
(setq c-macro-preprocessor "cpp")
(setq c-macro-cppflags " ")
(setq c-macro-prompt-flag t)
(setq hs-minor-mode t)
(setq abbrev-mode t)
)
emacs代码设置4格缩进
最新推荐文章于 2024-12-17 22:43:16 发布
本文详细介绍了一段Emacs配置代码的功能与用途,包括如何设置C语言编程风格、制表符宽度、自动缩进行为、快捷键绑定以及其它增强功能。通过这些配置,可以显著提高C语言开发效率。
3万+

被折叠的 条评论
为什么被折叠?



