From 640211d57006bb35067fa12141ddc8ddc0071efe Mon Sep 17 00:00:00 2001 From: MitchMarq42 Date: Sun, 4 Dec 2022 13:22:22 -0900 Subject: [PATCH] eshell: fix hyperbole and remove unused sudo toggle --- lisp/mitch-keybinds.el | 5 ----- lisp/mitch-packages.el | 23 +++++++++-------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/lisp/mitch-keybinds.el b/lisp/mitch-keybinds.el index 52007e5..b5697fe 100644 --- a/lisp/mitch-keybinds.el +++ b/lisp/mitch-keybinds.el @@ -40,11 +40,6 @@ "b" (general-key "C-c C-e") "r" (general-key "C-c C-v r") "s" 'eshell) -;; eshell fixes -(general-define-key - :states 'normal - :maps 'eshell-mode-map - "I" 'eshell-evil-insert-line) (provide 'mitch-keybinds) ;;; mitch-keybinds.el ends here diff --git a/lisp/mitch-packages.el b/lisp/mitch-packages.el index a4d3b53..571b6dc 100644 --- a/lisp/mitch-packages.el +++ b/lisp/mitch-packages.el @@ -156,20 +156,15 @@ This is taken from a website that I can't remember at the moment." (if (null args) (bury-buffer) (mapc #'find-file-other-window (mapcar #'expand-file-name (flatten-tree (reverse args)))))) - (defun aweshell-sudo-toggle () - "Toggle sudo with current command." - (interactive) - (save-excursion - (let ((commands (buffer-substring-no-properties - (progn (eshell-bol) (point)) (point-max)))) - (if (string-match-p "^sudo " commands) - (progn - (eshell-bol) - (while (re-search-forward "sudo " nil t) - (replace-match "" t nil))) - (progn - (eshell-bol) - (insert "sudo "))))))) + (defun mitch/eshell-setup-keys () + (evil-collection-define-key + 'normal + 'eshell-mode-map + (kbd "I") 'eshell-evil-insert-line + (kbd "RET") 'hkey-either)) + (advice-add 'evil-collection-eshell-setup-keys + :after 'mitch/eshell-setup-keys)) + (use-package eat :straight (:repo "https://codeberg.org/akib/emacs-eat" :files ("*.el" "dir" "*.info" "*.texi" "*.ti" ("e" "e/*")))