Properly handle backspace in minibuffer

This commit is contained in:
MitchMarq42 2022-08-28 14:25:50 -08:00
parent 4e05974fb1
commit 12bbbedbca
2 changed files with 15 additions and 8 deletions

View File

@ -46,12 +46,5 @@
"r" (general-key "C-c C-v r") "r" (general-key "C-c C-v r")
"s" 'eshell) "s" 'eshell)
;; broken
(general-define-key
:prefix-map 'minibuffer-mode-map
"DEL" 'backward-kill-word)
(provide 'mitch-keybinds) (provide 'mitch-keybinds)
;;; mitch-keybinds.el ends here ;;; mitch-keybinds.el ends here

View File

@ -189,7 +189,21 @@ This is taken from a website that I can't remember at the moment."
:straight (:files (:defaults "extensions/vertico-mouse.el")) :straight (:files (:defaults "extensions/vertico-mouse.el"))
:custom (vertico-resize t) :custom (vertico-resize t)
:config (vertico-mode) :config (vertico-mode)
(add-hook 'minibuffer-setup-hook 'turn-off-line-numbers)) (add-hook 'minibuffer-setup-hook 'turn-off-line-numbers)
(defun backspace-in-minibuffer ()
"If previous character is `/', kill to the previous `/'.
Otherwise, kill back 1 letter."
(interactive)
(if (= (string-to-char "/") (preceding-char))
(progn
(delete-region (- (point) 1)
(search-backward "/" nil nil 2))
(goto-char (1+ (point))))
(backward-delete-char 1)))
:general
(general-define-key
:prefix-map 'minibuffer-mode-map
"DEL" 'backspace-in-minibuffer))
(use-feature vertico-mouse (use-feature vertico-mouse
:straight vertico :straight vertico
:after vertico :after vertico