Skip to content

[BUG] Vertical window always has a width of 8 no matter what size= is set to #648

Open

Description

@antiduplicity

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

following the exact copy and paste found in the GitHub site, I set the width for vertical to be 80 or 300 or vim.o.colums * 0.4 and it always defaults to 8 columns wide no matter what I do.

Expected Behavior

size= should do something in vertical mode

Steps To Reproduce

latest nvim
vim.keymap.set("n", "rp", function()
local file = vim.fn.expand("%:p") -- full path to current file
local Terminal = require("toggleterm.terminal").Terminal

local py_term = Terminal:new({
cmd = "python3 " .. file,
direction = "vertical",
size=40,
close_on_exit = false,
start_in_insert = true,
on_open = function(term)
vim.cmd("startinsert!")
end,
})
py_term:toggle()
end),

the actual size of the window is ALWAYS 8

Environment

- OS:Mac OS
- neovim version:0.11.3
- Shell: does not matter, I have tried 5 different terminal programs and 3 different shells

Anything else?

No response

Activity

  1. xcfw commented on Sep 3, 2025

    @xcfw

    I have the same issue, when tried to use it for claude code I also found on mbp m2 that vertical terminal is missized

  2. agwhitaker93 commented on Sep 3, 2025

    @agwhitaker93

    Terminal:new doesn't accept a size parameter. You can provide a size when you call :toggle on it though

    local my_term = Terminal:new({
      direction = "vertical"
    })
    my_term:toggle(80)

    Or you can provide a size function when setting toggleterm up

    require('toggleterm'.setup({
      size = function(term)
        if term.direction == "horizontal" then
          return 20
        elseif term.direction == "vertical" then
          return 80
          -- return vim.o.columns * 0.4
        end
      end
    })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions