aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/lisp/init-evil.el
blob: 1ddd98faafb44350581c1443ad778fa231f6110f (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
43
(when (gx/maybe-require-package 'evil)
  (add-hook 'after-init-hook (lambda () (evil-mode 1))))

(setq evil-want-integration t
      evil-want-C-u-scroll t
      evil-wannt-fine-undo t
      evil-want-keybinding nil
      evil-disable-insert-state-bindings t
      evil-toggle-key "C-x C-z")

(with-eval-after-load 'evil
  (evil-set-leader 'normal ",")
  (evil-set-undo-system 'undo-tree)
  (evil-define-key 'insert 'global
    (kbd "C-【") 'evil-normal-state)
  (evil-define-key 'normal 'global
    (kbd "gj") 'evil-next-visual-line
    (kbd "gk") 'evil-previous-visual-line)
  (evil-define-key 'normal text-mode-map
    (kbd "j") 'evil-next-visual-line
    (kbd "k") 'evil-previous-visual-line
    (kbd "gj") 'evil-next-line
    (kbd "gk") 'evil-previous-line)
  (gx/diminish 'evil-mode))
  
;; evil-collection
(when (gx/maybe-require-package 'evil-collection)
  (with-eval-after-load 'evil
    (evil-collection-init
     '(xref
       dired
       ibuffer
       magit))))

(with-eval-after-load 'evil-collection-unimpaired
  (gx/diminish 'evil-collection-unimpaired-mode))

;; evil-easymotion
(when (gx/maybe-require-package 'evil-easymotion)
  (with-eval-after-load 'evil
    (evilem-default-keybindings "SPC")))

(provide 'init-evil)