laktak / extrakto

extrakto for tmux - quickly select, copy/insert/complete text without a mouse
MIT License
878 stars 45 forks source link

Multiple results (similar to `fzf --multi`) #79

Closed yjyao closed 2 years ago

yjyao commented 3 years ago

This is a feature request to support choosing multiple results. The multiple results should be separated by spaces. Currently extrakto allows only one result per invocation.

Steps to reproduce

  1. in ~/.tmux.conf add
    set -g @extrakto_fzf_tool "/path/to/fzf --multi"
    set -g @extrakto_insert_key 'enter'
  2. enter a tmux session with extrakto enabled
  3. run : hello world
  4. trigger extrakto
  5. in the extrakto window, move cursor to hello
  6. press <tab> to select
  7. move cursor to world
  8. press <tab> to select
  9. press <enter>to insert

Expected result

Extrakto inserts hello world at cursor position.

Actual result

Extrakto inserts world at cursor position.

Info

Rationale

One of the most common use cases of extrakto is to "retype" file paths. Often users would like to edit several files at a time. For example, after user runs git status and sees several files, they might want to edit three of the listed files. Currently user has to trigger extrakto three times to achieve this.

laktak commented 3 years ago

Hey, thanks for the suggestion. Sounds like a good idea. I'll look into it when I find some time.

If someone wants to do a PR let us know.

laur89 commented 2 years ago

The multiple results should be separated by spaces

Propose it to be separated by configurable separator, defaulting to space

totallyGreg commented 2 years ago

Another use case for multiple selection: I want to be able to filter all lines that contain the fuzzy search 'failed' control-a to select them all (or tab to select individual lines) and return to copy or insert each of the resulting lines

yjyao commented 2 years ago

@totallyGreg i might be jumping to conclusions but that sounds very much like a task better accomplished with grep.

laktak commented 2 years ago

Hey guys! @benoit-pierre was so kind to do a PR that implements this.

Could you try it, tell him you love it ;) and maybe provide some feedback?