Making % work like vim
This commit is contained in:
parent
ef37f36de4
commit
182c1b9768
1 changed files with 9 additions and 0 deletions
9
.emacs
9
.emacs
|
|
@ -63,6 +63,15 @@
|
|||
(setq-default save-place t) ;; activate it for all buffers
|
||||
(require 'saveplace) ;; get the package
|
||||
|
||||
;; Make % work like 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)))))
|
||||
|
||||
;; Prevent Emacs from stupidly auto-changing my working directory
|
||||
(defun find-file-save-default-directory ()
|
||||
(interactive)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue