Skip to content

Commit 24d6387

Browse files
committed
chore: Code style
1 parent 0c07095 commit 24d6387

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

lua/neominimap/events/mark.lua

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,6 @@ local function mark_set_keymap(key, m)
2626
end
2727
end
2828

29-
--- Run callback when command is run
30-
--- @param cmd string
31-
--- @param augroup string|integer
32-
--- @param f function()
33-
local on_cmd = function(cmd, augroup, f)
34-
api.nvim_create_autocmd("CmdlineLeave", {
35-
group = augroup,
36-
callback = function()
37-
if fn.getcmdtype() == ":" and vim.startswith(fn.getcmdline(), cmd) then
38-
f()
39-
end
40-
end,
41-
})
42-
end
43-
4429
--- @param key string
4530
return function(key)
4631
for code = string.byte("A"), string.byte("Z") do
@@ -53,8 +38,13 @@ return function(key)
5338

5439
local group = api.nvim_create_augroup("NeominimapMark", {})
5540
for _, cmd in ipairs({ "k", "mar", "delm" }) do
56-
on_cmd(cmd, group, function()
57-
exec_autocmd({ cmd = cmd })
58-
end)
41+
api.nvim_create_autocmd("CmdlineLeave", {
42+
group = group,
43+
callback = function()
44+
if fn.getcmdtype() == ":" and vim.startswith(fn.getcmdline(), cmd) then
45+
exec_autocmd({ cmd = cmd })
46+
end
47+
end,
48+
})
5949
end
6050
end

0 commit comments

Comments
 (0)