Consult's `find-file' behavior when typing "~"

Question also asked here:
Consult’s `find-file’ behavior when typing “~” - Emacs Stack Exchange

I’m switching from counsel to consult.

counsel uses counsel-find-file. The behavior is that when I type ~, it will automatically change the prompt to the home directory:

;; Initially it shows this
Find File: ~/dir1/dir2/

;; typing '~' gives this 
Find File: ~/

When I use consult it calls the built-in emacs find-file.

;; Initially it shows this:
Find File: ~/dir1/dir2/

;; typing '~' gives this:
Find File: ~/dir1/dir2/~

Is there a way to get find-file (and therefore consult) to behave like counsel when typing ~?

It does do that if you type ~/.

@tusharhero I want the old path to go away like it did with counsel.

Does it not do that if you type ~/? Or do you need it to happen when
you type ~, I would recommend getting used to this behavior.

When I type ~/ it gives this:

~/dir1/dir2/~/

I would like emacs to delete ~/dir1/dir2/ so it would only show ~/

I have a solution here. Thanks minad!
Adjusting `find-file’ behavior when typing “~” · minad/consult · Discussion #1222

1 Like

It works for me with the builtin fido-vertical-mode.