From: Andreas Gerler Date: Tue, 7 Jan 2014 11:46:33 +0000 (+0100) Subject: added goto-match-paren bound to key % X-Git-Url: http://git.bundesbrandschatzamt.de/?a=commitdiff_plain;h=c71781f3c5c4f4046a075ad5ac881caaa03d4f99;p=emacsconfig.git added goto-match-paren bound to key % Signed-off-by: Andreas Gerler --- diff --git a/init.el b/init.el index 5ae91518..c1da3f51 100644 --- a/init.el +++ b/init.el @@ -304,6 +304,15 @@ nil) (t (apply 'eshell-exec-visual (cons "ssh" args)))))) +(defun goto-match-paren (arg) + "Go to the matching parenthesis if on parenthesis, otherwise insert %. +vi style of % jumping to matching brace." + (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))))) +(global-set-key "%" 'goto-match-paren) + ;;(move-overlay hl-line-overlay ;; (line-beginning-position) (1+ (line-end-position)) ;; (current-buffer)))))