是否有内置或第三方elisp命令在cc模式下移动到匹配的括号?
我目前使用(paren-set-mode 'paren t)
让XEmacs突出显示匹配的大括号或者paren,但是当大括号在一段代码中使用嵌套的if
块时,屏幕不在屏幕上,那么拥有它是非常有用的跳转到匹配括号的命令。
类似于M-C-f
和M-C-b
的内容,但适用于{}
而不是()
。
答案 0 :(得分:3)
C-M-f
和C-M-b
也适用于{
和}
。
答案 1 :(得分:2)
我在XEmacs 21.5中安装了big-menubar.el。 它添加了一个菜单项“Motion”,在该菜单中有以下两个命令,其中显示了键绑定:
平衡括号C-M-n结束
平衡括号C-M-p的开始
我认为它们是Control-Meta-next和previous。
他们还有一些其他可能感兴趣的移动命令, 这是来自big-menubar.el的剪切和粘贴,显示了他们正在执行的命令(一旦你知道命令是什么,就可以分配给你喜欢的任何键......):
(add-submenu
nil
'("Motion"
["Goto Mark" exchange-point-and-mark (mark t)]
["Goto Line..." goto-line t]
"---"
["End of Balanced Parentheses ( )" forward-list t]
["Beginning of Balanced Parentheses ( )" backward-list t]
["Next Opening Parenthesis (" down-list t]
["Previous Opening Parenthesis (" backward-up-list t]
["Next Closing Parenthesis )" up-list t]
"---"
["End of Balanced Expression" forward-sexp t]
["Beginning of Balanced Expression" backward-sexp t]
"---"
["End of Function" end-of-defun t]
["Beginning of Function" beginning-of-defun t]
"---"
["Next Page" forward-page t]
["Previous Page" backward-page t]
"---"
["End of Buffer" end-of-buffer t]
["Beginning of Buffer" beginning-of-buffer t]
"---"
["Save Current Position..." point-to-register t]
["Goto Saved Position..." register-to-point t]
"---"
["Set Marker..." set-user-marker t]
["Goto Marker..." goto-user-marker t]
["List Markers" list-markers t]
"---"
["Set Goal Column" set-goal-column t]
["Cancel Goal Column" (set-goal-column t) goal-column]))