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.
This commit is contained in:
Henrik Lissner
2025-03-31 04:07:35 -04:00
parent 084a0f42a3
commit 26c372cd01

View File

@ -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 ----------------------