From 8838cdd58776966ddc3fb79c3e6aed843c28882f Mon Sep 17 00:00:00 2001 From: notomo Date: Mon, 31 Jul 2023 09:29:43 +0900 Subject: [PATCH] Remove continue --- lua/cmdbuf/handler/lua/cmd.lua | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lua/cmdbuf/handler/lua/cmd.lua b/lua/cmdbuf/handler/lua/cmd.lua index 2002a19..5fc3ceb 100644 --- a/lua/cmdbuf/handler/lua/cmd.lua +++ b/lua/cmdbuf/handler/lua/cmd.lua @@ -34,18 +34,20 @@ function M.add_history(self, line) vim.fn.histadd("cmd", self._lua(line)) end +local _delete_history = function(line) + if historylib.delete("cmd", line, [[\s*lua\s*]]) then + return + end + if historylib.delete("cmd", line, [[\s*lua\s*=]]) then + return + end + if historylib.delete("cmd", line, [[\s*=\s*]]) then + return + end +end function M.delete_histories(_, lines) for _, line in ipairs(lines) do - if historylib.delete("cmd", line, [[\s*lua\s*]]) then - goto continue - end - if historylib.delete("cmd", line, [[\s*lua\s*=]]) then - goto continue - end - if historylib.delete("cmd", line, [[\s*=\s*]]) then - goto continue - end - ::continue:: + _delete_history(line) end end