Skip to content

Commit 1a588d8

Browse files
committed
feat: chat buftype=prompt option (resolve: #94)
1 parent 65a1c6d commit 1a588d8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lua/gp/config.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ local config = {
121121
chat_finder_pattern = "topic ",
122122
-- if true, finished ChatResponder won't move the cursor to the end of the buffer
123123
chat_free_cursor = false,
124+
-- use prompt buftype for chats (:h prompt-buffer)
125+
chat_prompt_buf_type = false,
124126

125127
-- how to display GpChatToggle or GpContext: popup / split / vsplit / tabnew
126128
toggle_target = "vsplit",

lua/gp/init.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,14 @@ M.prep_chat = function(buf, file_name)
14011401

14021402
M.prep_md(buf)
14031403

1404+
if M.config.chat_prompt_buf_type then
1405+
vim.api.nvim_buf_set_option(buf, "buftype", "prompt")
1406+
vim.fn.prompt_setprompt(buf, "")
1407+
vim.fn.prompt_setcallback(buf, function()
1408+
M.cmd.ChatRespond({ args = "" })
1409+
end)
1410+
end
1411+
14041412
-- setup chat specific commands
14051413
local range_commands = {
14061414
{

0 commit comments

Comments
 (0)