aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua
diff options
context:
space:
mode:
authorglepnir <glephunter@gmail.com>2025-12-17 23:53:08 +0800
committerGitHub <noreply@github.com>2025-12-17 10:53:08 -0500
commit856391bc7fa982af5b8ee94d336c2e87ff83f970 (patch)
tree97177aec24bf633a62013166e93837882df9bc38 /runtime/lua
parent99e8b613760820199faac8ca101c5becd4b2374f (diff)
downloadrneovim-856391bc7fa982af5b8ee94d336c2e87ff83f970.tar.gz
rneovim-856391bc7fa982af5b8ee94d336c2e87ff83f970.tar.bz2
rneovim-856391bc7fa982af5b8ee94d336c2e87ff83f970.zip
fix(health): "q" keymap not set when health.style=float #37007
Problem: The q keymap is already set in open_floating_preview, so maparg('q') is not empty. Solution: Add a health.style check before setting the q keymap.
Diffstat (limited to 'runtime/lua')
-rw-r--r--runtime/lua/vim/health.lua11
1 files changed, 5 insertions, 6 deletions
diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua
index 5ca465aa82..cf8181c3f6 100644
--- a/runtime/lua/vim/health.lua
+++ b/runtime/lua/vim/health.lua
@@ -384,11 +384,7 @@ function M._check(mods, plugin_names)
local emptybuf = vim.fn.bufnr('$') == 1 and vim.fn.getline(1) == '' and 1 == vim.fn.line('$')
local bufnr ---@type integer
- if
- vim.g.health
- and type(vim.g.health) == 'table'
- and vim.tbl_get(vim.g.health, 'style') == 'float'
- then
+ if vim.tbl_get(vim.g, 'health', 'style') == 'float' then
local available_lines = vim.o.lines - 12
local max_height = math.min(math.floor(vim.o.lines * 0.8), available_lines)
local max_width = 80
@@ -485,7 +481,10 @@ function M._check(mods, plugin_names)
-- Quit with 'q' inside healthcheck buffers.
vim._with({ buf = bufnr }, function()
- if vim.fn.maparg('q', 'n', false, false) == '' then
+ if
+ vim.tbl_get(vim.g, 'health', 'style') == 'float'
+ or vim.fn.maparg('q', 'n', false, false) == ''
+ then
vim.keymap.set('n', 'q', function()
if not pcall(vim.cmd.close) then
vim.cmd.bdelete()