Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding initial support for running interactive commands #1736

Closed

Conversation

mateuszr
Copy link

@mateuszr mateuszr commented Nov 3, 2019

I looked at feature request #751 and I it seems to me that this is a recurring topic. I would give it a try. This is a straightforward implementation of running interactive command in fzf:

  • we specify the command using -c param
  • query is fed directly to the command
  • the command is run every time the query changes (is rerun as-you-type)
  • the list is fed with the new result of the command (and any current selection is gone)
    The speed is acceptable, even though we run a command multiple times.
    I've put some more observations in [Feature request] invoke ag interactively #751.

@andreyorst
Copy link

andreyorst commented Nov 4, 2019

Thanks on working on this!

It would be nice if you could make args compatible with those that skim uses. As maintainer of fzf.kak I try to keep plugin generic and because skim uses pretty much the same args as fzf it was easy to support both tools with the same code.

Although if this adds too much complexity, then I'm more than OK to do this on plugin side :)

@mateuszr
Copy link
Author

mateuszr commented Nov 4, 2019

hey!
Actually they are the same: -c and alternatively --cmd, are exactly the same that skim uses. Or I missed something?

@andreyorst
Copy link

hey!
Actually they are the same: -c and alternatively --cmd, are exactly the same that skim uses. Or I missed something?

There's also -i in skim. https://github.com/lotabout/skim#interactive-mode

Maybe it's not necessary though.

junegunn added a commit that referenced this pull request Nov 10, 2019
  # Reload input list with different sources
  seq 10 | fzf --bind 'ctrl-a:reload(seq 100),ctrl-b:reload(seq 1000)'

  # Reload as you type
  seq 10 | fzf --bind 'change:reload:seq {q}' --phony

  # Integration with ripgrep
  RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case "
  INITIAL_QUERY=""
  FZF_DEFAULT_COMMAND="$RG_PREFIX '$INITIAL_QUERY'" \
    fzf --bind "change:reload:$RG_PREFIX {q} || true" \
        --ansi --phony --query "$INITIAL_QUERY"

Close #751
Close #965
Close #974
Close #1736
Related #1723
@junegunn
Copy link
Owner

I'm taking a different approach in #1750, which I believe is more extensible and generic. It doesn't introduce a new "mode", instead, it builds upon the existing features.

@junegunn junegunn closed this Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants