Skip to content

is it possible to force a split buffer to scroll and show the last lines? #327

Discussion options

You must be logged in to vote

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:

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)

bufnr should be the buffer number for which you want to change the cursor.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@andreacfromtheapp
Comment options

@andreacfromtheapp
Comment options

Answer selected by andreacfromtheapp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants