mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-07 19:01:35 +00:00
assistant/chatgpt: Add jackMort/ChatGPT.nvim
This commit is contained in:
parent
50609c731e
commit
140ed6daa8
6 changed files with 84 additions and 0 deletions
46
modules/plugins/assistant/chatgpt/config.nix
Normal file
46
modules/plugins/assistant/chatgpt/config.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.assistant.chatgpt;
|
||||
|
||||
self = import ./chatgpt.nix {inherit lib;};
|
||||
mappingDefinitions = self.options.vim.assistant.chatgpt.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
maps = mkMerge [
|
||||
(mkSetBinding mappings.editWithInstructions "<cmd>ChatGPTEditWithInstruction<CR>")
|
||||
(mkSetBinding mappings.grammarCorrection "<cmd>ChatGPTRun grammar_correction<CR>")
|
||||
(mkSetBinding mappings.translate "<cmd>ChatGPTRun translate<CR>")
|
||||
(mkSetBinding mappings.keyword "<cmd>ChatGPTRun keywords<CR>")
|
||||
(mkSetBinding mappings.docstring "<cmd>ChatGPTRun docstring<CR>")
|
||||
(mkSetBinding mappings.addTests "<cmd>ChatGPTRun add_tests<CR>")
|
||||
(mkSetBinding mappings.optimize "<cmd>ChatGPTRun optimize_code<CR>")
|
||||
(mkSetBinding mappings.summarize "<cmd>ChatGPTRun summarize<CR>")
|
||||
(mkSetBinding mappings.fixBugs "<cmd>ChatGPTRun fix_bugs<CR>")
|
||||
(mkSetBinding mappings.explain "<cmd>ChatGPTRun explain_code<CR>")
|
||||
(mkSetBinding mappings.roxygenEdit "<cmd>ChatGPTRun roxygen_edit<CR>")
|
||||
(mkSetBinding mappings.readabilityanalysis "<cmd>ChatGPTRun code_readability_analysis<CR>")
|
||||
];
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"chatgpt"
|
||||
];
|
||||
luaConfigRC.chagpt = entryAnywhere ''
|
||||
require("chatgpt").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
maps.normal = mkMerge [
|
||||
(mkSetBinding mappings.chatGpt "<cmd>ChatGPT<CR>")
|
||||
maps
|
||||
];
|
||||
maps.visual = maps;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue