Skip to content

Commit e69e88e

Browse files
deathbeamTomas Slusny
andauthored
docs: Make configuration easier to navigate through (#201)
Split configuration to section with newlines Group similar configs together in sections Signed-off-by: Tomas Slusny <ts6234@att.com> Co-authored-by: Tomas Slusny <ts6234@att.com>
1 parent 358218b commit e69e88e

2 files changed

Lines changed: 45 additions & 31 deletions

File tree

README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,21 +185,30 @@ Also see [here](/lua/CopilotChat/config.lua):
185185

186186
```lua
187187
{
188-
system_prompt = prompts.COPILOT_INSTRUCTIONS, -- System prompt to use
189-
model = 'gpt-4', -- GPT model to use
190-
temperature = 0.1, -- GPT temperature
191-
context = 'manual', -- Context to use, 'buffers', 'buffer' or 'manual'
188+
debug = false, -- Enable debug logging
192189
proxy = nil, -- [protocol://]host[:port] Use this proxy
193190
allow_insecure = false, -- Allow insecure server connections
194-
debug = false, -- Enable debug logging
191+
192+
system_prompt = prompts.COPILOT_INSTRUCTIONS, -- System prompt to use
193+
model = 'gpt-4', -- GPT model to use, 'gpt-3.5-turbo' or 'gpt-4'
194+
temperature = 0.1, -- GPT temperature
195+
196+
name = 'CopilotChat', -- Name to use in chat
197+
separator = '---', -- Separator to use in chat
195198
show_folds = true, -- Shows folds for sections in chat
196199
show_help = true, -- Shows help message as virtual lines when waiting for user input
197-
clear_chat_on_new_prompt = false, -- Clears chat on every new prompt
198200
auto_follow_cursor = true, -- Auto-follow cursor in chat
199-
name = 'CopilotChat', -- Name to use in chat
200-
separator = '---', -- Separator to use in chat
201+
clear_chat_on_new_prompt = false, -- Clears chat on every new prompt
202+
203+
context = nil, -- Default context to use, 'buffers', 'buffer' or none (can be specified manually in prompt via @).
201204
history_path = vim.fn.stdpath('data') .. '/copilotchat_history', -- Default path to stored history
202205
callback = nil, -- Callback to use when ask response is received
206+
207+
-- default selection (visual or line)
208+
selection = function(source)
209+
return select.visual(source) or select.line(source)
210+
end,
211+
203212
-- default prompts
204213
prompts = {
205214
Explain = {
@@ -232,10 +241,7 @@ Also see [here](/lua/CopilotChat/config.lua):
232241
end,
233242
},
234243
},
235-
-- default selection (visual or line)
236-
selection = function(source)
237-
return select.visual(source) or select.line(source)
238-
end,
244+
239245
-- default window options
240246
window = {
241247
layout = 'vertical', -- 'vertical', 'horizontal', 'float'
@@ -250,6 +256,7 @@ Also see [here](/lua/CopilotChat/config.lua):
250256
footer = nil, -- footer of chat window
251257
zindex = 1, -- determines if window is on top or below other floating windows
252258
},
259+
253260
-- default mappings
254261
mappings = {
255262
close = 'q',

lua/CopilotChat/config.lua

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,41 +45,50 @@ local select = require('CopilotChat.select')
4545

4646
--- CopilotChat default configuration
4747
---@class CopilotChat.config
48+
---@field debug boolean?
49+
---@field proxy string?
50+
---@field allow_insecure boolean?
4851
---@field system_prompt string?
4952
---@field model string?
5053
---@field temperature number?
51-
---@field context string?
52-
---@field proxy string?
53-
---@field allow_insecure boolean?
54-
---@field debug boolean?
54+
---@field name string?
55+
---@field separator string?
5556
---@field show_folds boolean?
5657
---@field show_help boolean?
57-
---@field clear_chat_on_new_prompt boolean?
5858
---@field auto_follow_cursor boolean?
59-
---@field name string?
60-
---@field separator string?
59+
---@field clear_chat_on_new_prompt boolean?
60+
---@field context string?
6161
---@field history_path string?
6262
---@field callback fun(response: string)?
63-
---@field prompts table<string, CopilotChat.config.prompt|string>?
6463
---@field selection nil|fun(source: CopilotChat.config.source):CopilotChat.config.selection?
64+
---@field prompts table<string, CopilotChat.config.prompt|string>?
6565
---@field window CopilotChat.config.window?
6666
---@field mappings CopilotChat.config.mappings?
6767
return {
68+
debug = false, -- Enable debug logging
69+
proxy = nil, -- [protocol://]host[:port] Use this proxy
70+
allow_insecure = false, -- Allow insecure server connections
71+
6872
system_prompt = prompts.COPILOT_INSTRUCTIONS, -- System prompt to use
6973
model = 'gpt-4', -- GPT model to use, 'gpt-3.5-turbo' or 'gpt-4'
7074
temperature = 0.1, -- GPT temperature
71-
context = 'manual', -- Context to use, 'buffers', 'buffer' or 'manual'
72-
proxy = nil, -- [protocol://]host[:port] Use this proxy
73-
allow_insecure = false, -- Allow insecure server connections
74-
debug = false, -- Enable debug logging
75+
76+
name = 'CopilotChat', -- Name to use in chat
77+
separator = '---', -- Separator to use in chat
7578
show_folds = true, -- Shows folds for sections in chat
7679
show_help = true, -- Shows help message as virtual lines when waiting for user input
77-
clear_chat_on_new_prompt = false, -- Clears chat on every new prompt
7880
auto_follow_cursor = true, -- Auto-follow cursor in chat
79-
name = 'CopilotChat', -- Name to use in chat
80-
separator = '---', -- Separator to use in chat
81+
clear_chat_on_new_prompt = false, -- Clears chat on every new prompt
82+
83+
context = nil, -- Default context to use, 'buffers', 'buffer' or none (can be specified manually in prompt via @).
8184
history_path = vim.fn.stdpath('data') .. '/copilotchat_history', -- Default path to stored history
8285
callback = nil, -- Callback to use when ask response is received
86+
87+
-- default selection (visual or line)
88+
selection = function(source)
89+
return select.visual(source) or select.line(source)
90+
end,
91+
8392
-- default prompts
8493
prompts = {
8594
Explain = {
@@ -112,10 +121,7 @@ return {
112121
end,
113122
},
114123
},
115-
-- default selection (visual or line)
116-
selection = function(source)
117-
return select.visual(source) or select.line(source)
118-
end,
124+
119125
-- default window options
120126
window = {
121127
layout = 'vertical', -- 'vertical', 'horizontal', 'float'
@@ -130,6 +136,7 @@ return {
130136
footer = nil, -- footer of chat window
131137
zindex = 1, -- determines if window is on top or below other floating windows
132138
},
139+
133140
-- default mappings
134141
mappings = {
135142
close = 'q',

0 commit comments

Comments
 (0)