ref(Layer): use `vim.notify` instead of `error`

pull/17/head
Iron-E 2 years ago
parent 49246bac2e
commit 4b84c1be46
No known key found for this signature in database
GPG Key ID: 19B71B7B7B021D22

@ -110,7 +110,12 @@ end
--- @see `vim.api.nvim_del_keymap` --- @see `vim.api.nvim_del_keymap`
function Layer:unmap(buffer, mode, lhs) function Layer:unmap(buffer, mode, lhs)
if not self.existing_keymaps_by_mode then if not self.existing_keymaps_by_mode then
error("Don't call this function before activating the layer; just remove from the keymap passed to `Layer.new` instead.") vim.notify(
"Don't call this function before activating the layer; just remove from the keymap passed to `Layer.new` instead.",
vim.log.levels.ERROR,
{title = 'nvim-libmodal'}
)
return
end end
if self.existing_keymaps_by_mode[mode][lhs] then -- there is an older keymap to go back to, so undo this layer_keymaps_by_mode if self.existing_keymaps_by_mode[mode][lhs] then -- there is an older keymap to go back to, so undo this layer_keymaps_by_mode

Loading…
Cancel
Save