Fix gq/gw squeezing spaces across filled lines

"   abcdef" would be changed to "abcdef". Vim doesn't do this. Evil
shouldn't either.
This commit is contained in:
Henrik Lissner 2020-08-24 01:32:38 -04:00
parent e632871a11
commit 75cca3586d
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -158,6 +158,14 @@ directives. By default, this only recognizes C directives.")
;; Make J (evil-join) remove comment delimiters when joining lines.
(advice-add #'evil-join :override #'+evil-join-a)
;; Prevent gw (`evil-fill') and gq (`evil-fill-and-move') from squeezing
;; spaces. It doesn't in vim, so it shouldn't in evil.
(defadvice! +evil--no-squeeze-on-fill-a (orig-fn &rest args)
:around '(evil-fill evil-fill-and-move)
(letf! (defun fill-region (from to &optional justify nosqueeze to-eop)
(funcall fill-region from to justify t to-eop))
(apply orig-fn args)))
;; Make ESC (from normal mode) the universal escaper. See `doom-escape-hook'.
(advice-add #'evil-force-normal-state :after #'+evil-escape-a)