From 98b060b8aa93e27908148b145731e3f4b770d1a8 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Tue, 12 Nov 2024 20:34:51 +0100 Subject: Add completion to write_file --- src/main/cmds.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/cmds.c b/src/main/cmds.c index 40983a2..fdd1d87 100644 --- a/src/main/cmds.c +++ b/src/main/cmds.c @@ -57,10 +57,20 @@ static int32_t exit_editor(struct command_ctx ctx, int argc, return 0; } +static void write_file_comp_inserted(void) { minibuffer_execute(); } + static int32_t write_file(struct command_ctx ctx, int argc, const char *argv[]) { const char *pth = NULL; if (argc == 0) { + struct completion_provider providers[] = {path_provider()}; + enable_completion(minibuffer_buffer(), + ((struct completion_trigger){ + .kind = CompletionTrigger_Input, + .data.input = + (struct completion_trigger_input){ + .nchars = 0, .trigger_initially = false}}), + providers, 1, write_file_comp_inserted); return minibuffer_prompt(ctx, "write to file: "); } -- cgit v1.2.3