aboutsummaryrefslogtreecommitdiff
path: root/.config/emacs/evil.el
blob: 38415653dc5e34804ec8b957241e889f7c93c981 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(use-package evil
  :demand t
  :ensure nil
  :init
  (setq evil-want-keybinding nil)
  :config
  (evil-mode)
  :custom
  (evil-want-C-u-scroll t)
  (evil-undo-system 'undo-redo)
  (evil-move-beyond-eol nil)
  :bind
  ( :map evil-insert-state-map
	("C-d" . evil-delete-char))
  ( :map evil-motion-state-map
	("C-e" . nil)))

(use-package evil-collection
  :after evil
  :ensure nil
  :diminish evil-collection-unimpaired-mode
  :config
  (evil-collection-init))

(use-package evil-paste-indent
  :after evil
  :ensure nil
  :diminish
  :config (global-evil-paste-indent-mode t))

;; improved C-g dwim
(defun my-keyboard-quit ()
  "Smart C-g: exits evil mode, closes minibuffer, or behaves normally."
  (interactive)
  (if (and (bound-and-true-p evil-local-mode) (not (evil-normal-state-p)))
	  (evil-force-normal-state)
	(if (active-minibuffer-window)
		(if (minibufferp)
			(minibuffer-keyboard-quit)
		  (abort-recursive-edit))
	  (keyboard-quit))))
(global-set-key (kbd "C-g") #'my-keyboard-quit)