From 5497e1039412ffd73407c8b9beca40d56f10418b Mon Sep 17 00:00:00 2001 From: Jonas Widen Date: Sun, 16 Mar 2025 14:48:35 +0100 Subject: [PATCH] auto scroll to latest question --- lua/gemini/init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/gemini/init.lua b/lua/gemini/init.lua index d088328..7c9fd71 100644 --- a/lua/gemini/init.lua +++ b/lua/gemini/init.lua @@ -82,7 +82,11 @@ local function update_chat_window(new_content) vim.api.nvim_buf_set_option(chat_bufnr, 'modifiable', false) -- Scroll to bottom - vim.api.nvim_win_set_cursor(chat_winnr, {vim.api.nvim_buf_line_count(chat_bufnr), 0}) + local line_count = vim.api.nvim_buf_line_count(chat_bufnr) + vim.api.nvim_win_set_cursor(chat_winnr, {line_count, 0}) + + -- Ensure the last line is visible + vim.api.nvim_command('normal! zz') -- Return focus to the previous window vim.cmd('wincmd p')