Emacs中编辑C文件,找到匹配的花括号,是按什么?

Vim、Emacs配置和使用
回复
头像
Junalbert
帖子: 20
注册时间: 2006-05-21 11:33
来自: 上海

Emacs中编辑C文件,找到匹配的花括号,是按什么?

#1

帖子 Junalbert »

除了双击鼠标(这个好像只能从前往后选),有没有按功能键的?
xcity
帖子: 135
注册时间: 2006-09-20 17:11

#2

帖子 xcity »

你加一段代码到.emacs里面之后,就可以用%来找到对应的()
;; Use % for {} matching
(global-set-key "%" 'match-paren)
(defun match-paren (arg)
"Go to the matching paren if on a paren; otherwise insert %."
(interactive "p")
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))
(t (self-insert-command (or arg 1)))))
lgfang
帖子: 16
注册时间: 2006-08-19 11:44
联系:

#3

帖子 lgfang »

`C-M-n'
Move forward over a parenthetical group (`forward-list').

`C-M-p'
Move backward over a parenthetical group (`backward-list').

`C-M-u'
Move up in parenthesis structure (`backward-up-list').

`C-M-d'
Move down in parenthesis structure (`down-list').
回复