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

Placeholder expression for accept/print actions #3987

Closed
4 of 10 tasks
cskeeters opened this issue Sep 5, 2024 · 3 comments
Closed
4 of 10 tasks

Placeholder expression for accept/print actions #3987

cskeeters opened this issue Sep 5, 2024 · 3 comments
Assignees
Labels

Comments

@cskeeters
Copy link
Contributor

Checklist

  • I have read through the manual page (man fzf)
  • 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.55.0

OS

  • Linux
  • macOS
  • Windows
  • Etc.

Shell

  • bash
  • zsh
  • fish

Problem / Steps to reproduce

I propose adding placeholder expressions (i.e. {1}) for accept/print actions.

The command:

fzf -d : --with-nth 2.. --bind 'enter:become(echo {1})'

would turn into either:

fzf -d : --with-nth 2.. --bind 'enter:accept({1})'
fzf -d : --with-nth 2.. --bind 'enter:print({1})+abort'

I realize this is a nice to have.

I also think --accept-nth would complement --with-nth and --nth nicely for those users who don't want to mess with bindings and actions or don't understand replacing processes.

fzf -d : --with-nth 2.. --accept-nth 1
@junegunn junegunn self-assigned this Feb 9, 2025
@junegunn
Copy link
Owner

junegunn commented Feb 9, 2025

Not sure how I feel about extending accept or print, but --accept-nth can be handy in many cases, replacing an awk or sed in the post-processing step. I've been reluctant to add this, because replacing awk or sed with another option is not very "Unix-y" thing to do, but fzf can be configured with a different delimiter, and you would have to repeat that delimiter with sed or awk, and they might interpret it differently, I'm changing my mind, I think this has a value.

@cskeeters
Copy link
Contributor Author

I think you meant " but --accept-nth can be handy in many cases".

@junegunn
Copy link
Owner

You're right, edited the comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants