Skip to content

Commit

Permalink
Add support for overriding the default yank_diff register (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjonpaulbrown-cc authored Aug 9, 2024
1 parent cfdf371 commit 0149238
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ Also see [here](/lua/CopilotChat/config.lua):
proxy = nil, -- [protocol://]host[:port] Use this proxy
allow_insecure = false, -- Allow insecure server connections

yank_diff_register = '"', -- Allow overriding the register for yanking diffs

system_prompt = prompts.COPILOT_INSTRUCTIONS, -- System prompt to use
model = 'gpt-4o', -- GPT model to use, 'gpt-3.5-turbo', 'gpt-4', or 'gpt-4o'
temperature = 0.1, -- GPT temperature
Expand Down
3 changes: 3 additions & 0 deletions lua/CopilotChat/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ local select = require('CopilotChat.select')
---@field proxy string?
---@field allow_insecure boolean?
---@field system_prompt string?
---@field yank_diff_register string?
---@field model string?
---@field temperature number?
---@field question_header string?
Expand All @@ -82,6 +83,8 @@ return {
proxy = nil, -- [protocol://]host[:port] Use this proxy
allow_insecure = false, -- Allow insecure server connections

yank_diff_register = '"', -- Allows overriding the register for yanking diffs

system_prompt = prompts.COPILOT_INSTRUCTIONS, -- System prompt to use
model = 'gpt-4o-2024-05-13', -- GPT model to use, 'gpt-3.5-turbo', 'gpt-4', or `gpt-4o-2024-05-13`
temperature = 0.1, -- GPT temperature
Expand Down
2 changes: 1 addition & 1 deletion lua/CopilotChat/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ function M.setup(config)
local lines = find_lines_between_separator(section_lines, '^```%w*$', true)
if #lines > 0 then
local content = table.concat(lines, '\n')
vim.fn.setreg('"', content)
vim.fn.setreg(M.config.yank_diff_register, content)
end
end)

Expand Down

0 comments on commit 0149238

Please sign in to comment.