Closed schrenker closed 1 year ago
Hi!
Corfu with cape-file
should behave as you expect in the default settings. As soon as you hit TAB the currently selected directory is inserted via corfu-complete
. Then the subdirectories and subfiles are offered for completion.
The problem here is Tab n' Go (TNG) completion, where TAB is bound to corfu-next
. In order to fix this you have to somehow invoke corfu-complete
via some other key. I am not sure what the best approach would be, since I don't use TNG. One idea is to add a command bound to /
which inserts a slash or calls corfu-complete
where it makes sense. This is basically a design question. How should the TNG interaction model work when completing paths?
I hope this is helpful. I close the issue since it is a configuration question. Nevertheless feel free to continue the discussion. If we come up with something good we can either document it in the README or the wiki.
This is something I will experiment with:
One idea is to add a command bound to / which inserts a slash or calls corfu-complete where it makes sense.
Thanks for quick reply!
You're welcome. An easier alternative is to bind corfu-complete
to M-TAB, in order to confirm the candidate with M-TAB. With TNG the corfu-complete
binding is lost otherwise. I could document that right away in the README. Would that work for you? Maybe one could also look into other editors for how they handle file completion with TNG. Afaik TNG comes from some popular Vim completion UI.
I think I'd rather experiment with your earlier suggestion. Even if it doesn't work, TNG is so baked into my style of working, I think I'd rather just delete the slash and go forward :D As I said, it is just a minor nuissance I can get over with. Thanks again for the replies, and thanks for great packages.
Probably a questionable workaround, but I'm achieving this behavior using the following advice for quite some time now:
(defun cape-x-cape-file-persist ()
"If inserted symbol is a file path, call `cape-file' again."
(interactive)
(if (string-match "/$" (thing-at-point 'filename t))
(cape-file t)))
(advice-add 'corfu-insert :after #'cape-x-cape-file-persist)
Hello,
I have this problem with TAB completion and completing directories with corfu+cape-file combo.
My question is, is there a way of either getting recursive completion candidates, so with subdirectiories, or prompting another corfu candidate list without deleting and reinserting the '/'. Could be even done with just pressing '/', to get candidate list instead of second slash.
This is a minor nuissance, but I thought maybe you would know how to resolve this.
My config for corfu and cape: