-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
- I have read through the manual page (
man fzf) - [?] I have the latest version of fzf
- I have searched through the existing issues
Info
- OS
- Linux
- Mac OS X
- Windows
- Etc.
- Shell
- bash
- zsh
- fish
Problem / Steps to reproduce
Is there any way to get fzf to behave as if --nth had been passed different values for different lines?
I am trying to build a way to complete flags from previously run commands. Imagine that I have a history file like the following:
foo --foo_1 --foo_2 --foo_3=foo
bar --bar_1 --bar_2=bar --bar_3
I would like to generate the following lines from this file. fzf would be searching and outputting only the parts in [[ ]]:
foo [[--foo_1]] --foo_2 --foo_3=foo
foo --foo_1 [[--foo_2]] --foo_3=foo
foo --foo_1 --foo_2 [[--foo_3=foo]]
bar [[--bar_1]] --bar_2=bar --bar_3
bar --bar_1 [[--bar_2=bar]] --bar_3
bar --bar_1 --bar_2=bar [[--bar_3]]
I think that using some trickery (like --nth and --with-nth) and post processing I can get close to what I want.
Ideally there would be some way that I could tell fzf to match on different field index expressions for different lines. That way I could set --nth=X for the line that I need.
Does anyone know how I might accomplish such a thing? I've considered prepending, something like:
[[--foo_1]] foo --foo_1 --foo_2 --foo_3=foo
etc
There I could just use --nth=1. I worry I lose the context there though. Is there a way to do such a thing?