mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 11:02:37 +00:00 
			
		
		
		
	assistant: add avante.nvim plugin
This commit is contained in:
		
					parent
					
						
							
								4045c458dc
							
						
					
				
			
			
				commit
				
					
						72c5c7f634
					
				
			
		
					 6 changed files with 430 additions and 0 deletions
				
			
		|  | @ -344,3 +344,10 @@ | ||||||
| [howird](https://github.com/howird): | [howird](https://github.com/howird): | ||||||
| 
 | 
 | ||||||
| - Change python dap adapter name from `python` to commonly expected `debugpy`. | - Change python dap adapter name from `python` to commonly expected `debugpy`. | ||||||
|  | 
 | ||||||
|  | [aionoid](https://github.com/aionoid): | ||||||
|  | 
 | ||||||
|  | [avante-nvim]: https://github.com/yetone/avante.nvim | ||||||
|  | 
 | ||||||
|  | - Add [avante.nvim] plugin under `vim.assistant.avante-nvim`. | ||||||
|  | - Fix [render-markdown.nvim] file_types option type to list, to accept merging. | ||||||
|  |  | ||||||
							
								
								
									
										359
									
								
								modules/plugins/assistant/avante/avante-nvim.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										359
									
								
								modules/plugins/assistant/avante/avante-nvim.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,359 @@ | ||||||
|  | {lib, ...}: let | ||||||
|  |   inherit (lib.options) mkOption mkEnableOption literalMD; | ||||||
|  |   inherit (lib.types) int str enum nullOr attrs either; | ||||||
|  |   inherit (lib.nvim.types) mkPluginSetupOption luaInline; | ||||||
|  | in { | ||||||
|  |   options.vim.assistant = { | ||||||
|  |     avante-nvim = { | ||||||
|  |       enable = mkEnableOption "complementary neovim plugin for avante.nvim"; | ||||||
|  |       setupOpts = mkPluginSetupOption "avante-nvim" { | ||||||
|  |         provider = mkOption { | ||||||
|  |           type = nullOr str; | ||||||
|  |           default = null; | ||||||
|  |           description = "The provider used in Aider mode or in the planning phase of Cursor Planning Mode."; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         vendors = mkOption { | ||||||
|  |           type = nullOr attrs; | ||||||
|  |           default = null; | ||||||
|  |           description = "Define Your Custom providers."; | ||||||
|  |           example = literalMD '' | ||||||
|  |             ```nix | ||||||
|  |             ollama = { | ||||||
|  |               __inherited_from = "openai"; | ||||||
|  |               api_key_name = ""; | ||||||
|  |               endpoint = "http://127.0.0.1:11434/v1"; | ||||||
|  |               model = "qwen2.5u-coder:7b"; | ||||||
|  |               max_tokens = 4096; | ||||||
|  |               disable_tools = true; | ||||||
|  |             }; | ||||||
|  |             ollama_ds = { | ||||||
|  |               __inherited_from = "openai"; | ||||||
|  |               api_key_name = ""; | ||||||
|  |               endpoint = "http://127.0.0.1:11434/v1"; | ||||||
|  |               model = "deepseek-r1u:7b"; | ||||||
|  |               max_tokens = 4096; | ||||||
|  |               disable_tools = true; | ||||||
|  |             }; | ||||||
|  |             ``` | ||||||
|  |           ''; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         auto_suggestions_provider = mkOption { | ||||||
|  |           type = str; | ||||||
|  |           default = "claude"; | ||||||
|  |           description = '' | ||||||
|  |             Since auto-suggestions are a high-frequency operation and therefore expensive, | ||||||
|  |             currently designating it as `copilot` provider is dangerous because: https://github.com/yetone/avante.nvim/issues/1048 | ||||||
|  |             Of course, you can reduce the request frequency by increasing `suggestion.debounce`. | ||||||
|  |           ''; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         cursor_applying_provider = mkOption { | ||||||
|  |           type = nullOr str; | ||||||
|  |           default = null; | ||||||
|  |           description = '' | ||||||
|  |             The provider used in the applying phase of Cursor Planning Mode, defaults to nil, | ||||||
|  |             when nil uses Config.provider as the provider for the applying phase | ||||||
|  |           ''; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         dual_boost = { | ||||||
|  |           enabled = | ||||||
|  |             mkEnableOption "" | ||||||
|  |             // { | ||||||
|  |               default = false; | ||||||
|  |               description = '' | ||||||
|  |                 enable/disable dual boost. | ||||||
|  |               ''; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |           first_provider = mkOption { | ||||||
|  |             type = str; | ||||||
|  |             default = "openai"; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           second_provider = mkOption { | ||||||
|  |             type = str; | ||||||
|  |             default = "claude"; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           prompt = mkOption { | ||||||
|  |             type = str; | ||||||
|  |             default = "Based on the two reference outputs below, generate a response that incorporates elements from both but reflects your own judgment and unique perspective. Do not provide any explanation, just give the response directly. Reference Output 1: [{{provider1_output}}], Reference Output 2: [{{provider2_output}}]"; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           timeout = mkOption { | ||||||
|  |             type = int; | ||||||
|  |             default = 60000; | ||||||
|  |             description = "Timeout in milliseconds."; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         behaviour = { | ||||||
|  |           auto_suggestions = | ||||||
|  |             mkEnableOption "" | ||||||
|  |             // { | ||||||
|  |               default = false; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |           auto_set_highlight_group = | ||||||
|  |             mkEnableOption "" | ||||||
|  |             // { | ||||||
|  |               default = true; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |           auto_set_keymaps = | ||||||
|  |             mkEnableOption "" | ||||||
|  |             // { | ||||||
|  |               default = true; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |           auto_apply_diff_after_generation = | ||||||
|  |             mkEnableOption "" | ||||||
|  |             // { | ||||||
|  |               default = false; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |           support_paste_from_clipboard = | ||||||
|  |             mkEnableOption "" | ||||||
|  |             // { | ||||||
|  |               default = false; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |           minimize_diff = | ||||||
|  |             mkEnableOption "" | ||||||
|  |             // { | ||||||
|  |               default = true; | ||||||
|  |               description = "Whether to remove unchanged lines when applying a code block."; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |           enable_token_counting = | ||||||
|  |             mkEnableOption "" | ||||||
|  |             // { | ||||||
|  |               default = true; | ||||||
|  |               description = "Whether to enable token counting. Default to true."; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |           enable_cursor_planning_mode = | ||||||
|  |             mkEnableOption "" | ||||||
|  |             // { | ||||||
|  |               default = false; | ||||||
|  |               description = "Whether to enable Cursor Planning Mode. Default to false."; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |           enable_claude_text_editor_tool_mode = | ||||||
|  |             mkEnableOption "" | ||||||
|  |             // { | ||||||
|  |               default = false; | ||||||
|  |               description = "Whether to enable Claude Text Editor Tool Mode."; | ||||||
|  |             }; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         mappings = { | ||||||
|  |           diff = mkOption { | ||||||
|  |             type = nullOr attrs; | ||||||
|  |             default = null; | ||||||
|  |             description = "Define or override the default keymaps for diff."; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           suggestion = mkOption { | ||||||
|  |             type = nullOr attrs; | ||||||
|  |             default = null; | ||||||
|  |             description = "Define or override the default keymaps for suggestion actions."; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           jump = mkOption { | ||||||
|  |             type = nullOr attrs; | ||||||
|  |             default = null; | ||||||
|  |             description = "Define or override the default keymaps for jump actions."; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           submit = mkOption { | ||||||
|  |             type = nullOr attrs; | ||||||
|  |             default = null; | ||||||
|  |             description = "Define or override the default keymaps for submit actions."; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           cancel = mkOption { | ||||||
|  |             type = nullOr attrs; | ||||||
|  |             default = null; | ||||||
|  |             description = "Define or override the default keymaps for cancel actions."; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           sidebar = mkOption { | ||||||
|  |             type = nullOr attrs; | ||||||
|  |             default = null; | ||||||
|  |             description = "Define or override the default keymaps for sidebar actions."; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         hints.enabled = | ||||||
|  |           mkEnableOption "" | ||||||
|  |           // { | ||||||
|  |             default = true; | ||||||
|  |             description = '' | ||||||
|  |               Whether to enable hints. | ||||||
|  |             ''; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |         windows = { | ||||||
|  |           position = mkOption { | ||||||
|  |             type = enum ["right" "left" "top" "bottom"]; | ||||||
|  |             default = "right"; | ||||||
|  |             description = "The position of the sidebar."; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           wrap = | ||||||
|  |             mkEnableOption "" | ||||||
|  |             // { | ||||||
|  |               default = true; | ||||||
|  |               description = '' | ||||||
|  |                 similar to vim.o.wrap. | ||||||
|  |               ''; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |           width = mkOption { | ||||||
|  |             type = int; | ||||||
|  |             default = 30; | ||||||
|  |             description = "Default % based on available width."; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           sidebar_header = { | ||||||
|  |             enabled = | ||||||
|  |               mkEnableOption "" | ||||||
|  |               // { | ||||||
|  |                 default = true; | ||||||
|  |                 description = '' | ||||||
|  |                   enable/disable the header. | ||||||
|  |                 ''; | ||||||
|  |               }; | ||||||
|  | 
 | ||||||
|  |             align = mkOption { | ||||||
|  |               type = enum ["right" "center" "left"]; | ||||||
|  |               default = "center"; | ||||||
|  |               description = "Position of the title."; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             rounded = | ||||||
|  |               mkEnableOption "" | ||||||
|  |               // { | ||||||
|  |                 default = true; | ||||||
|  |               }; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           input = { | ||||||
|  |             prefix = mkOption { | ||||||
|  |               type = str; | ||||||
|  |               default = "> "; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             height = mkOption { | ||||||
|  |               type = int; | ||||||
|  |               default = 8; | ||||||
|  |               description = '' | ||||||
|  |                 Height of the input window in vertical layout. | ||||||
|  |               ''; | ||||||
|  |             }; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           edit = { | ||||||
|  |             border = mkOption { | ||||||
|  |               type = str; | ||||||
|  |               default = "rounded"; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             start_insert = | ||||||
|  |               mkEnableOption "" | ||||||
|  |               // { | ||||||
|  |                 default = true; | ||||||
|  |                 description = '' | ||||||
|  |                   Start insert mode when opening the edit window. | ||||||
|  |                 ''; | ||||||
|  |               }; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           ask = { | ||||||
|  |             floating = | ||||||
|  |               mkEnableOption "" | ||||||
|  |               // { | ||||||
|  |                 default = false; | ||||||
|  |                 description = '' | ||||||
|  |                   Open the 'AvanteAsk' prompt in a floating window. | ||||||
|  |                 ''; | ||||||
|  |               }; | ||||||
|  | 
 | ||||||
|  |             start_insert = | ||||||
|  |               mkEnableOption "" | ||||||
|  |               // { | ||||||
|  |                 default = true; | ||||||
|  |                 description = '' | ||||||
|  |                   Start insert mode when opening the ask window. | ||||||
|  |                 ''; | ||||||
|  |               }; | ||||||
|  | 
 | ||||||
|  |             border = mkOption { | ||||||
|  |               type = str; | ||||||
|  |               default = "rounded"; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             focus_on_apply = mkOption { | ||||||
|  |               type = enum ["ours" "theirs"]; | ||||||
|  |               default = "ours"; | ||||||
|  |               description = "which diff to focus after applying."; | ||||||
|  |             }; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         highlights = { | ||||||
|  |           diff = { | ||||||
|  |             current = mkOption { | ||||||
|  |               type = str; | ||||||
|  |               default = "DiffText"; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             incoming = mkOption { | ||||||
|  |               type = str; | ||||||
|  |               default = "DiffAdd"; | ||||||
|  |             }; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         diff = { | ||||||
|  |           autojump = | ||||||
|  |             mkEnableOption "" | ||||||
|  |             // { | ||||||
|  |               default = true; | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |           list_opener = mkOption { | ||||||
|  |             type = either str luaInline; | ||||||
|  |             default = "copen"; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           override_timeoutlen = mkOption { | ||||||
|  |             type = int; | ||||||
|  |             default = 500; | ||||||
|  |             description = '' | ||||||
|  |               Override the 'timeoutlen' setting while hovering over a diff (see :help timeoutlen). | ||||||
|  |               Helps to avoid entering operator-pending mode with diff mappings starting with `c`. | ||||||
|  |               Disable by setting to -1. | ||||||
|  |             ''; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         suggestion = { | ||||||
|  |           debounce = mkOption { | ||||||
|  |             type = int; | ||||||
|  |             default = 600; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|  |           throttle = mkOption { | ||||||
|  |             type = int; | ||||||
|  |             default = 600; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
							
								
								
									
										44
									
								
								modules/plugins/assistant/avante/config.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								modules/plugins/assistant/avante/config.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,44 @@ | ||||||
|  | { | ||||||
|  |   pkgs, | ||||||
|  |   config, | ||||||
|  |   lib, | ||||||
|  |   ... | ||||||
|  | }: let | ||||||
|  |   inherit (lib.modules) mkIf; | ||||||
|  | 
 | ||||||
|  |   cfg = config.vim.assistant.avante-nvim; | ||||||
|  | in { | ||||||
|  |   config = mkIf cfg.enable { | ||||||
|  |     vim = { | ||||||
|  |       startPlugins = [ | ||||||
|  |         "plenary-nvim" | ||||||
|  |         "dressing-nvim" | ||||||
|  |         "nui-nvim" | ||||||
|  |       ]; | ||||||
|  | 
 | ||||||
|  |       lazy.plugins = { | ||||||
|  |         "avante.nvim" = with pkgs.vimPlugins; { | ||||||
|  |           package = avante-nvim; | ||||||
|  |           setupModule = "avante"; | ||||||
|  |           inherit (cfg) setupOpts; | ||||||
|  |           after = | ||||||
|  |             /* | ||||||
|  |             lua | ||||||
|  |             */ | ||||||
|  |             '' | ||||||
|  |               vim.opt.laststatus = 3 | ||||||
|  |             ''; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       treesitter.enable = true; | ||||||
|  | 
 | ||||||
|  |       autocomplete.nvim-cmp = { | ||||||
|  |         sources = {"avante.nvim" = "[avante]";}; | ||||||
|  |         sourcePlugins = ["avante-nvim"]; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       languages.markdown.extensions.render-markdown-nvim.setupOpts.file_types = lib.mkAfter ["Avante"]; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
							
								
								
									
										6
									
								
								modules/plugins/assistant/avante/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								modules/plugins/assistant/avante/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | ||||||
|  | { | ||||||
|  |   imports = [ | ||||||
|  |     ./config.nix | ||||||
|  |     ./avante-nvim.nix | ||||||
|  |   ]; | ||||||
|  | } | ||||||
|  | @ -3,5 +3,6 @@ | ||||||
|     ./chatgpt |     ./chatgpt | ||||||
|     ./copilot |     ./copilot | ||||||
|     ./codecompanion |     ./codecompanion | ||||||
|  |     ./avante | ||||||
|   ]; |   ]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,19 @@ | ||||||
|       "url": "https://github.com/goolord/alpha-nvim/archive/de72250e054e5e691b9736ee30db72c65d560771.tar.gz", |       "url": "https://github.com/goolord/alpha-nvim/archive/de72250e054e5e691b9736ee30db72c65d560771.tar.gz", | ||||||
|       "hash": "0c1jkhxamfn2md7m1r5b2wpxa26y90b98yzjwf68m3fymalvkn5h" |       "hash": "0c1jkhxamfn2md7m1r5b2wpxa26y90b98yzjwf68m3fymalvkn5h" | ||||||
|     }, |     }, | ||||||
|  |     "avante-nvim": { | ||||||
|  |       "type": "Git", | ||||||
|  |       "repository": { | ||||||
|  |         "type": "GitHub", | ||||||
|  |         "owner": "yetone", | ||||||
|  |         "repo": "avante.nvim" | ||||||
|  |       }, | ||||||
|  |       "branch": "main", | ||||||
|  |       "submodules": false, | ||||||
|  |       "revision": "eb1cd44731783024621beafe4e46204cbc9a4320", | ||||||
|  |       "url": "https://github.com/yetone/avante.nvim/archive/eb1cd44731783024621beafe4e46204cbc9a4320.tar.gz", | ||||||
|  |       "hash": "1hdb1b74mxq6j10fv0zh6fniwpijwbxjxc59k7xzkqj6q20lad07" | ||||||
|  |     }, | ||||||
|     "base16": { |     "base16": { | ||||||
|       "type": "Git", |       "type": "Git", | ||||||
|       "repository": { |       "repository": { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Farouk Brown
				Farouk Brown