Skip to content

Commit d27d2e3

Browse files
committed
feat(view separation): add a keymap to toggle processing / pending separation
1 parent 14fb24b commit d27d2e3

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

lua/glpi/config.lua

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ local defaults = {
1515
attribution = "<space>gt",
1616
attribution_to_me = "<space>ga",
1717
reload_ticket = "<space>gg",
18+
toggle_separation = "<space>gp",
1819
},
1920
}
2021

@@ -36,6 +37,10 @@ function M.setup(opts)
3637
M.options.base_url = M.options.endpoint:gsub("/apirest.php$", "")
3738
end
3839

40+
function M.toggle_processing_pending_separation()
41+
M.separate_pending_processing = not M.separate_pending_processing
42+
end
43+
3944
return setmetatable(M, {
4045
__index = function(_, k)
4146
if rawget(M, "options") == nil then

lua/glpi/init.lua

+9-3
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,18 @@ local function select_ticket(win, buf)
8383
})
8484
end
8585

86+
local function reload_tickets()
87+
api.update_tickets()
88+
view.update_tickets(api.tickets)
89+
end
90+
8691
function M.setup(opts)
8792
config.setup(opts)
8893

89-
vim.keymap.set("n", config.keymaps.reload_ticket, function()
90-
api.update_tickets()
91-
view.update_tickets(api.tickets)
94+
vim.keymap.set("n", config.keymaps.reload_ticket, reload_tickets, {})
95+
vim.keymap.set("n", config.keymaps.toggle_separation, function()
96+
config.toggle_processing_pending_separation()
97+
reload_tickets()
9298
end, {})
9399
end
94100

0 commit comments

Comments
 (0)