Emacs中编辑C文件,找到匹配的花括号,是按什么?
- Junalbert
- 帖子: 20
- 注册时间: 2006-05-21 11:33
- 来自: 上海
Emacs中编辑C文件,找到匹配的花括号,是按什么?
除了双击鼠标(这个好像只能从前往后选),有没有按功能键的?
-
- 帖子: 135
- 注册时间: 2006-09-20 17:11
你加一段代码到.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)))))
;; 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)))))
-
- 帖子: 16
- 注册时间: 2006-08-19 11:44
- 联系: