Skip to content

Commit

Permalink
tweak(evil): make evil-escape obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Nov 16, 2023
1 parent 396d9ee commit b107371
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 32 deletions.
8 changes: 0 additions & 8 deletions core/me-evil.el
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,6 @@
"gc" #'evilnc-comment-operator
"gC" #'evilnc-copy-and-comment-operator))

(use-package evil-escape
:straight t
:hook (evil-mode . evil-escape-mode)
:custom
;; The default "fd" interfere with the "f" (bound to `evil-snipe-f') binding.
(evil-escape-key-sequence "kj")
(evil-escape-unordered-key-sequence t)) ; "kj" or "jk"


(provide 'me-evil)

Expand Down
24 changes: 1 addition & 23 deletions modules/me-multi-cursors.el
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
(setq
evil-mc-custom-known-commands
'((backward-kill-word (:default . evil-mc-execute-default-call-with-count))
(evil-escape (:default . evil-mc-execute-default-evil-normal-state))
(evil-delete-back-to-indentation (:default . evil-mc-execute-default-call))
(undo-fu-only-redo (:default . evil-mc-execute-default-redo))
(undo-fu-only-undo (:default . evil-mc-execute-default-undo))
Expand All @@ -59,28 +58,7 @@
(ess-smart-comma (:default . evil-mc-execute-call))
(evil-digit-argument-or-evil-beginning-of-visual-line
(:default . evil-mc-execute-default-call)
(visual . evil-mc-execute-visual-call))))

(with-eval-after-load 'evil-escape
(defun +evil-mc-evil-escape-move-back-fake-cursors ()
(unless (bolp) (backward-char)))

(advice-add
'evil-escape-func :before
(defun +evil-mc--evil-escape-fix-a ()
(when (evil-mc-has-cursors-p)
(evil-mc-pause-cursors)
(run-with-idle-timer
0 nil
(lambda ()
(evil-mc-resume-cursors)
(let ((evil-mc-command '((:name . +evil-mc-evil-escape-move-back-fake-cursors))))
(evil-mc-execute-for-all)))))))

(add-to-list
'evil-mc-custom-known-commands
'(+evil-mc-evil-escape-move-back-fake-cursors
(:default . evil-mc-execute-default-call)))))
(visual . evil-mc-execute-visual-call)))))

(use-package evil-multiedit
:straight t
Expand Down
44 changes: 44 additions & 0 deletions modules/obsolete/me-evil-escape.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
;; me-evil-escape.el --- Escape without ESC -*- lexical-binding: t; -*-

;; Copyright (C) 2022-2023 Abdelhak Bougouffa

;; Author: Abdelhak Bougouffa (concat "abougouffa" "@" "fedora" "project" "." "org")

;;; Commentary:

;;; Code:

(use-package evil-escape
:straight t
:hook (evil-mode . evil-escape-mode)
:custom
;; The default "fd" interfere with the "f" (bound to `evil-snipe-f') binding.
(evil-escape-key-sequence "kj")
(evil-escape-unordered-key-sequence t) ; "kj" or "jk"
:config
(with-eval-after-load 'evil-mc
(push '(evil-escape (:default . evil-mc-execute-default-evil-normal-state)) evil-mc-custom-known-commands)

(defun +evil-mc-evil-escape-move-back-fake-cursors ()
(unless (bolp) (backward-char)))

(advice-add
'evil-escape-func :before
(defun +evil-mc--evil-escape-fix-a ()
(when (evil-mc-has-cursors-p)
(evil-mc-pause-cursors)
(run-with-idle-timer
0 nil
(lambda ()
(evil-mc-resume-cursors)
(let ((evil-mc-command '((:name . +evil-mc-evil-escape-move-back-fake-cursors))))
(evil-mc-execute-for-all)))))))

(add-to-list
'evil-mc-custom-known-commands
'(+evil-mc-evil-escape-move-back-fake-cursors
(:default . evil-mc-execute-default-call)))))

(provide 'obsolete/me-evil-escape)

;;; me-evil-escape.el ends here
3 changes: 2 additions & 1 deletion skel/modules.el
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
(setq minemacs-core-modules
'(me-splash ; Simple splash screen
me-keybindings ; Keybinding (general, which-key, hydra, ...)
me-evil ; Emacs as Vim (evil, evil-collection, evil-escape, evil-snipe, evil-numbers, ...)
me-evil ; Emacs as Vim (evil, evil-collection, evil-snipe, evil-numbers, ...)
me-core-ui ; Core UI (doom-themes, modus-themes, doom-modeline, ...)
me-completion)) ; Completion (vertico, marginalia, corfu, cape, consult, embark, ...)

Expand Down Expand Up @@ -81,6 +81,7 @@
;; minemacs-modules
;; '(obsolete/me-cov ; Show code coverage results (cov, ...)
;; obsolete/me-eaf ; EAF apps (browser, jupyter, file-sender, ...)
;; obsolete/me-evil-escape ; Escape without ESC (evil-escape, ...)
;; obsolete/me-flycheck ; Static checkers (flycheck, ...)
;; obsolete/me-lexic ; Offline dictionary using sdcv
;; obsolete/me-maxima ; Maxima CAS (maxima, imaxima)
Expand Down

0 comments on commit b107371

Please sign in to comment.