commit de190a2ba66e489e44a7206048e7c00b11137fff from: Omar Polo date: Sat Jul 17 12:47:44 2021 UTC add mini-goto-beginning/end bound to M- in minibuffer commit - ce6d533582c112f8eb9e11bdef5111d44692ec76 commit + de190a2ba66e489e44a7206048e7c00b11137fff blob - 68a620ecd1342af448f5de1bd4c047cf7a230eef blob + 70acbd22185d661a0566f611b2cb93f710248751 --- cmd.c +++ cmd.c @@ -861,3 +861,52 @@ cmd_toggle_pre_wrap(struct buffer *buffer) ui_schedule_redraw(); } + +void +cmd_mini_goto_beginning(struct buffer *buffer) +{ + struct vline *vl; + + if (!in_minibuffer) + return; + + buffer = &ministate.compl.buffer; + + if ((vl = buffer->current_line) != NULL) + vl->parent->type = LINE_COMPL; + + vl = TAILQ_FIRST(&buffer->head); + while (vl != NULL && vl->parent->flags & L_HIDDEN) + vl = TAILQ_NEXT(vl, vlines); + + if (vl == NULL) + return; + + vl->parent->type = LINE_COMPL_CURRENT; + buffer->top_line = vl; + buffer->current_line = vl; +} + +void +cmd_mini_goto_end(struct buffer *buffer) +{ + struct vline *vl; + + if (!in_minibuffer) + return; + + buffer = &ministate.compl.buffer; + + if ((vl = buffer->current_line) != NULL) + vl->parent->type = LINE_COMPL; + + vl = TAILQ_LAST(&buffer->head, vhead); + while (vl != NULL && vl->parent->flags & L_HIDDEN) + vl = TAILQ_PREV(vl, vhead, vlines); + + if (vl == NULL) + return; + + vl->parent->type = LINE_COMPL_CURRENT; + buffer->current_line = vl; +} blob - d5cb5c9108fa38b7dbc792b5ffcbba5d36abe741 blob + 76faa5a173f140f4347a5d30db2264f8a91dca06 --- cmd.h +++ cmd.h @@ -24,6 +24,8 @@ CMD(cmd_mini_abort); CMD(cmd_mini_complete_and_exit); CMD(cmd_mini_delete_backward_char); CMD(cmd_mini_delete_char); +CMD(cmd_mini_goto_beginning); +CMD(cmd_mini_goto_end); CMD(cmd_mini_kill_line); CMD(cmd_mini_next_history_element); CMD(cmd_mini_previous_history_element); blob - a932171815e42672583f9b9587f0839cff3f1199 blob + a1d648540be08eba93df5c66d086a2910de436e7 --- defaults.c +++ defaults.c @@ -358,6 +358,9 @@ load_default_keys(void) minibuffer_set_key("", cmd_previous_completion); minibuffer_set_key("", cmd_next_completion); + minibuffer_set_key("M-<", cmd_mini_goto_beginning); + minibuffer_set_key("M->", cmd_mini_goto_end); + minibuffer_set_key("tab", cmd_insert_current_candidate); } blob - 18a9663d855ae047ee001b0a2d1008b93ebb85c2 blob + 6be08a37cd8a4492839caeb49525d37245aa7745 --- telescope.1 +++ telescope.1 @@ -510,6 +510,10 @@ Complete the current minibuffer action. Delete the character before the point. .It Ic mini-delete-char Delete the character after the point. +.It Ic mini-goto-beginning +Select the first completion, if any. +.It Ic mini-goto-end +Select the last completion, if any. .It Ic mini-kill-line Delete from the point until the end of the line. .It Ic mini-next-history-element