Auto-recentering with many commands

This commit is contained in:
Kashish Sharma 2015-03-24 03:02:55 +05:30
parent caab3e62c8
commit d766eb35cf
1 changed files with 30 additions and 0 deletions

30
init.el
View File

@ -40,6 +40,36 @@
(setq scroll-conservatively 10000)
(setq auto-window-vscroll nil)
;;; Recenter screen on isearch matches
(add-hook 'isearch-mode-hook 'recenter)
(add-hook 'isearch-update-post-hook 'recenter)
(defadvice isearch-repeat-forward
(after isearch-repeat-forward-recenter activate)
(recenter))
(defadvice isearch-repeat-backward
(after isearch-repeat-backward-recenter activate)
(recenter))
(ad-activate 'isearch-repeat-forward)
(ad-activate 'isearch-repeat-backward)
;;;; While we're at it, let's add that to next-error as well
;;;; (this affects jumping to match from M-x grep , too)
(add-hook 'next-error-hook 'recenter)
;;;; ...and to magit-toggle-section
;;; It'd be really cool to (recenter 3) when you /open/ a section,
;;; and (recenter) when you close a section
(defadvice magit-toggle-section
(after magit-toggle-section-recenter activate)
(recenter 3))
(ad-activate 'magit-toggle-section)
(defadvice magit-unstage-item
(after magit-unstage-item-move)
(next-line))
(ad-activate 'magit-unstage-item)
;;;; Fix Emacs' definition of a sentence
(setq sentence-end-double-space nil)