Skip to content

Commit dae3bd2

Browse files
committed
fix(triggers): nil error
1 parent 977fa23 commit dae3bd2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lua/which-key/triggers.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ M.timer = (vim.uv or vim.loop).new_timer()
1515
--- Checks if a mapping already exists that is not a which-key trigger.
1616
---@param trigger wk.Trigger
1717
function M.is_mapped(trigger)
18-
---@type wk.Keymap|{}
18+
---@type wk.Keymap?
1919
local km
20-
vim.api.nvim_buf_call(trigger.buf, function()
20+
pcall(vim.api.nvim_buf_call, trigger.buf, function()
2121
km = vim.fn.maparg(trigger.keys, trigger.mode, false, true) --[[@as wk.Keymap]]
2222
end)
2323
-- not mapped
24-
if vim.tbl_isempty(km) then
24+
if not km or vim.tbl_isempty(km) then
2525
return false
2626
end
2727
-- ignore <Nop> mappings

0 commit comments

Comments
 (0)