diff --git a/lua/kubectl/mappings.lua b/lua/kubectl/mappings.lua index 917f2768..067bc478 100644 --- a/lua/kubectl/mappings.lua +++ b/lua/kubectl/mappings.lua @@ -292,6 +292,7 @@ function M.register() desc = "Toggle headers", callback = function() config.options.headers = not config.options.headers + pcall(require("kubectl.views").Redraw) end, }) diff --git a/lua/kubectl/views/init.lua b/lua/kubectl/views/init.lua index 893cee65..8dc5146d 100644 --- a/lua/kubectl/views/init.lua +++ b/lua/kubectl/views/init.lua @@ -214,6 +214,12 @@ function M.UserCmd(args) end) end +function M.Redraw() + local _, buf_name = pcall(vim.api.nvim_buf_get_var, 0, "buf_name") + local current_view, _ = M.view_and_definition(string.lower(vim.trim(buf_name))) + pcall(current_view.Draw) +end + --- Set a new URL and open the view ---@param opts table Options. Possible fields: --- - - Source view name where we are redirecting from