From 75cca3586dc597544c7ddc19b4b58f1d29cb66af Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 24 Aug 2020 01:32:38 -0400 Subject: [PATCH] Fix gq/gw squeezing spaces across filled lines " abcdef" would be changed to "abcdef". Vim doesn't do this. Evil shouldn't either. --- modules/editor/evil/config.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/editor/evil/config.el b/modules/editor/evil/config.el index 2f9f7f99d..2b6cb8b16 100644 --- a/modules/editor/evil/config.el +++ b/modules/editor/evil/config.el @@ -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)