Skip to content

Instantly share code, notes, and snippets.

@ngn999
Created November 1, 2012 16:03
Show Gist options
  • Save ngn999/3994582 to your computer and use it in GitHub Desktop.
Save ngn999/3994582 to your computer and use it in GitHub Desktop.
emacs的自动缩进

上次发现在注释里, 回车后, 行首不能自动添加 *了. 像这样:

/*
 * =====================================================================================
 *
 *       Filename:  word_segment.cpp
 *
 *    Description:
 *
 *        Version:  1.0
 *        Created:  2011-04-20 16:48:44
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  xxyyzz (search engine group), [email protected]
 *        Company:  www.example.com
 *
 * =====================================================================================
 */

当时忙, 也没有去纠结.

今天才发现, 原来很多文章在讲配置自动缩进时, 是这么说哒:

(define-key c-mode-base-map "\C-m" 'newline-and-indent)

在smth上看到XeCycle同学说 'c-context-line-break更好:

(define-key c-mode-base-map "\C-m" 'c-context-line-break)
(define-key c-mode-base-map [ret] 'c-context-line-break)

'c-context-line-break的文档后, 发现, 原来,这么配置后,我要的功能就回来了!

cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment