Skip to content

Commit 02f4bc1

Browse files
author
Zhe Yu
committed
docs(nvim): Document customisable prompt library for Neovim
1 parent f511023 commit 02f4bc1

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

docs/neovim/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# NeoVim Plugin
2+
23
> [!NOTE]
34
> This plugin depends on the CLI tool. Please go through
45
> [the CLI documentation](../cli/README.md) and make sure the VectorCode CLI is working
@@ -298,6 +299,8 @@ require('codecompanion').setup{
298299
["Neovim Tutor"] = {
299300
project_root = vim.env.VIMRUNTIME,
300301
file_patterns = { "lua/**/*.lua", "doc/**/*.txt" },
302+
-- system_prompt = ...,
303+
-- user_prompt = ...,
301304
},
302305
},
303306
}
@@ -307,6 +310,19 @@ require('codecompanion').setup{
307310
}
308311
```
309312

313+
The `prompt_library` option is a mapping of prompt name (`string`) to a lua table
314+
(type annotation available) that contains some information used to generate the
315+
embeddings:
316+
317+
- `project_root`: `string`, the path to the directory (for example,
318+
`/usr/share/nvim/runtime/`);
319+
- `file_patterns`: `string[]`, file name patterns that defines files to be vectorised.
320+
You should either use absolute paths or relative paths from the project root;
321+
- `system_prompt` and `user_prompt`: `string|fun(context:table):string|nil`:
322+
These options allow you to customise the prompts. See
323+
[codecompanion.nvim documentation](https://codecompanion.olimorris.dev/extending/prompts#recipe-2-using-context-in-your-prompts)
324+
if you want to use a function here that build the prompts from the context.
325+
310326
The first time will take some extra time for computing the embeddings, but the
311327
subsequent runs should be a lot faster.
312328

0 commit comments

Comments
 (0)