diff options
-rw-r--r-- | runtime/lua/vim/health.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua index c790779d51..169c5f4b02 100644 --- a/runtime/lua/vim/health.lua +++ b/runtime/lua/vim/health.lua @@ -449,11 +449,15 @@ function M._check(mods, plugin_names) vim.print('') -- Quit with 'q' inside healthcheck buffers. - vim.keymap.set('n', 'q', function() - if not pcall(vim.cmd.close) then - vim.cmd.bdelete() + vim._with({ buf = bufnr }, function() + if vim.fn.maparg('q', 'n', false, false) == '' then + vim.keymap.set('n', 'q', function() + if not pcall(vim.cmd.close) then + vim.cmd.bdelete() + end + end, { buffer = bufnr, silent = true, noremap = true, nowait = true }) end - end, { buffer = bufnr, silent = true, noremap = true, nowait = true }) + end) -- Once we're done writing checks, set nomodifiable. vim.bo[bufnr].modifiable = false |