As title. I'm learning Neovim's terminal-emulator related API. To explain the problem I need to show you the code first. I have a Lua script like this:

local win = vim.api.nvim_get_current_win()
local buf = vim.api.nvim_create_buf(true, false)
local jobid

local chan = vim.api.nvim_open_term(buf, {
  on_input = function(_, _, _, data)
    if jobid then
      pcall(vim.api.nvim_chan_send, jobid, data)

local opts = {
  -- height = vim.api.nvim_win_get_height(win),
  height = 10,
  -- width = true and 2 or vim.api.nvim_win_get_width(win),
  width = 20,
  pty = true,
  on_stdout = function(_, data)
    vim.api.nvim_chan_send(chan, table.concat(data, "\n"))
  on_exit = function(_, exit_code)
    vim.api.nvim_chan_send(chan, '\r\n[Process exited ' .. tostring(exit_code) .. ']')
    vim.api.nvim_buf_set_keymap(buf, "t", "<CR>", "<cmd>bd!<CR>", { noremap = true, silent = true})

jobid = vim.fn.jobstart({ 'cat', '/path/to/this/test.lua' }, opts)
vim.fn.jobresize(jobid, 20, 10)
vim.fn.jobresize(jobid, 30, 20)
vim.fn.jobresize(jobid, 40, 30)

And the three calls of vim.fn.jobresize doesn't seem to change the width and height of the output being printed. I still got a much large width being used after running the script by :source:

  • As you can see from the image, it wraps at columns 85, and this is apparently not either 20,30,40 I have set using jobresize.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.