local M = { "akinsho/toggleterm.nvim" }

M.cmd = { "ToggleTerm", "TermExec" }

M.opts = {
    size = function(term)
        if term.direction == "horizontal" then
            return vim.o.lines * 0.33
        elseif term.direction == "vertical" then
            return vim.o.colums * 0.33
        end
    end,
    open_mapping = "<C-z>",
    direction = "float",
    highlights = {
        Normal = { link = "Normal" },
        NormalNC = { link = "NormalNC" },
        NormalFloat = { link = "NormalFloat" },
        FloatBorder = { link = "FloatBorder" },
        StatusLine = { link = "StatusLine" },
        StatusLineNC = { link = "StatusLineNC" },
        WinBar = { link = "WinBar" },
        WinBarNC = { link = "WinBarNC" },
    },
    float_opts = {
        border = "curved",
        winblend = 5,
        width = function() return math.ceil(math.min(vim.o.columns, math.max(80, vim.o.columns - 20))) end,
        height = function() return math.ceil(math.min(vim.o.lines, math.max(20, vim.o.lines - 10))) end,
    },
    on_create = function()
        vim.opt.foldcolumn = "0"
        vim.opt.signcolumn = "no"
    end,
}

return M