aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorphanium <91544758+phanen@users.noreply.github.com>2025-03-29 20:55:17 +0800
committerGitHub <noreply@github.com>2025-03-29 05:55:17 -0700
commit78d2e0b43e7a8dccbd4444a7d11e55d8f9a2d71b (patch)
tree7e90f63031a7367ecf2901742e04298597a78579 /runtime/lua/vim
parent874e2149931f40c41c470c2a6ca6c6719fab4c4d (diff)
downloadrneovim-78d2e0b43e7a8dccbd4444a7d11e55d8f9a2d71b.tar.gz
rneovim-78d2e0b43e7a8dccbd4444a7d11e55d8f9a2d71b.tar.bz2
rneovim-78d2e0b43e7a8dccbd4444a7d11e55d8f9a2d71b.zip
fix(checkhealth): don't override user "q" keymap #33132
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/health.lua12
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