Files
nix-config-v2/defaults/nvim/lua/plugins/mappings.lua

44 lines
902 B
Lua

local function toggle_floating_tui(cmd)
local terminal
return function()
if not terminal then
local Terminal = require("toggleterm.terminal").Terminal
terminal = Terminal:new {
cmd = cmd,
hidden = true,
close_on_exit = true,
direction = "float",
on_open = function() vim.cmd "startinsert!" end,
}
end
terminal:toggle()
end
end
local toggle_k9s = toggle_floating_tui "k9s"
local toggle_ghdash = toggle_floating_tui "gh-dash"
return {
{
"AstroNvim/astrocore",
---@type AstroCoreOpts
opts = {
mappings = {
n = {
["<Leader>k"] = { desc = "Kubernetes" },
["<Leader>ki"] = {
toggle_k9s,
desc = "K9s",
},
["<Leader>gD"] = {
toggle_ghdash,
desc = "GitHub dashboard",
},
},
},
},
},
}