本文介绍了使用emacs,如何去配对(平衡)括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当一个圆括号上的光标时,如何跳转到配对括号。在 emacs -nw 中工作很好。
When cursor on one parentheses, how to jump to the pairing parentheses. Good to work in emacs -nw .
就像Vim中的%一样。
;;从@ Lindy,@Francesco,我发现更多:
;;After got hint from @Lindy, @Francesco, I found more:
C-M-f Move forward over a balanced expression
C-M-b Move backward over a balanced expression
C-M-k Kill balanced expression forward
C-M-SPC put the mark at the end of the sexp.
C-M-n Move forward over a parenthetical group
C-M-p Move backward over a parenthetical group
;; C-M key binding can also be done by --> ESC Control-key
;;And put this to .emacs, it will highlight opening/closing parens:
(show-paren-mode 1)
推荐答案
使用 CM-right
和 CM-left
(分别 backward-sexp
和 forward-sexp
)去当前表达式的开始或结束。这适用于括号对,但也适用于简单的单词。
Use C-M-right
and C-M-left
(respectively backward-sexp
and forward-sexp
) to go to the beginning or the end of the current expression. This works for parenthesis pairs but also for plain words.
这篇关于使用emacs,如何去配对(平衡)括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!