mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-03 17:37:14 +00:00
Use mkPluginSetupOption for plugin config
This commit is contained in:
parent
a6dc729e90
commit
77436fd51c
2 changed files with 10 additions and 5 deletions
|
|
@ -1,9 +1,14 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib) mkMappingOption;
|
||||
{
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib) mkMappingOption types;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.assistant.chatgpt = {
|
||||
enable = mkEnableOption "ChatGPT AI assistant. Requires the environment variable OPENAI_API_KEY to be set";
|
||||
setupOpts = mkPluginSetupOption "chatgpt" {};
|
||||
mappings = {
|
||||
chatGpt = mkMappingOption "ChatGPT" "<leader>ac";
|
||||
editWithInstructions = mkMappingOption "[ChatGPT] Edit with instructions" "<leader>ae";
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib) addDescriptionsToMappings mkSetBinding;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.assistant.chatgpt;
|
||||
|
||||
|
|
@ -33,8 +34,7 @@ in {
|
|||
"chatgpt"
|
||||
];
|
||||
luaConfigRC.chagpt = entryAnywhere ''
|
||||
require("chatgpt").setup({
|
||||
})
|
||||
require("chatgpt").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
maps.normal = mkMerge [
|
||||
(mkSetBinding mappings.chatGpt "<cmd>ChatGPT<CR>")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue