junegunn / junegunn/fzf

[Feature Request] Line numbers for selectable results

Open
#3,938 5 comments 5 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
83k
Forks
2.9k
Avg merge
17h 8m
Merged PRs (30d)
10

Description

### Checklist

- [X] I have read through the manual page (`man fzf`)
- [X] I have searched through the existing issues
- [ ] For bug reports, I have checked if the bug is reproducible in the latest version of fzf

### Output of `fzf --version`

0.52.1 (0.52.1)

### OS

- [X] Linux
- [ ] macOS
- [ ] Windows
- [ ] Etc.

### Shell

- [ ] bash
- [X] zsh
- [ ] fish

### Problem / Steps to reproduce

I use a voice coding system and where possible it is most convenient to select results from a cli tui by specifying a line number representing the distance from the current cursor. These line numbers aren't related to the content of what is being found, but rather only related to what can be selected from arbitrary results.

I've looked through the man page, issues, and other discussion and afaict this isn't currently possible (happy to be wrong though). What I'm describing is something like what atuin currently supports, which is shown in this [gif](https://github.com/atuinsh/atuin/blob/main/demo.gif).

To give a non-gif example, currently if I fuzzy find current folders I'd get something like this:

```
❯ fdd
> ╭─────────────────────────────────────────────────────────────────────────╮
598/598 ──────────────────────────────────────────────────────────────── │ total 884 1/10││
> . ││ drwxr-xr-x 2 aa users 4096 7月 22 09:43 changelog ││
./changelog │ -rw-r--r-- 1 aa users 43498 6月 11 17:37 CHANGELOG.md ││
./patches │ -rw-r--r-- 1 aa users 126 6月 11 17:37 CONTRIBUTING.md ││
./fonts │ drwxr-xr-x 5 aa users 4096 7月 22 18:44 cursorless.nvim ││
```

And what I'd like is something like this:

```
❯ fdd
> ╭─────────────────────────────────────────────────────────────────────────╮
598/598 ──────────────────────────────────────────────────────────────── │ total 884 1/10││
0 > . ││ drwxr-xr-x 2 aa users 4096 7月 22 09:43 changelog ││
1 ./changelog │ -rw-r--r-- 1 aa users 43498 6月 11 17:37 CHANGELOG.md ││
2 ./patches │ -rw-r--r-- 1 aa users 126 6月 11 17:37 CONTRIBUTING.md ││
3 ./fonts │ drwxr-xr-x 5 aa users 4096 7月 22 18:44 cursorless.nvim ││
```

This would allow me to issue a voice command like `pick three` and it would automatically be able to go to the `./fonts` entry.

An important requirement is also that the line numbers could update as you scroll, so for example if I pressed down, note that the indexes would change to the following:

```
❯ fdd
> ╭─────────────────────────────────────────────────────────────────────────╮
598/598 ──────────────────────────────────────────────────────────────── │ total 884 1/10││
. ││ drwxr-xr-x 2 aa users 4096 7月 22 09:43 changelog ││
0 > ./changelog │ -rw-r--r-- 1 aa users 43498 6月 11 17:37 CHANGELOG.md ││
1 ./patches │ -rw-r--r-- 1 aa users 126 6月 11 17:37 CONTRIBUTING.md ││
2 ./fonts │ drwxr-xr-x 5 aa users 4096 7月 22 18:44 cursorless.nvim ││
```

This allows me to always know the distance I need to say in order to select a specific entry.

Is this possible already or if not could it be considered as a new feature?

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue concerns fzf's CLI result rendering and selection behavior; start by tracing those paths from the command-line entry point. Done means selectable results show relative line numbers that update as the cursor moves, while preserving selection of the intended entry.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, zsh
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.