Hi, Does anyone know how can I get the backspace to skip pass just one char when using it with dired from top level directory to base directory? e.g.
Find file: ~/projects/some-project/sub-dir
# When I press Backspace at the sub-dir level I want it to go directly to
~/projects/some-project/ not by one char e.g.
~/projects/some-projec
In Spacemacs, it seems I can get the effect by pressing Ctl-h, but what I want is this to be the default behavior when pressing backspace.
Probably dired-up-directory?
You can use ^
to jump up. That said, one of the packages I have installed (ivy?) enables the mode you're asking about - pressing delete/backspace removes a single path segment not a single character
Ido does this https://www.masteringemacs.org/article/introduction-to-ido-mode
(defun tvaughan/parent-directory (path)
"Return the parent directory of PATH."
(or (file-name-directory (directory-file-name path)) ""))
(defun tvaughan/backward-delete-directory (arg)
"Delete characters backward until encountering the end of a word.
With ARG, do this that many times."
(interactive "p")
(let ((contents (minibuffer-contents)))
(delete-minibuffer-contents)
(insert (tvaughan/parent-directory contents))))
(use-package selectrum
:config
(selectrum-mode +1))
(define-key selectrum-minibuffer-map (kbd "DEL") #'tvaughan/backward-delete-directory)
ido does this much better. This still doesn't replicate it as well. Granted, this is used with selectrum, but should be adaptable
Is Ido basically a competitor for help or ivy?
Thanks @grazfather after adding ivy, and now I get the desired effect that I want.
I am trying a new config and canβt remember how this work with my old config. And ivy
package seems to be the one that I really need.