aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/health.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2025-01-05 11:31:39 -0800
committerGitHub <noreply@github.com>2025-01-05 11:31:39 -0800
commit570a8da01b55c3aad1f057be236f55ccf82ed8af (patch)
tree80d1b9eccc2dca6b1ed775a0a479296a32dc0d04 /runtime/lua/vim/health.lua
parentac5a6d9ff56b451f5f24dfd3c46a6447375d3394 (diff)
downloadrneovim-570a8da01b55c3aad1f057be236f55ccf82ed8af.tar.gz
rneovim-570a8da01b55c3aad1f057be236f55ccf82ed8af.tar.bz2
rneovim-570a8da01b55c3aad1f057be236f55ccf82ed8af.zip
fix(health): "q" should not close last window #31876
Diffstat (limited to 'runtime/lua/vim/health.lua')
-rw-r--r--runtime/lua/vim/health.lua13
1 files changed, 6 insertions, 7 deletions
diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua
index ebad000c5b..01166628b1 100644
--- a/runtime/lua/vim/health.lua
+++ b/runtime/lua/vim/health.lua
@@ -409,13 +409,12 @@ function M._check(mods, plugin_names)
vim.print('')
-- Quit with 'q' inside healthcheck buffers.
- vim.api.nvim_buf_set_keymap(
- bufnr,
- 'n',
- 'q',
- '<c-w>q',
- { silent = true, noremap = true, nowait = true }
- )
+ vim.keymap.set('n', 'q', function()
+ local ok, _ = pcall(vim.cmd.close)
+ if not ok then
+ vim.cmd.bdelete()
+ end
+ end, { buffer = bufnr, silent = true, noremap = true, nowait = true })
-- Once we're done writing checks, set nomodifiable.
vim.bo[bufnr].modifiable = false