abo-abo / swiper

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
https://oremacs.com/swiper/
2.32k stars 338 forks source link

counsel-find-file like tree navigation #1378

Open DamienCassou opened 6 years ago

DamienCassou commented 6 years ago

counsel-find-file displays a list of files in the current directory, allowing TAB to be used to enter one child and keep searching from there. This is really useful to navigate a tree structure. I'm looking for the same feature to complete stuff in other kinds of trees (e.g., music database, json document, ...).

From what I see in source code, the counsel-find-file behavior for TAB is hard-coded in ivy-partial-or-done. Does this mean there is no way to get the same behavior for different kinds of trees? Maybe let-binding ivy-partial-or-done? What do you think?

abo-abo commented 6 years ago

Maybe let-binding ivy-partial-or-done? What do you think?

This can be done, I have to think about it carefully.

The architecture of Ivy is that it's a mechanism to select a string from a list of strings. counsel-find-file undermines that architecture with hacks.

A nice way to extend to a tree structure completion could be to use ivy-read on a list and then ivy-read recursively on the result. That's not how counsel-find-file works: it takes over the existing ivy-read. I think the first step should be to remove some old hacks from list completion. After that, we can add a mechanism to generalize Ivy to select from a recursive list.

abo-abo commented 6 years ago

Just had an idea: https://github.com/abo-abo/plain-org-wiki would be a good candidate for a tree completion prototype.

Currently, my Org wiki includes 139 Org files in a flat directory structure. I think it would be cool to have the option to separate e.g. the PL topics into their own top-level node and use ivy-alt-done to navigate into it.

DamienCassou commented 6 years ago

Oleh Krehel notifications@github.com writes:

Just had an idea: https://github.com/abo-abo/plain-org-wiki would be a good candidate for a tree completion prototype. Currently, my Org wiki includes 139 Org files in a flat directory structure. I think it would be cool to have the option to separate e.g. the PL topics into their own top-level node and use ivy-alt-done to navigate into it.

if you manage to do that, I will implement an ivy-based viewer for hierarchy.el.

-- Damien Cassou http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill