diff --git a/lua/gp/config.lua b/lua/gp/config.lua index 2c42690..a120c29 100644 --- a/lua/gp/config.lua +++ b/lua/gp/config.lua @@ -121,6 +121,8 @@ local config = { chat_finder_pattern = "topic ", -- if true, finished ChatResponder won't move the cursor to the end of the buffer chat_free_cursor = false, + -- use prompt buftype for chats (:h prompt-buffer) + chat_prompt_buf_type = false, -- how to display GpChatToggle or GpContext: popup / split / vsplit / tabnew toggle_target = "vsplit", diff --git a/lua/gp/init.lua b/lua/gp/init.lua index d9fb901..b734f90 100644 --- a/lua/gp/init.lua +++ b/lua/gp/init.lua @@ -1401,6 +1401,14 @@ M.prep_chat = function(buf, file_name) M.prep_md(buf) + if M.config.chat_prompt_buf_type then + vim.api.nvim_buf_set_option(buf, "buftype", "prompt") + vim.fn.prompt_setprompt(buf, "") + vim.fn.prompt_setcallback(buf, function() + M.cmd.ChatRespond({ args = "" }) + end) + end + -- setup chat specific commands local range_commands = { {