Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make / behave like in ido #321

Closed
piranha opened this issue Dec 15, 2015 · 8 comments
Closed

Make / behave like in ido #321

piranha opened this issue Dec 15, 2015 · 8 comments

Comments

@piranha
Copy link

piranha commented Dec 15, 2015

So in ido, when you press / during find-file, it effectively "opens" the directory: you still can choose between directories, but if you start typing, currently chosen directory is assumed and after that you search inside of it.

I wonder if it's possible to make counsel-find-file behave somewhat like that? I think I can live with just slash choosing a directory during finding files (but not in other completion contexts). Is there a way I can do that?

@abo-abo
Copy link
Owner

abo-abo commented Dec 15, 2015

You can use this in your config:

(define-key counsel-find-file-map "/" 'ivy-alt-done)

This is too surprising to be on by default, in my opinion. In addition, you would lose the ability to quickly go to the root directory and to /ssh: from the current directory.

@piranha
Copy link
Author

piranha commented Dec 15, 2015

Yeah, in case of ido you can press slash twice and you'll get to root directory...

@abo-abo
Copy link
Owner

abo-abo commented Dec 15, 2015

I've just checked how / works in ido-mode: it doesn't select the item always, only when it's the only choice available. I can add that behavior, only I expect it to be quite frustrating if you want to select one item, and there's another one that's very close to it: you'd have to pretty much type out the whole thing until only one item matches. Using C-n and C-j would be a lot faster in that case.

@piranha
Copy link
Author

piranha commented Dec 16, 2015

Ok, makes sense, I'll try adapting to what ivy does. :)

@piranha piranha closed this as completed Dec 16, 2015
abo-abo added a commit that referenced this issue Apr 18, 2016
* ivy.el (ivy--magic-file-slash): Extract from `ivy--exhibit'.
(ivy--exhibit): Update.

Update to the behavior: the slash ("/") will enter a directory even if
its name isn't completely typed out if either:

1. It's the only candidate.
2. The candidate index isn't 0, i.e. "C-n" has been typed at least once.
3. The input isn't "/".

The above rules still allow to keep the old behavior with "//" moving to
root and "/ssh:" opening tramp.

This is an experimental feature, please report if it breaks someone's
workflow.

Re #321.
@abo-abo
Copy link
Owner

abo-abo commented Apr 18, 2016

Please test the new functionality, let me know if anything's weird.

@piranha
Copy link
Author

piranha commented Apr 18, 2016

Works nicely! Except in one case: if I type ~/, instead of switching to my home directory, it is opened.

@abo-abo
Copy link
Owner

abo-abo commented Apr 18, 2016

Except in one case: if I type ~/, instead of switching to my home directory, it is opened.

By default, ~ should switch you to home, and the following / would simply self-insert. Do you have any custom config?

@piranha
Copy link
Author

piranha commented Apr 18, 2016

Ah right! Thanks a lot, works like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants