mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-09 03:25:58 +01:00
f9789432f9
* modules: switch to gerg's neovim-wrapper * modules: use initViml instead of writing the file * treewide: make the entire generated config lua based * docs: remove mentions of configRC * plugins/treesitter: remove vim.cmd hack * treewide: move resolveDag to lib * modules/wrapper(rc): fix typo * treewide: migrate to pluginRC for correct DAG order The "new" DAG order is as follows: - (luaConfigPre) - globalsScript - basic - theme - pluginConfigs - extraPluginConfigs - mappings - (luaConfigPost) * plugins/theme: fix theme DAG place * plugins/theme: fix fixed theme DAG place * modules/wrapper(rc): add removed option module for configRC * docs: add dag-entries chapter, add release note entry * fix: formatting CI * languages/nix: add missing `local` * docs: fix page link * docs: add mention of breaking changes at the start of the release notes * plugins/neo-tree: convert to pluginRC * modules/wrapper(rc): add back entryAnywhere * modules/wrapper(rc): expose pluginRC * apply raf patch --------- Co-authored-by: NotAShelf <raf@notashelf.dev>
46 lines
1.7 KiB
Nix
46 lines
1.7 KiB
Nix
{
|
|
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"
|
|
];
|
|
pluginRC.chagpt = entryAnywhere ''
|
|
require("chatgpt").setup(${toLuaObject cfg.setupOpts})
|
|
'';
|
|
maps.normal = mkMerge [
|
|
(mkSetBinding mappings.chatGpt "<cmd>ChatGPT<CR>")
|
|
maps
|
|
];
|
|
maps.visual = maps;
|
|
};
|
|
};
|
|
}
|