Minor refactor & reformatting across the board

This commit is contained in:
Henrik Lissner 2020-02-23 15:41:49 -05:00
parent 80c827119d
commit b30f38ac06
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
8 changed files with 49 additions and 50 deletions

View file

@ -126,17 +126,26 @@ directives. By default, this only recognizes C directives.")
(count-lines (point-min) (point-max))
(buffer-size)))))
;; '=' moves the cursor to the beginning of selection. Disable this, since
;; it's more disruptive than helpful.
;; HACK '=' moves the cursor to the beginning of selection. Disable this,
;; since it's more disruptive than helpful.
(defadvice! +evil--dont-move-cursor-a (orig-fn &rest args)
:around #'evil-indent
(save-excursion (apply orig-fn args)))
;; In evil, registers 2-9 are buffer-local. In vim, they're global, so...
;; REVIEW In evil, registers 2-9 are buffer-local. In vim, they're global,
;; so... Perhaps this should be PRed upstream?
(defadvice! +evil--make-numbered-markers-global-a (char)
:after-until #'evil-global-marker-p
(and (>= char ?2) (<= char ?9)))
;; REVIEW Fix #2493: dir-locals cannot target fundamental-mode when evil-mode
;; is active. See https://github.com/hlissner/doom-emacs/issues/2493.
;; Revert this if this is ever fixed upstream.
(defadvice! +evil--fix-local-vars-a (&rest _)
:before #'turn-on-evil-mode
(when (eq major-mode 'fundamental-mode)
(hack-local-variables)))
;; Make ESC (from normal mode) the universal escaper. See `doom-escape-hook'.
(advice-add #'evil-force-normal-state :after #'+evil-escape-a)
@ -156,14 +165,6 @@ directives. By default, this only recognizes C directives.")
(advice-add #'evil-open-above :around #'+evil--insert-newline-above-and-respect-comments-a)
(advice-add #'evil-open-below :around #'+evil--insert-newline-below-and-respect-comments-a)
;; REVIEW Fix #2493: dir-locals cannot target fundamental-mode when evil-mode
;; is active. See https://github.com/hlissner/doom-emacs/issues/2493.
;; Revert this if this is ever fixed upstream.
(defadvice! +evil--fix-local-vars-a (&rest _)
:before #'turn-on-evil-mode
(when (eq major-mode 'fundamental-mode)
(hack-local-variables)))
;; Recenter screen after most searches
(dolist (fn '(evil-visualstar/begin-search-forward
evil-visualstar/begin-search-backward
@ -404,11 +405,11 @@ To change these keys see `+evil-repeat-keys'."
;; `evil-collection'
(when (featurep! +everywhere)
(setq evil-collection-company-use-tng (featurep! :completion company +tng))
(unless doom-reloading-p
(load! "+everywhere"))
(setq evil-collection-company-use-tng (featurep! :completion company +tng))
;; Don't let evil-collection interfere with certain keys
(appendq! evil-collection-key-blacklist
(append (when (featurep! :tools lookup)

View file

@ -29,7 +29,7 @@
hs-set-up-overlay #'+fold-hideshow-set-up-overlay-fn)
(defadvice! +fold--hideshow-ensure-mode-a (&rest _)
"Ensure `hs-minor-mode' is enabled."
"Ensure `hs-minor-mode' is enabled when we need it, no sooner or later."
:before '(hs-toggle-hiding hs-hide-block hs-hide-level hs-show-all hs-hide-all)
(unless (bound-and-true-p hs-minor-mode)
(hs-minor-mode +1)))