Stabilize directory backspace in minibuffer, see link in comment
This commit is contained in:
parent
be10bfa930
commit
789a91219f
@ -198,13 +198,15 @@ This is taken from a website that I can't remember at the moment."
|
|||||||
(add-hook 'minibuffer-setup-hook 'turn-off-line-numbers)
|
(add-hook 'minibuffer-setup-hook 'turn-off-line-numbers)
|
||||||
(defun backspace-in-minibuffer ()
|
(defun backspace-in-minibuffer ()
|
||||||
"If previous character is `/', kill to the previous `/'.
|
"If previous character is `/', kill to the previous `/'.
|
||||||
Otherwise, kill back 1 letter."
|
Otherwise, kill back 1 letter.
|
||||||
|
|
||||||
|
see https://www.reddit.com/r/emacs/comments/xq6rpa/comment/iqynyu9/?utm_source=share&utm_medium=web2x&context=3"
|
||||||
(interactive)
|
(interactive)
|
||||||
(if (= (string-to-char "/") (preceding-char))
|
(if (string-match-p "/." (minibuffer-contents))
|
||||||
(progn
|
(let ((end (point)))
|
||||||
(delete-region (- (point) 1)
|
(re-search-backward "/.")
|
||||||
(search-backward "/" nil nil 2))
|
(forward-char)
|
||||||
(goto-char (1+ (point))))
|
(delete-region (point) end))
|
||||||
(backward-delete-char 1)))
|
(backward-delete-char 1)))
|
||||||
:general
|
:general
|
||||||
(general-define-key
|
(general-define-key
|
||||||
|
Loading…
Reference in New Issue
Block a user