junegunn / fzf

:cherry_blossom: A command-line fuzzy finder
https://junegunn.github.io/fzf/
MIT License
62.32k stars 2.35k forks source link

feature: header-click event for reporting clicks within header #3766

Closed kuremu closed 2 months ago

kuremu commented 2 months ago

Sets FZF_HEADERCLICK_ROW and FZF_HEADERCLICK_LINE env vars with coordinates of last click inside and relative to the header.

printf "header1\nheader2\nheader3\na\nb\nc" | fzf --header-lines=3 --bind "header-click:transform-prompt(echo \${FZF_HEADERCLICK_LINE}x\${FZF_HEADERCLICK_COLUMN})"

Could be useful for eg. selecting a sort column. I think it could just as easily add a FZF_HEADERCLICK_WORD var as well.

Here is a more complex demo with an interactive keyboard (invoke like cat /usr/share/dict/words | python keyboard.py).

kuremu commented 2 months ago

sleep-deprived typo in the commit, i'm going to submit it again