aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuangxiong Lin <[email protected]>2022-03-12 23:11:30 +0800
committerGuangxiong Lin <[email protected]>2022-03-12 23:11:30 +0800
commit0097d1f3e22565ffb6db689c06ee2f9610cd45d0 (patch)
tree6ceb5ab15ab2c996294102af43b308c6c257f12b
parent1d9a1779b729dbd7d7537fb64b42fc7827b3f463 (diff)
downloaddotfiles-0097d1f3e22565ffb6db689c06ee2f9610cd45d0.tar.gz
dotfiles-0097d1f3e22565ffb6db689c06ee2f9610cd45d0.tar.bz2
dotfiles-0097d1f3e22565ffb6db689c06ee2f9610cd45d0.zip
Refactor evil config (emacs)
-rw-r--r--.emacs.d/lisp/init-evil.el36
-rw-r--r--.emacs.d/lisp/init-lang.el11
-rw-r--r--.emacs.d/lisp/init-misc.el10
-rw-r--r--.emacs.d/lisp/init-org.el3
4 files changed, 33 insertions, 27 deletions
diff --git a/.emacs.d/lisp/init-evil.el b/.emacs.d/lisp/init-evil.el
index a3f5cc4..d950f73 100644
--- a/.emacs.d/lisp/init-evil.el
+++ b/.emacs.d/lisp/init-evil.el
@@ -1,14 +1,12 @@
-(use-package evil
- :ensure t
- :hook ((evil-org-mode . (lambda () (setq evil-want-C-i-jump nil)))
- (after-init . (lambda () (evil-mode 1))))
- :init
- (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)
- :config
+(use-package evil :ensure t :defer t)
+
+(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)
+(with-eval-after-load 'evil
(evil-set-leader 'normal ",")
(evil-set-undo-system 'undo-tree)
(evil-define-key 'insert 'global
@@ -16,17 +14,15 @@
(evil-define-key 'normal 'global
(kbd "gj") 'evil-next-visual-line
(kbd "gk") 'evil-previous-visual-line))
-
-(use-package evil-collection
- :after evil
- :ensure t
- :config
+
+;; evil-collection
+(use-package evil-collection :ensure t :defer t)
+(with-eval-after-load 'evil
(evil-collection-init))
-(use-package evil-easymotion
- :ensure t
- :after (evil avy)
- :config
+;; evil-easymotion
+(use-package evil-easymotion :ensure t :defer t)
+(with-eval-after-load 'evil
(evilem-default-keybindings "SPC"))
(provide 'init-evil)
diff --git a/.emacs.d/lisp/init-lang.el b/.emacs.d/lisp/init-lang.el
index dc76b90..f281ac9 100644
--- a/.emacs.d/lisp/init-lang.el
+++ b/.emacs.d/lisp/init-lang.el
@@ -10,10 +10,12 @@
("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode))
:init
- (evil-define-key 'normal markdown-mode-map
- (kbd "<RET>") 'markdown-follow-link-at-point)
(setq markdown-command '("pandoc" "--from=markdown" "--to=html5")))
+(with-eval-after-load 'evil
+ (evil-define-key 'normal markdown-mode-map
+ (kbd "<RET>") 'markdown-follow-link-at-point))
+
(use-package go-mode
:ensure t
:commands (go-mode)
@@ -34,9 +36,12 @@
:ensure t
:commands (magit magit-status)
:init
- (setq magit-refresh-status-buffer nil)
+ (setq magit-refresh-status-buffer nil))
+
+(with-eval-after-load 'evil
(evil-define-key 'normal 'global
(kbd "<leader>gs") 'magit))
+
(use-package realgud
:defer t
diff --git a/.emacs.d/lisp/init-misc.el b/.emacs.d/lisp/init-misc.el
index 0e34af4..35e9756 100644
--- a/.emacs.d/lisp/init-misc.el
+++ b/.emacs.d/lisp/init-misc.el
@@ -105,15 +105,17 @@
(use-package projectile
:init
- (evil-define-key 'normal projectile-mode-map
- (kbd "<leader>p") 'projectile-command-map
- (kbd "<leader>ff") 'projectile-find-file
- (kbd "<leader>fr") 'projectile-ripgrep)
(setq projectile-cache-file (expand-file-name ".cache/projectile" user-emacs-directory)
projectile-require-project-root nil)
:config
(projectile-mode 1))
+(with-eval-after-load 'evil
+ (evil-define-key 'normal projectile-mode-map
+ (kbd "<leader>p") 'projectile-command-map
+ (kbd "<leader>ff") 'projectile-find-file
+ (kbd "<leader>fr") 'projectile-ripgrep))
+
(use-package rg
:ensure t
:commands (rg rg-menu))
diff --git a/.emacs.d/lisp/init-org.el b/.emacs.d/lisp/init-org.el
index 70ab76d..e27a9fe 100644
--- a/.emacs.d/lisp/init-org.el
+++ b/.emacs.d/lisp/init-org.el
@@ -156,6 +156,9 @@
;; evil
(use-package evil-org :ensure t :defer t)
(add-hook 'org-mode-hook 'evil-org-mode)
+(add-hook 'evil-org-mode-hook
+ (lambda ()
+ (setq evil-want-C-i-jump nil)))
(with-eval-after-load 'evil
(evil-define-key 'motion org-agenda-mode-map
(kbd "q") (lambda ()