From 87fe403df62fd8b89b886920c4f562da8e162cbe Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Fri, 28 Jun 2024 00:51:57 +0300 Subject: [PATCH] fix(bufremove): fix `Cancel` (#3834) ## What is this PR for? When you hit `Cancel` and a buffer is modified, it should not delete the buffer. ## Does this PR fix an existing issue? Fixes #3832 ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/util/ui.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 6bb8a4f7..28537bce 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -231,7 +231,7 @@ function M.bufremove(buf) if vim.bo.modified then local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel") - if choice == 0 then -- Cancel + if choice == 0 or choice == 3 then -- 0 for / and 3 for Cancel return end if choice == 1 then -- Yes