akinsho / toggleterm.nvim

A neovim lua plugin to help easily manage multiple terminal windows
GNU General Public License v3.0
4.21k stars 170 forks source link

[QUESTION] Full screen when using float direction #505

Closed vnea closed 10 months ago

vnea commented 10 months ago

Hello.

Is it possible to open the terminal in full screen when using the float direction?

Thank you.

vnea commented 10 months ago

I found a way to do it but I think this is a dirty solution:

vim.keymap.set("n", "<C-k>", function()
    local lazygit = require("toggleterm.terminal").Terminal:new({
        cmd = "lazygit",
        hidden = true,
        direction = "float",
        float_opts = {
            -- Enable full screen
            width = 9999,
            height = 9999,
        },
    })
    lazygit:toggle()
end)
akinsho commented 10 months ago

@vnea you are in control of the terminal size so as you have done you can control this yourself I'd suggest using something like vim.o.columns and vim.o.rows

vnea commented 10 months ago

Thank you, it works!

Just for information, vim.o.rows does not exist: I had to use vim.o.lines.

Here is my final configuration:

vim.keymap.set("n", "<Leader>k", function()
    local lazygit = require("toggleterm.terminal").Terminal:new({
        cmd = "lazygit",
        hidden = true,
        direction = "float",
        -- Enable full screen: https://github.com/akinsho/toggleterm.nvim/issues/505
        float_opts = {
            width = vim.o.columns,
            height = vim.o.lines,
        },
    })
    lazygit:toggle()
end)