Skip to content

Commit

Permalink
feat: chat buftype=prompt option (resolve: #94)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robitx committed Jan 25, 2024
1 parent a78d82b commit 6812976
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/gp/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 8 additions & 0 deletions lua/gp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
{
Expand Down

0 comments on commit 6812976

Please sign in to comment.