-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
feature: header-click event for reporting clicks within header #3768
Conversation
Sets $FZF_HEADERCLICK_LINE and $FZF_HEADERCLICK_COLUMN env vars with coordinates of last click inside and relative to the header and fires header-click event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the man page as well.
After some testing, I decided that we should not reset the variables. Because if we do that, the information becomes unavailable to the preview process as it runs asynchronously in a different goroutine. fzf --header-lines=2 --bind 'click-header:transform-prompt(printf ${FZF_CLICK_HEADER_LINE}x${FZF_CLICK_HEADER_COLUMN})+preview(env | grep FZF)'
Merged, thanks! |
Glad to contribute! Thanks |
Hmm, I think we should reconsider how to report the line number as it can be confusing when you use multi-line Unlike fzf --header $'1. hello\n2. world' --header-first \
--bind 'click-header:transform-prompt:echo ${FZF_CLICK_HEADER_LINE}x${FZF_CLICK_HEADER_COLUMN}' clicking on But when you're in fzf --header $'1. hello\n2. world' --header-first \
--bind 'click-header:transform-prompt:echo ${FZF_CLICK_HEADER_LINE}x${FZF_CLICK_HEADER_COLUMN}' This gets even more confusing when you use both Should we always count from the top? Let me think about that. |
Regardless of `--layout`. #3768 (comment)
Sets
FZF_HEADERCLICK_LINE
andFZF_HEADERCLICK_COLUMN
env vars with coordinates of last click inside and relative to the header and fires header-click event.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. Could set a
FZF_HEADERCLICK_WORD
var as well if that is more useful to people.Here is a more complex demo with an interactive keyboard (invoke like
cat /usr/share/dict/words | python keyboard.py
).