Cosmetics

This commit is contained in:
Jonas Widen 2025-03-16 17:26:04 +01:00
parent da30d262e1
commit 9adb558ea7

View File

@ -23,7 +23,7 @@ local function setup_chat_highlighting(bufnr)
-- Create syntax groups for user input and separators -- Create syntax groups for user input and separators
vim.cmd([[ vim.cmd([[
highlight GeminiUser guifg=#88C0D0 gui=bold highlight GeminiUser guifg=#EBCB8B gui=bold
highlight GeminiSeparator guifg=#616E88 gui=bold highlight GeminiSeparator guifg=#616E88 gui=bold
syntax match GeminiUser /^User:.*$/ syntax match GeminiUser /^User:.*$/
syntax match GeminiSeparator /^$/ syntax match GeminiSeparator /^$/
@ -117,15 +117,25 @@ local function update_chat_window(new_content)
-- Make buffer modifiable -- Make buffer modifiable
vim.api.nvim_buf_set_option(chat_bufnr, 'modifiable', true) vim.api.nvim_buf_set_option(chat_bufnr, 'modifiable', true)
-- Add separator before new content -- Initialize with content (without separator)
local separator = "━━━━━━━━━━━━━━━━━━━━━━━━━━" vim.api.nvim_buf_set_lines(chat_bufnr, 0, -1, false, vim.split(new_content, "\n"))
vim.api.nvim_buf_set_lines(chat_bufnr, -1, -1, false, {separator})
-- Update content -- Make buffer unmodifiable
vim.api.nvim_buf_set_lines(chat_bufnr, -1, -1, false, vim.split(new_content, "\n"))
-- Make buffer unmodifiable again
vim.api.nvim_buf_set_option(chat_bufnr, 'modifiable', false) 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 -- Scroll to bottom
local line_count = vim.api.nvim_buf_line_count(chat_bufnr) local line_count = vim.api.nvim_buf_line_count(chat_bufnr)