From 26c372cd01728a4555b1642fc1409a4763c98e21 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 31 Mar 2025 04:07:35 -0400 Subject: [PATCH] fix(evil): don't auto-set evil-shift-width in org-mode org-mode requires `tab-width` be 8, which is not a sensible default for `evil-shift-width`, so let it fall back to its default value (which is 4) in org buffers. --- modules/editor/evil/config.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/editor/evil/config.el b/modules/editor/evil/config.el index f2bdbfd7c..19f759cdc 100644 --- a/modules/editor/evil/config.el +++ b/modules/editor/evil/config.el @@ -100,8 +100,12 @@ directives. By default, this only recognizes C directives.") (evil-set-cursor-color (get 'cursor 'evil-emacs-color))) ;; Ensure `evil-shift-width' always matches `tab-width'; evil does not police - ;; this itself, so we must. - (setq-hook! 'after-change-major-mode-hook evil-shift-width tab-width) + ;; this itself, so we must. Except in org-mode, where `tab-width' *must* + ;; default to 8, which isn't a sensible default for `evil-shift-width'. + (add-hook! 'after-change-major-mode-hook + (defun +evil-adjust-shift-width-h () + (unless (derived-mode-p 'org-mode) + (setq-local evil-shift-width tab-width)))) ;; --- keybind fixes ----------------------