41 lines
1.3 KiB
Lua
41 lines
1.3 KiB
Lua
-- if true then return {} end
|
|
|
|
---@type LazySpec
|
|
return {
|
|
"akinsho/toggleterm.nvim",
|
|
cmd = { "ToggleTerm", "TermExec", "TermNew" },
|
|
version = false,
|
|
branch = "main",
|
|
keys = {
|
|
{ "<leader>tH", "<Cmd>TermNew size=20 direction=horizontal<CR>", desc = "New horizonal terminal" },
|
|
{ "<M-h>", "<Cmd>ToggleTerm size=20<CR>", desc = "Toggle terminal", mode = { "n", "t" } },
|
|
{
|
|
",tt",
|
|
function()
|
|
local size = vim.o.lines * 0.4
|
|
require("toggleterm").toggle(nil, size)
|
|
end,
|
|
mode = { "n", "t" },
|
|
desc = "Toggle terminal horizontal",
|
|
},
|
|
{ ",tn", "<Cmd>ToggleTerm direction=tab<CR>", desc = "Toggle terminal in tab" },
|
|
{ ",tN", "<Cmd>TermNew direction=tab<CR>", desc = "New terminal in tab" },
|
|
|
|
{ "<C-Up>", "<Cmd>resize +2<CR>", desc = "Resize terminal up", mode = "t" },
|
|
{ "<C-Down>", "<Cmd>resize -2<CR>", desc = "Resize terminal down", mode = "t" },
|
|
},
|
|
config = function(plugin, opts)
|
|
-- override size
|
|
require("toggleterm").setup {
|
|
-- size can be a number or function which is passed the current terminal
|
|
size = function(term)
|
|
if term.direction == "horizontal" then
|
|
return vim.o.lines * 0.4
|
|
elseif term.direction == "vertical" then
|
|
return vim.o.columns * 0.4
|
|
end
|
|
end,
|
|
} --[[@type ToggleTermConfig]]
|
|
end,
|
|
}
|