akinsho / toggleterm.nvim

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

Is it possible to give multiple open_mappings and direction so there is one to one mapping among them. #548

Closed BSiddharth closed 4 months ago

BSiddharth commented 5 months ago

something like open_mappings = {"<A-v>","<A-f>"} directions = {"vertical","floating"}

akinsho commented 4 months ago

Nope, unfortunately not. Not currently looking to expand that but I wouldn't say no to a well implemented PR

BSiddharth commented 4 months ago

@akinsho Got it, I did this

require("toggleterm").setup({
    size = function(term)
        if term.direction == "horizontal" then
            return 15
        elseif term.direction == "vertical" then
            return vim.o.columns * 0.4
        end
    end,
    open_mapping = "<A-v>",
    direction = "vertical"
})

vim.keymap.set("n", "<A-f>", ":ToggleTerm direction=float name='Will it work?'<CR>",
    { desc = "Floating term" })

It works however then the mappings kinda get confused and they open the same floating/vertical terminal no matter which key is pressed