Skip to content

Stop scrolling to bottom when chat is reopened #1188

Closed Answered by ataha322
ataha322 asked this question in Q&A
Discussion options

You must be logged in to vote

So I realized this isn't the plugin problem in particular, this is just how it works with default neovim/vim behaviour when you change buffers. With regular buffers - the view will change so that the cursor line is centered. With copilot chat for some reason it's viewed at the bottom.

For both cases I have this solution in my config:

-- Save and restore window view when switching buffers
vim.api.nvim_create_autocmd({ 'BufLeave' }, {
    callback = function(args)
        if vim.bo[args.buf].buftype == '' or vim.api.nvim_buf_get_name(args.buf):match('copilot%-chat') then
            vim.b[args.buf].view = vim.fn.winsaveview()
        end
    end
})
vim.api.nvim_create_autocmd({ 'BufEnter' }…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@ataha322
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by ataha322
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
Converted from issue

This discussion was converted from issue #1158 on July 21, 2025 12:42.