Directory navigation keys in filepath completion
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 818
- Forks
- 249
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 30
Description
Background
When cd-ing to a nested directory (or selecting a deeply nested file), you need to type "enter tab enter tab enter tab..." to repeatedly select a folder and then re-start the filepath completion within that folder.
e.g. to cd to a/b/c/d, you would do
e.g. cd a/<tab><enter to select b><tab to list directories in b><enter to select c><tab to list directories in c><enter to select d>
Desired solution
Once in interactive completion mode, pressing tab would cause the completion to enter the the hovered-over directory without ending interactive completion.
e.g. cd a/<tab to select b and list directories within b><tab to select c and list directories within c><enter to select d>
i.e.
cd <tab>
cd a/<tab>
cd a/b<tab>
cd a/b/c<tab>
cd a/b/c/d<enter>
(For simplicity I've omitted filtering/using arrow keys to choose between directories before pressing tab)
Additionally, pressing shift+tab could go in the opposite direction, i.e. setting the current completion to its parent directory. This could even go past the initial directory (i.e. to .., then ../.., etc)
e.g.
cd a/b/c<shift-tab>
cd a/b<shift-tab>
cd a<shift-tab>
cd ..<shift-tab>
cd ../..<enter>
References
You can somewhat emulate this behavior using external tools like fzf or broot, but such tools are more heavyweight (slower) than needed for this use case since they also search unrelated directories. Implementing this in reedline would also make it easier to complete filepath arguments without needing to set up custom keybinds with commandline and such.
Breaking changes
This shouldn't break users since, as far as I am aware, neither tab nor shift-tab are used currently within the filepath completion menu.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing reedline's interactive filepath completion mode and its handling of Tab and Shift-Tab. Done means Tab enters the hovered directory without leaving completion, while Shift-Tab moves to its parent, including paths above the initial directory, with the described cd examples working.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100