What is the command to match brackets in Emacs?

What is the command to match brackets in Emacs (the equivalent of the % command in Vim)?


Solution 1:

See show-paren-mode as described in 5.27 How do I show which parenthesis matches the one I'm looking at?

Solution 2:

C-M-f, or M-x forward-sexp, goes forward to the closing brace, or to the opening brace in the next set of braces. C-M-b, or M-x backward-sexp, goes backward to the opening brace, or to the closing brace in the next set of braces. These commands will work for parentheses, square brackets, curly braces, angle brackets, etc., and can be customized to recognize other delimiters.

Solution 3:

Just to complete the last response. I use C-M-n for forward match and C-M-u for backward match. C-M maps to Esc+Ctrl on windows keyboards.

Solution 4:

There is also a show-paren-mode. For navigation, I think it's better C-M-n and C-M-n

Solution 5:

https://github.com/redguardtoo/evil-matchit

I read vim matchit code before developing evil-matchit. evil-matchit is offering much more than original vim matchit now.

Besides, you can easily extend evil-matchit to support any new languages in your own ~/.emacs.