When cursor on one parentheses, how to jump to the pairing parentheses. Good to work in emacs -nw .
Just like % in Vim.
;;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)
In Emacs, if you are checking for balanced parentheses in a script, you can display which parenthesis matches the one you have selected by deleting it and reinserting it. Emacs will blink the cursor on the matching parentheses.
You can easily use the % key to jump to a matching opening or closing parenthesis, bracket or curly brace. You can also set the option showmatch . The cursor will briefly jump to the matching bracket, wen you insert one.
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.
As mentioned in emacs wiki (http://www.emacswiki.org/emacs/NavigatingParentheses):
C-M-n forward-list Move forward over a parenthetical group
C-M-p backward-list Move backward over a parenthetical group
C-M-f forward-sexp Move forward over a balanced expression
C-M-b backward-sexp Move backward over a balanced expression
C-M-k kill-sexp Kill balanced expression forward
C-M-SPC mark-sexp Put the mark at the end of the sexp.
https://superuser.com/questions/677516/how-do-i-jump-to-the-opening-or-closing-paren-brace-in-emacs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With