Vi match parenthasis

Vi command
:set showmatch

Vi % goes to the matching parenthesis

Macro for emacs to emulate vi

(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)))))


Popular posts from this blog

Vim vi how to reload a file your editing