gum icon indicating copy to clipboard operation
gum copied to clipboard

[Feature] Allow filter with no limits, like `fzf --multi`.

Open pbnj opened this issue 1 year ago • 2 comments

Problem

I am trying to achieve something similar to fzf --multi functionality where I can pipe/filter output from one program through gum for (1) fuzzy-finding and (2) selecting multiple options.

I can accomplish one or the other, like:

  • gum choose --no-limit but I cannot fuzzy search, or
  • gum filter but I cannot select multiple options.

Info

$ brew info gum
charmbracelet/tap/gum: stable 0.1.0

Repro Steps

$ echo -e "abc\ndef\nghi\njkl\nmno\npqr\nstu\nvwx\nyz" | gum choose --no-limit
# cannot type anything
$ echo -e "abc\ndef\nghi\njkl\nmno\npqr\nstu\nvwx\nyz" | gum filter
# cannot select multiple options

Possible Solution

Since gum filter already has fuzzy finding algorithm implemented, so it might be a relatively easier lift to implement multi-selection with something like --no-limit (similar to gum choose) and TAB (not SPACE since it could be part of the search pattern/string) to select the current line and move the pointer to the next line.

pbnj avatar Jul 29 '22 02:07 pbnj

I would also like a feature like this, because the fuzzy feature is awesome. Maybe the selected items could be stickied to the top of the search results? I don't know.

Nickiel12 avatar Jul 29 '22 14:07 Nickiel12

Hey, thank you for this very well written issue ❤️

The proposal sounds very reasonable to me!

maaslalani avatar Jul 31 '22 17:07 maaslalani

This is now implemented in #130 thanks to @fedeztk!

gum filter --no-limit

maaslalani avatar Sep 03 '22 01:09 maaslalani

May I request that this be added to the README? I tried gum filter --no-limit on a hunch and could see that it was possible to select multiple but couldn't figure out how to select them! Drove me crazy until I found this PR 😄

miridius avatar Sep 30 '22 17:09 miridius

Ah yes! Adding this to the README right now, thank you @miridius!

maaslalani avatar Sep 30 '22 17:09 maaslalani

Adding this to the README right now

It doesn't mention tab.

Also, it's not ideal that gum choose only works with space and not tab. I use both in a script - would be nicer to just tell people in the beginning that they can select multiple items with tab.

vogler avatar Nov 18 '22 17:11 vogler

Ok, just saw #200 and that it's not released yet.

vogler avatar Nov 18 '22 17:11 vogler