Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Robitx/gp.nvim into lsp
Browse files Browse the repository at this point in the history
  • Loading branch information
Robitx committed Dec 27, 2023
2 parents 0670ef7 + f2d9d75 commit f010721
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 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: 2023 December 20
*gp.nvim.txt* For NVIM v0.8.0 Last change: 2023 December 27

==============================================================================
Table of Contents *gp.nvim-table-of-contents*
Expand Down
14 changes: 13 additions & 1 deletion lua/gp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,19 @@ M.cmd.ChatPaste = function(params)
local target = M.resolve_buf_target(params)

last = vim.fn.resolve(last)
local buf = M.open_buf(last, target, M._toggle_kind.chat, true)
local buf = M._H.get_buffer(last)
local win_found = false
if buf then
for _, w in ipairs(vim.api.nvim_list_wins()) do
if vim.api.nvim_win_get_buf(w) == buf then
vim.api.nvim_set_current_win(w)
vim.api.nvim_set_current_buf(buf)
win_found = true
break
end
end
end
buf = win_found and buf or M.open_buf(last, target, M._toggle_kind.chat, true)

M.append_selection(params, cbuf, buf)
M._H.feedkeys("G", "x")
Expand Down

0 comments on commit f010721

Please sign in to comment.