在emacs下写c++代码自动动齐怎么做?

Vim、Emacs配置和使用
回复
koalaundead
帖子: 3
注册时间: 2009-10-12 15:49

在emacs下写c++代码自动动齐怎么做?

#1

帖子 koalaundead » 2009-10-12 15:59

有时候在网上拷的代码,格式乱了,我想选中后让它自动对齐,怎么做呢?
就象visual c++中的alt+F8或是eclipse下的ctrl+shift+F那么功能
yznan
帖子: 22
注册时间: 2007-11-03 16:18
联系:

Re: 在emacs下写c++代码自动动齐怎么做?

#2

帖子 yznan » 2009-10-15 2:44

C-shift-space, 设置mark
C-M-\ 格式化
kane_yj
帖子: 9
注册时间: 2007-05-19 21:22

Re: 在emacs下写c++代码自动动齐怎么做?

#3

帖子 kane_yj » 2009-10-16 15:11

代码: 全选

;;格式为规定代码缩进
(defun iwb ()
 "indent whole buffer"
 (interactive)
 (delete-trailing-whitespace)
 (indent-region (point-min) (point-max) nil))

代码: 全选

(global-set-key [f8]   'iwb)                                 ;; 格式为规定代码缩进
kane_yj
帖子: 9
注册时间: 2007-05-19 21:22

Re: 在emacs下写c++代码自动动齐怎么做?

#4

帖子 kane_yj » 2009-10-16 15:13

忘记签名了, :em04
kane_yj
帖子: 9
注册时间: 2007-05-19 21:22

Re: 在emacs下写c++代码自动动齐怎么做?

#5

帖子 kane_yj » 2009-10-16 15:17

为什么还没有 :em02

易飞扬的博客 http://www.yifeiyang.net 开博了!
回复