From 04b7a9a330f9a6358756b14c2665254e54eaab45 Mon Sep 17 00:00:00 2001 From: Filip Lobpreis Date: Fri, 23 Feb 2024 21:32:59 +0100 Subject: [PATCH] feat: Uniform way of closing popup window --- lua/neo-tree/ui/popups.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lua/neo-tree/ui/popups.lua b/lua/neo-tree/ui/popups.lua index 85362f364..ef92b0adb 100644 --- a/lua/neo-tree/ui/popups.lua +++ b/lua/neo-tree/ui/popups.lua @@ -102,13 +102,12 @@ M.alert = function(title, message, size) local success, msg = pcall(vim.api.nvim_buf_set_lines, win.bufnr, 0, 0, false, lines) if success then - win:map("n", "", function(bufnr) - win:unmount() - end, { noremap = true }) - - win:map("n", "", function(bufnr) - win:unmount() - end, { noremap = true }) + local exit_keys = { "", "", "q" } + for _, key in ipairs(exit_keys) do + win:map("n", key, function(bufnr) + win:unmount() + end, { noremap = true }) + end local event = require("nui.utils.autocmd").event win:on({ event.BufLeave, event.BufDelete }, function()