From d92d26bf2ad35403a67edcb3cfb7d0128e057cb6 Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 15 Aug 2024 20:58:01 +0800 Subject: [PATCH] fix: make the result buffer unmodifiable (#10) --- lua/avante/sidebar.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/avante/sidebar.lua b/lua/avante/sidebar.lua index 9d5b435c1..9188a3471 100644 --- a/lua/avante/sidebar.lua +++ b/lua/avante/sidebar.lua @@ -186,11 +186,11 @@ local function update_result_buf_content(content) vim.defer_fn(function() api.nvim_set_option_value("modifiable", true, { buf = result_buf }) api.nvim_buf_set_lines(result_buf, 0, -1, false, vim.split(content, "\n")) + api.nvim_set_option_value("modifiable", false, { buf = result_buf }) api.nvim_set_option_value("filetype", "markdown", { buf = result_buf }) if result_win ~= -1 then -- Move to the bottom api.nvim_win_set_cursor(result_win, { api.nvim_buf_line_count(result_buf), 0 }) - api.nvim_set_option_value("modifiable", false, { buf = result_buf }) api.nvim_set_current_win(current_win) end end, 0)