Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom width, height, position on FloatTermToggle #409

Open
shivkar2n opened this issue May 5, 2023 · 2 comments
Open

Custom width, height, position on FloatTermToggle #409

shivkar2n opened this issue May 5, 2023 · 2 comments

Comments

@shivkar2n
Copy link

Hey first of all thanks for the awesome plugin!

I usually have a vs-code style terminal docked at the bottom of my editor which is called by command

:FloatermNew --height=0.4 --width=1.0 --wintype=float --position=bottom --autoclose=2

But when I run :FloatermToggle with no float-terminal initially open, it create a new floating terminal with the default properties.

Is there a way to toggle so that if no terminal exists then it opens one as specified above?

@1332927388
Copy link

+1

@nabaco
Copy link

nabaco commented Apr 11, 2024

Agreed. For now, this is how I configured it in Lua (using Lazy.nvim) in my Neovim setup:

keys = {
    "<leader>`",
    function()
        if vim.fn["floaterm#terminal#get_bufnr"]("quake") < 0 then
            vim.cmd.FloatermNew({
                "--height=0.3",
                "--wintype=split",
                "--name=quake",
                "--autoclose=2",
                "--title=Quake"
            })
        else
            vim.cmd.FloatermToggle("quake")
        end
    end,
    mode = {'n', 'i', 't'},
    desc="Quake terminal"
}

It checks whether a terminal with a given name exists already, and acts accordingly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants