-
Basically the title. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
This might be what you are looking for. require("CopilotChat").setup {
auto_follow_cursor = false,
} |
Beta Was this translation helpful? Give feedback.
-
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' }, {
callback = function(args)
if vim.b[args.buf].view ~= nil then
vim.fn.winrestview(vim.b[args.buf].view)
end
end
}) |
Beta Was this translation helpful? Give feedback.
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: