fzf pageup/pagedown bindings

Created on 17 May 2015  路  9Comments  路  Source: junegunn/fzf

any thoughts on adding pageup/pagedown bindings, perhaps with Ctrl-D/Ctrl-U as in vim?

this would be particularly useful to me when using fzf to page through ag results. Using the fuzzy completion I can easily/quickly narrow the results to get all matchines in a file.

However, it is sometimes the case that I still have a lot more results in a single file than I can fit in a single screen, and I have to press Ctrl-J/Ctrl-K repeatedly just to browse through all of them looking for the right match.

PS: I should have mentioned that my keyboard doesn't have pageup/pagedn keys.

feature

Most helpful comment

Hey, --bind option is added to 0.9.12.

export FZF_DEFAULT_OPTS='--bind ctrl-f:page-down,ctrl-b:page-up'

All 9 comments

Yeah, I sometimes miss that too. But key bindings in fzf are set to be readline-compatible and ctrl-d and ctrl-u conflict with delete-char and unix-line-discard respectively. Also some users might prefer ctrl-b and ctrl-f pair. So if we're going to do this, we'll have to provide an option to "rebind" any keys and that would require some work.

What syntax did you have un mind for rebinding?

Perhaps something like '--rebind ctrl-d=pageup'.

In addition to ctrl-? it would have to support alt-? modifiers too, but what about ctrl-shift-? or other non typing keys like pause, esc, etc? Or even other modifier keys like cmd and super.

A basic version of the above with only ctrl-[a-z] and alt-[a-z] support seems feasible to do without too many changes, but supporting arbitrary bindings might require more work (haven't looked at the keyboard/terminal handling of fzf in detail to see if it already maps all modifiers).

I haven't given enough thought about it yet. I was vaguely thinking about naming every available action like in the output of bind -p of bash (or bindkey from zsh), so it can be something like follows:

--bindkey ctrl-a:beginning-of-line,ctrl-k:kill-line

In addition to ctrl-? it would have to support alt-? modifiers too, but what about ctrl-shift-? or other non typing keys like pause, esc, etc? Or even other modifier keys like cmd and super.

I'll limit the options to the ones allowed for --expect: ctrl-[a-z], alt-[a-z], f[1-4], or any single character.

Absolutely, I meant to exemplify a stringified action with the pageup in my example, although now i realize it could be interpreted as a key too.

Rebinding single typable characters (I.e. [a-z]) seems of very limited use since it interferes with typing/fuzzy-finding, but I guess there is no harm in letting users shoot themselves in the foot.

Are you interested in a pull-request for this feature or is this something you would rather do yourself?

You in a hurry? I'd like to take some time and mull over the details of how it should be.

Nope, not at all. I just like fzf enough that I am happy to devote some time of my own to making a bit better. I'll wait for you to take a stab at it then. Thanks ;)

Hey, --bind option is added to 0.9.12.

export FZF_DEFAULT_OPTS='--bind ctrl-f:page-down,ctrl-b:page-up'

Thank you!!!! I'll try it out, this is exactly what I needed.

Btw, I was just thinking about the bindings the other day, and realized a solution to having ctrl-d delete AND pagedown, would be to introduce modes as in vim. Thoughts?

would be to introduce modes as in vim. Thoughts?

Nope, sorry :) Feels like an overkill for such a short-lived process.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

natemara picture natemara  路  3Comments

erusev picture erusev  路  3Comments

nordlow picture nordlow  路  3Comments

jberglinds picture jberglinds  路  3Comments

ahmedelgabri picture ahmedelgabri  路  3Comments