Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Robitx/gp.nvim into copilot
Browse files Browse the repository at this point in the history
  • Loading branch information
Robitx committed Jan 26, 2024
2 parents e9afe8b + 607f94d commit 0dc0cc8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion doc/gp.nvim.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*gp.nvim.txt* For NVIM v0.8.0 Last change: 2024 January 20
*gp.nvim.txt* For NVIM v0.8.0 Last change: 2024 January 25

==============================================================================
Table of Contents *gp.nvim-table-of-contents*
Expand Down
2 changes: 2 additions & 0 deletions lua/gp/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,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
13 changes: 9 additions & 4 deletions lua/gp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ M.create_handler = function(buf, win, line, first_undojoin, prefix, cursor)
local skip_first_undojoin = not first_undojoin

local hl_handler_group = "GpHandlerStandout"
vim.cmd("highlight default link " .. hl_handler_group .. " Search")
vim.cmd("highlight default link " .. hl_handler_group .. " CursorLine")

local ns_id = vim.api.nvim_create_namespace("GpHandler_" .. M._H.uuid())

Expand Down Expand Up @@ -1482,9 +1482,6 @@ M.prep_md = function(buf)
-- register shortcuts local to this buffer
buf = buf or vim.api.nvim_get_current_buf()

-- move cursor to a new line at the end of the file
M._H.feedkeys("G", "x")

-- ensure normal mode
vim.api.nvim_command("stopinsert")
M._H.feedkeys("<esc>", "x")
Expand Down Expand Up @@ -1521,6 +1518,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 0dc0cc8

Please sign in to comment.