fzy
terminal fuzzy finder picker
git clone https://9o.is/git/fzy.git
commit 4a87bd14e2f009828d6660ba17666c6e3d399c6c parent 7162ebc29deeaed1837fbe6d4e151e601ee72f3e Author: Jul <jul@9o.is> Date: Tue, 5 Aug 2025 03:20:20 -0400 add halfpage up/down vi bindings Diffstat:
| M | src/tty_interface.c | | | 17 | ++++++++++++----- |
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/tty_interface.c b/src/tty_interface.c @@ -186,9 +186,16 @@ static void action_del_word(tty_interface_t *state) { state->cursor = cursor; } -static void action_del_all(tty_interface_t *state) { - memmove(state->search, &state->search[state->cursor], strlen(state->search) - state->cursor + 1); - state->cursor = 0; +static void action_halfpageup(tty_interface_t *state) { + update_state(state); + for (size_t i = 0; i < (state->options->num_lines / 2) && state->choices->selection > 0; i++) + choices_prev(state->choices); +} + +static void action_halfpagedown(tty_interface_t *state) { + update_state(state); + for (size_t i = 0; i < (state->options->num_lines / 2) && state->choices->selection < state->choices->available - 1; i++) + choices_next(state->choices); } static void action_prev(tty_interface_t *state) { @@ -300,10 +307,10 @@ static const keybinding_t keybindings[] = {{"\x1b", action_exit}, /* ESC * {KEY_CTRL('H'), action_del_char}, /* Backspace (C-H) */ {KEY_CTRL('W'), action_del_word}, /* C-W */ - {KEY_CTRL('U'), action_del_all}, /* C-U */ {KEY_CTRL('I'), action_autocomplete}, /* TAB (C-I ) */ + {KEY_CTRL('U'), action_halfpageup}, /* C-U */ + {KEY_CTRL('D'), action_halfpagedown}, /* C-D */ {KEY_CTRL('C'), action_exit}, /* C-C */ - {KEY_CTRL('D'), action_exit}, /* C-D */ {KEY_CTRL('G'), action_exit}, /* C-G */ {KEY_CTRL('M'), action_emit}, /* CR */ {KEY_CTRL('P'), action_prev}, /* C-P */