ooknet/pkgs/nvchad/custom/term.lua
2023-08-21 12:44:33 +12:00

29 lines
619 B
Lua

local Terminal = require("toggleterm.terminal").Terminal
local M = {}
M.lazygit = Terminal:new({
cmd = "lazygit",
hidden = true,
direction = "float",
float_opts = {
border = "double",
},
-- function to run on opening the terminal
on_open = function(term)
vim.cmd("startinsert!")
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", { noremap = true, silent = true })
end,
-- function to run on closing the terminal
on_close = function(_)
vim.cmd("startinsert!")
end,
})
M.htop = Terminal:new({
cmd = "htop",
hidden = true,
direction = "float",
})
return M