File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,47 @@ You can define custom contexts like this:
246
246
}
247
247
```
248
248
249
+ ### Selections
250
+
251
+ Selections are used to determine the source of the chat (so basically what to chat about).
252
+ Selections are configurable either by default or by prompt.
253
+ Default selection is ` visual ` or ` buffer ` (if no visual selection).
254
+ Default supported selections are:
255
+
256
+ - ` select.visual ` - Includes visual selection in chat context.
257
+ - ` select.buffer ` - Includes entire buffer in chat context.
258
+ - ` select.line ` - Includes current line in chat context.
259
+ - ` select.unnamed ` - Includes unnamed register in chat context.
260
+ - ` select.clipboard ` - Includes clipboard in chat context.
261
+
262
+ You can define custom selection functions like this:
263
+
264
+ ``` lua
265
+ {
266
+ selection = function ()
267
+ -- Get content from * register
268
+ local lines = vim .fn .getreg (' *' )
269
+ if not lines or lines == ' ' then
270
+ return nil
271
+ end
272
+
273
+ return {
274
+ lines = lines ,
275
+ }
276
+ end
277
+ }
278
+ ```
279
+
280
+ Or chain multiple selections like this:
281
+
282
+ ``` lua
283
+ {
284
+ selection = function (source )
285
+ return select .visual (source ) or select .buffer (source )
286
+ end
287
+ }
288
+ ```
289
+
249
290
### API
250
291
251
292
``` lua
You can’t perform that action at this time.
0 commit comments