mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 13:20:44 +00:00
Merge pull request #258 from NotAShelf/plugin/chatgpt
assistant/chatgpt: Add jackMort/ChatGPT.nvim
This commit is contained in:
commit
64c7e428de
7 changed files with 108 additions and 20 deletions
|
@ -227,6 +227,7 @@ inputs: let
|
|||
};
|
||||
|
||||
assistant = {
|
||||
chatgpt.enable = isMaximal;
|
||||
copilot = {
|
||||
enable = isMaximal;
|
||||
cmp.enable = isMaximal;
|
||||
|
|
|
@ -41,23 +41,26 @@ vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap =
|
|||
|
||||
[ksonj](https://github.com/ksonj):
|
||||
|
||||
- Add Terraform language support
|
||||
- Added Terraform language support.
|
||||
|
||||
- Added `ChatGPT.nvim`, which can be enabled with [`vim.assistant.chatgpt`](vim.assistant.chatgpt). Do
|
||||
keep in mind that this option requires `OPENAI_API_KEY` environment variable to be set.
|
||||
|
||||
[donnerinoern](https://github.com/donnerinoern):
|
||||
|
||||
- Added Gruvbox theme
|
||||
- Added Gruvbox theme.
|
||||
|
||||
- Added marksman LSP for Markdown
|
||||
- Added marksman LSP for Markdown.
|
||||
|
||||
- Fixed markdown preview with Glow not working and added an option for changing the preview keybind
|
||||
- Fixed markdown preview with Glow not working and added an option for changing the preview keybind.
|
||||
|
||||
- colorizer.nvim: switched to a maintained fork
|
||||
- colorizer.nvim: switched to a maintained fork.
|
||||
|
||||
- Added `markdown-preview.nvim`, moved `glow.nvim` to a brand new `vim.utility.preview` category.
|
||||
|
||||
[elijahimmer](https://github.com/elijahimmer)
|
||||
|
||||
- Added rose-pine theme
|
||||
- Added rose-pine theme.
|
||||
|
||||
[jacekpoz](https://github.com/jacekpoz):
|
||||
|
||||
|
@ -65,13 +68,13 @@ vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap =
|
|||
|
||||
[horriblename](https://github.com/horriblename):
|
||||
|
||||
- Fixed empty winbar when breadcrumbs are disabled
|
||||
- Fixed empty winbar when breadcrumbs are disabled.
|
||||
|
||||
- Added custom `setupOpts` for various plugins
|
||||
- Added custom `setupOpts` for various plugins.
|
||||
|
||||
- Removed support for deprecated plugin "nvim-compe"
|
||||
- Removed support for deprecated plugin "nvim-compe".
|
||||
|
||||
- Moved most plugins to `setupOpts` method
|
||||
- Moved most plugins to `setupOpts` method.
|
||||
|
||||
[frothymarrow](https://github.com/frothymarrow):
|
||||
|
||||
|
@ -81,35 +84,36 @@ vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap =
|
|||
been removed in favor of [vim.fidget-nvim.notification.window.align](vim.fidget-nvim.notification.window.align), which now supports
|
||||
`top` and `bottom` values. `vim.fidget-nvim.align.right` has no longer any equivalent and also has been removed.
|
||||
|
||||
- `which-key.nvim` categories can now be customized through [vim.binds.whichKey.register](vim.binds.whichKey.register).
|
||||
- `which-key.nvim` categories can now be customized through [vim.binds.whichKey.register](vim.binds.whichKey.register)
|
||||
|
||||
- Added `magick` to `vim.luaPackages` for `image.nvim`
|
||||
- Added `magick` to `vim.luaPackages` for `image.nvim`.
|
||||
|
||||
- Added `alejandra` to the default devShell.
|
||||
|
||||
- Migrated neovim-flake to `makeNeovimUnstable` wrapper
|
||||
- Migrated neovim-flake to `makeNeovimUnstable` wrapper.
|
||||
|
||||
[notashelf](https://github.com/notashelf):
|
||||
|
||||
- Finished moving to `nixosOptionsDoc` in the documentation and changelog. We are fully free of asciidoc now
|
||||
- Finished moving to `nixosOptionsDoc` in the documentation and changelog. All documentation options
|
||||
and files are fully free of Asciidoc, and will now use Nixpkgs flavored markdown.
|
||||
|
||||
- Bumped plugin inputs to their latest versions
|
||||
- Bumped plugin inputs to their latest versions.
|
||||
|
||||
- Deprecated `presence.nvim` in favor of `neocord`. This means `vim.rich-presence.presence-nvim` is removed and will throw
|
||||
a warning if used. You are recommended to rewrite your neocord configuration from scratch based on the
|
||||
a warning if used. You are recommended to rewrite your neocord configuration from scratch based on the.
|
||||
[official documentation](https://github.com/IogaMaster/neocord)
|
||||
|
||||
- Removed Tabnine plugin due to the usage of imperative tarball downloads. If you'd like to see it back, please make an issue.
|
||||
- Removed Tabnine plugin due to the usage of imperative tarball downloads. If you'd like to see it back, please create an issue.
|
||||
|
||||
- Added support for css and tailwindcss through vscode-language-servers-extracted & tailwind-language-server.
|
||||
Those can be enabled through `vim.languages.css` and `vim.languages.tailwind`
|
||||
Those can be enabled through `vim.languages.css` and `vim.languages.tailwind`.
|
||||
|
||||
- Lualine module now allows customizing `always_divide_middle`, `ignore_focus` and `disabled_filetypes` through the new
|
||||
options: [vim.statusline.lualine.alwaysDivideMiddle](vim.statusline.lualine.alwaysDivideMiddle),
|
||||
[vim.statusline.lualine.ignoreFocus](vim.statusline.lualine.ignoreFocus) and
|
||||
[vim.statusline.lualine.disabledFiletypes](vim.statusline.lualine.disabledFiletypes)
|
||||
[vim.statusline.lualine.disabledFiletypes](vim.statusline.lualine.disabledFiletypes).
|
||||
|
||||
- Updated all plugin inputs to their latest versions (**14.04.2024**) - this brought minor color changes to the Catppuccin
|
||||
- Updated all plugin inputs to their latest versions (**21.04.2024**) - this brought minor color changes to the Catppuccin
|
||||
theme.
|
||||
|
||||
- Moved home-manager module entrypoint to `flake/modules` and added an experimental Nixos module. This requires further testing
|
||||
|
|
|
@ -550,6 +550,11 @@
|
|||
};
|
||||
|
||||
# Assistant
|
||||
plugin-chatgpt = {
|
||||
url = "github:jackMort/ChatGPT.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-copilot-lua = {
|
||||
url = "github:zbirenbaum/copilot.lua";
|
||||
flake = false;
|
||||
|
|
25
modules/plugins/assistant/chatgpt/chatgpt.nix
Normal file
25
modules/plugins/assistant/chatgpt/chatgpt.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
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";
|
||||
grammarCorrection = mkMappingOption "[ChatGPT] Grammar correction" "<leader>ag";
|
||||
translate = mkMappingOption "[ChatGPT] Translate" "<leader>at";
|
||||
keyword = mkMappingOption "[ChatGPT] Keywords" "<leader>ak";
|
||||
docstring = mkMappingOption "[ChatGPT] Docstring" "<leader>ad";
|
||||
addTests = mkMappingOption "[ChatGPT] Add tests" "<leader>aa";
|
||||
optimize = mkMappingOption "[ChatGPT] Optimize code" "<leader>ao";
|
||||
summarize = mkMappingOption "[ChatGPT] Summarize" "<leader>as";
|
||||
fixBugs = mkMappingOption "[ChatGPT] Fix bugs" "<leader>af";
|
||||
explain = mkMappingOption "[ChatGPT] Explain code" "<leader>ax";
|
||||
roxygenEdit = mkMappingOption "[ChatGPT] Roxygen edit" "<leader>ar";
|
||||
readabilityanalysis = mkMappingOption "[ChatGPT] Code reability analysis" "<leader>al";
|
||||
};
|
||||
};
|
||||
}
|
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;
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/assistant/chatgpt/default.nix
Normal file
6
modules/plugins/assistant/chatgpt/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./chatgpt.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./chatgpt
|
||||
./copilot
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue