Closed QianChenglong closed 8 months ago
There is a lesser-known feature in fzf
named jump
/jump-accept
, which closely resembles what is
depicted in your screenshots.
To use it, type the command below and press either ; or :, followed by the number next to the item you wish to select.
# '--jump-labels' is optional
fzf --jump-labels '123456789' --bind ';:jump' --bind '::jump-accept'
Here are some GIFs in a related discussion[^1].
[!NOTE] The maintainer's opinion regarding
jump
can be found in a related issue.[^2]
[^1]: Discussion on keeping jump characters visible · Discussion #3281 [^2]: Ctrl-c to exit jump and fzf? · Issue #3412
There is a lesser-known feature in
fzf
namedjump
/jump-accept
, which closely resembles what is depicted in your screenshots.To use it, type the command below and press either ; or :, followed by the number next to the item you wish to select.
# '--jump-labels' is optional fzf --jump-labels '123456789' --bind ';:jump' --bind '::jump-accept'
Here are some GIFs in a related discussion1.
Note
The maintainer's opinion regarding
jump
can be found in a related issue.2Footnotes
Thank you very much for your answer. It is very close to the function I want, but the cursor movement and marking cannot be displayed at the same time, which is a bit inconvenient to use.
Standard terminals don't support CMD-[0-9]
or CTRL-[0-9]
key chords, but ALT-[0-9]
chords are available. The closest you can do is something like this.
ls | awk '{ if (NR <= 5) { print "A-" NR " " $0 } else { print " " $0 } }' |
fzf --bind 'alt-1:pos(1),alt-2:pos(2),alt-3:pos(3),alt-4:pos(4),alt-5:pos(5)' | cut -c5-
As per my previous comment, I'm not looking to add a different navigation mode to fzf or to extend the jump mode.
Supports quick selection of target item like alfred.