Replies: 1 comment
-
FYI,
can be written as this since 0.59.0
While automatic header generation is a tempting idea, I don't think we can easily reach consensus on how the header should look like without introducing a bunch of options.
Each bind expression binds actions to a key or an event. So this naturally reads "when you press CTRL-R, fzf will perform set-header and reload". So this is going to be very confusing.
I believe such a script can define and use its own API to incrementally generate options (think of the builder pattern). # Pseudo-code
ob = OptionBuilder()
ob.bind(key: 'ctrl-x', label: 'do something', actions: [...])
ob.bind(key: 'ctrl-y', label: 'do something else', actions: [...])
...
ob.build() {
return "--bind ${ob.bindings} --header #{ob.header} #{ob.rest}"
}
|
Beta Was this translation helpful? Give feedback.
-
A common use-case for
--header
is to document the available keybindings and their actions.For example:
For large and complex fzf scripts, keeping headers in parity with bindings & actions can become more challenging.
It would be extremely useful if FZF could automatically generate the header (or footer, more on this in "Suggestion 2" below) for these use-cases
Suggestion 1
One suggestion is to set or declare the header text of a binding in the
--bind
itself.Example:
Equivalent to
Suggestion 2
Since
--header
is currently used for column header use-cases (i.e.ps -ef | fzf --header-lines 1
) and for binding/action documentation (i.e.--header='CTRL-R: reload'
) and since there are existing header actions likechange-header()
andtransform-header()
which can introduce complexity and/or conflicts, then perhaps a "footer" concept can be introduced for this feature.Example:
Equivalent to:
The footer approach would keep the header uncluttered by splitting the column header use-case from the binding/action documentation use-case without increasing complexity.
Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions