From 47ea181a3b99aef4a9be10e31f3d12ddbcde54b2 Mon Sep 17 00:00:00 2001 From: Martin Bielik Date: Sat, 9 Mar 2024 22:07:40 +0100 Subject: roles docu --- doc/vim-ai.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'doc/vim-ai.txt') diff --git a/doc/vim-ai.txt b/doc/vim-ai.txt index 72535b3..5d06fc7 100644 --- a/doc/vim-ai.txt +++ b/doc/vim-ai.txt @@ -161,6 +161,22 @@ You can also customize the options in the chat header: > generate a paragraph of lorem ipsum ... +ROLES + +Roles are defined in the `.ini` file: > + + let g:vim_ai_roles_config_file = '/path/to/my/roles.ini' + +Example of a role: > + + [grammar] + prompt = fix spelling and grammar + + [grammar.options] + temperature = 0.4 + +See roles-example.ini for more examples. + KEY BINDINGS Examples how configure key bindings and customize commands: > -- cgit v1.2.3 From 881fd24a6d2c0de387256b4d6e05f5d0a53cc8e2 Mon Sep 17 00:00:00 2001 From: Konfekt Date: Sun, 10 Mar 2024 21:29:32 +0100 Subject: optionally supplement roles dict by vim function source The application was restricted to loading role configurations only from a predefined config file, which limited extensibility. Enable dynamic role configuration by invoking a custom Vim function if it is defined. This allows users to extend the role configurations beyond the static file. diff --git a/doc/vim-ai.txt b/doc/vim-ai.txt: -The roles in g:vim_ai_roles_config_file are converted to a Vim dictionary. -Optionally, additional roles can be added by defining a function VimAIRoleParser() -whose output is a dictionary of the same format as g:vim_ai_roles_config_file. - diff --git a/py/roles.py b/py/roles.py: -if vim.eval('exists("*VimAIRoleParser")'): - roles.update(vim.eval('VimAIRoleParser()')) - diff --git a/py/utils.py b/py/utils.py: - if vim.eval('exists("*VimAIRoleParser")'): - roles.update(vim.eval('VimAIRoleParser()')) - --- doc/vim-ai.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'doc/vim-ai.txt') diff --git a/doc/vim-ai.txt b/doc/vim-ai.txt index 5d06fc7..c7aefde 100644 --- a/doc/vim-ai.txt +++ b/doc/vim-ai.txt @@ -177,6 +177,11 @@ Example of a role: > See roles-example.ini for more examples. +The roles in g:vim_ai_roles_config_file are converted to a Vim dictionary whose +labels are the names of the roles. Optionally, roles can be added by setting +g:vim_ai_roles_config_function to the name of a Vimscript function returning a +dictionary of the same format as g:vim_ai_roles_config_file. + KEY BINDINGS Examples how configure key bindings and customize commands: > -- cgit v1.2.3