From 27d1ea0a15614a19d17e2016f477188bb4778248 Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Sat, 4 Dec 2021 11:03:07 -0800 Subject: [PATCH] feat: bind to cancel dialog in input (fix #1) --- lua/dressing/input.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/dressing/input.lua b/lua/dressing/input.lua index a8a28a4..9a1cdbb 100644 --- a/lua/dressing/input.lua +++ b/lua/dressing/input.lua @@ -38,6 +38,14 @@ return function(opts, on_confirm) vim.api.nvim_buf_set_option(bufnr, "buftype", "prompt") vim.api.nvim_buf_set_option(bufnr, "swapfile", false) vim.api.nvim_buf_set_option(bufnr, "bufhidden", "wipe") + local keyopts = { silent = true, noremap = true } + vim.api.nvim_buf_set_keymap( + bufnr, + "i", + "", + "lua dressing_prompt_confirm()", + keyopts + ) vim.fn.prompt_setprompt(bufnr, prompt) -- Would prefer to use v:lua directly here, but it doesn't work :( vim.fn.prompt_setcallback(bufnr, "dressing#prompt_confirm")