From 9adb558ea7ad87573f916fe2bff52047a6d14572 Mon Sep 17 00:00:00 2001 From: Jonas Widen Date: Sun, 16 Mar 2025 17:26:04 +0100 Subject: [PATCH] Cosmetics --- lua/gemini/init.lua | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/lua/gemini/init.lua b/lua/gemini/init.lua index 5174446..eedc0dd 100644 --- a/lua/gemini/init.lua +++ b/lua/gemini/init.lua @@ -23,7 +23,7 @@ local function setup_chat_highlighting(bufnr) -- Create syntax groups for user input and separators vim.cmd([[ - highlight GeminiUser guifg=#88C0D0 gui=bold + highlight GeminiUser guifg=#EBCB8B gui=bold highlight GeminiSeparator guifg=#616E88 gui=bold syntax match GeminiUser /^User:.*$/ syntax match GeminiSeparator /^━━━━━━━━━━━━━━━━━━━━━━━━━━$/ @@ -117,15 +117,25 @@ local function update_chat_window(new_content) -- Make buffer modifiable vim.api.nvim_buf_set_option(chat_bufnr, 'modifiable', true) - -- Add separator before new content - local separator = "━━━━━━━━━━━━━━━━━━━━━━━━━━" - vim.api.nvim_buf_set_lines(chat_bufnr, -1, -1, false, {separator}) + -- Initialize with content (without separator) + vim.api.nvim_buf_set_lines(chat_bufnr, 0, -1, false, vim.split(new_content, "\n")) - -- Update content - vim.api.nvim_buf_set_lines(chat_bufnr, -1, -1, false, vim.split(new_content, "\n")) - - -- Make buffer unmodifiable again + -- Make buffer unmodifiable vim.api.nvim_buf_set_option(chat_bufnr, 'modifiable', false) + else + -- Make buffer modifiable + vim.api.nvim_buf_set_option(chat_bufnr, 'modifiable', true) + + -- Add separator before new content (only for subsequent messages) + local separator = "━━━━━━━━━━━━━━━━━━━━━━━━━━" + vim.api.nvim_buf_set_lines(chat_bufnr, -1, -1, false, {separator}) + + -- Update content + vim.api.nvim_buf_set_lines(chat_bufnr, -1, -1, false, vim.split(new_content, "\n")) + + -- Make buffer unmodifiable + vim.api.nvim_buf_set_option(chat_bufnr, 'modifiable', false) + end -- Scroll to bottom local line_count = vim.api.nvim_buf_line_count(chat_bufnr)