is it possible to force a split buffer to scroll and show the last lines? #327
-
Hi, the following function adds line to the bottom right split pane/buffer. As you can see, the NuiLines don't scroll. is there a way to force that buffer to scroll please? I tried with the commented out vim lines but nope. -- run chuck vm in a job and putput stdout in a split as is
local function start_chuck(cmd, logfile)
vim.fn.jobstart(cmd .. " 3>&1 2>&1 | tee " .. tostring(logfile), {
on_stdout = function(_, data, _)
for _, line in pairs(data) do
layout.chuck_log:add_node(NuiTree.Node({ log = line }))
layout.chuck_log:render()
-- vim.api.nvim_feedkeys("<S-g>", "n", true)
-- vim.fn.win_execute(layout.chuck_pane.bufnr, "norm <S-g>")
end
end,
})
end Here's a simple session GIF to see what I mean. Don't mind anything happening but the bottom right pane not scrolling. To explain, what I do is feed the buffers to chuck, the top right shows a list of what's "current" and the bottom right shows the vm logging of everything. With new lines "going over the bottom" It should scroll to show latest lines in my ideal world but I'm probably misunderstading NUI again. Is it feasible at all? Please and thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Scrolling is outside the scope of Scrolling in Neovim is just placing the cursor in right place. You can use Check If your cursor is already on the buffer, you can do: vim.api.nvim_win_set_cursor(0, { vim.fn.line('$'), 1 }) If your cursor is on a different buffer, you can do: vim.api.nvim_buf_call(bufnr, function()
vim.api.nvim_win_set_cursor(0, { vim.fn.line('$'), 1 })
end)
|
Beta Was this translation helpful? Give feedback.
Scrolling is outside the scope of
nui.nvim
.Scrolling in Neovim is just placing the cursor in right place. You can use
vim.api.nvim_win_set_cursor
for that.Check
:help nvim_win_set_cursor
.If your cursor is already on the buffer, you can do:
If your cursor is on a different buffer, you can do:
bufnr
should be the buffer number for which you want to change the cursor.