diff --git a/lua/submode/init.lua b/lua/submode/init.lua index fd3c0d0..f20918d 100644 --- a/lua/submode/init.lua +++ b/lua/submode/init.lua @@ -34,10 +34,7 @@ function M.create(name, info, register) -- Judge to continue process by checking `override_behavior`. if state.submode_to_info[name] then if state.submode_to_info[name].override_behavior == "error" then - vim.notify(string.format("submode `%s` already exists", name), vim.log.levels.ERROR, { - title = "submode.nvim", - }) - return + error(string.format("submode `%s` already exists", name)) elseif state.submode_to_info[name].override_behavior == "keep" then return end @@ -174,10 +171,7 @@ function M.enter(name) -- Validate given submode's name. if not info then - vim.notify(string.format("submode `%s` doesn't exist", name), vim.log.levels.ERROR, { - title = "submode.nvim", - }) - return + error(string.format("submode `%s` doesn't exist", name)) end -- Validate that current mode and submode's parent mode is same diff --git a/lua/submode/mode.lua b/lua/submode/mode.lua index bdc4cb6..a14db2d 100644 --- a/lua/submode/mode.lua +++ b/lua/submode/mode.lua @@ -90,10 +90,7 @@ function M.is_parent_same(submode, name) ["!"] = fany { M.is_insert_mode, M.is_cmdline_mode }, [""] = fany { M.is_normal_mode, M.is_visual_mode, M.is_o_pending_mode }, }, function() - vim.notify(string.format("invalid mode `%s`", parent), vim.log.levels.ERROR, { - title = "submode.nvim", - }) - return false + error(string.format("invalid mode `%s`", parent)) end) end