Split evil into its own module to start making it optional.

This commit is contained in:
2026-10-28 08:03:07 +02:00
parent c43ff55d32
commit 15ef206732
+44
View File
@@ -0,0 +1,44 @@
;;; evil.el --- Minimal Evil -*- lexical-binding: t; -*-
;;; Commentary:
;; Evil for text editing and navigation only, with Evil's own defaults for
;; special buffers. Exceptions: dired (hjkl) and Magit (modules/git.el).
;; evil-collection is not used.
;;; Code:
(use-package evil
:init
(setq evil-want-C-u-scroll t
evil-undo-system 'undo-redo)
:config
(evil-mode 1)
;; Literal tab in insert state.
(evil-define-key 'insert 'global
(kbd "TAB") #'self-insert-command
(kbd "C-SPC") #'completion-at-point)
;; project.el finders, dired-jump.
(evil-define-key '(normal motion) 'global
(kbd "C-e") #'dired-jump
(kbd "C-p") #'project-find-file
(kbd "C-f") #'project-find-regexp)
;; eglot code navigation.
(evil-define-key '(normal motion) 'global
"gd" #'xref-find-definitions
"gD" #'xref-find-references
"K" #'eldoc
(kbd "C-t") #'xref-go-back)
(evil-set-initial-state 'dired-mode 'motion))
;; Dired: hjkl. j/k are Evil's line motions; h goes up a directory,
;; l opens the file or directory at point.
(with-eval-after-load 'dired
(evil-define-key 'motion dired-mode-map
"h" #'dired-up-directory
"l" #'dired-find-file
"." #'dired-omit-mode
(kbd "RET") #'dired-find-file))
;;; evil.el ends here