From ab1ea1799d8a86e377a62691b2f3c8aa73a334dd Mon Sep 17 00:00:00 2001 From: milanglacier Date: Mon, 17 Feb 2025 02:34:12 -0500 Subject: [PATCH] doc: add minuet-ai.nvim, a code completion plugin for neovim. (#248) --- README.md | 5 + README_cn.md | 5 + docs/minuet-ai.nvim/README.md | 182 +++++++++++++++++++++++++++++++ docs/minuet-ai.nvim/README_cn.md | 172 +++++++++++++++++++++++++++++ 4 files changed, 364 insertions(+) create mode 100644 docs/minuet-ai.nvim/README.md create mode 100644 docs/minuet-ai.nvim/README_cn.md diff --git a/README.md b/README.md index 999f5fc..fd9d8e3 100644 --- a/README.md +++ b/README.md @@ -427,6 +427,11 @@ English/[简体中文](https://github.com/deepseek-ai/awesome-deepseek-integrati codecompanion.nvim AI-powered coding, seamlessly in Neovim. + + Icon + minuet-ai.nvim + Minuet offers code completion as-you-type from popular LLMs including Deepseek, OpenAI, Gemini, Claude, Ollama, Codestral, and more. + ### JetBrains Extensions diff --git a/README_cn.md b/README_cn.md index ef22bf6..0690aff 100644 --- a/README_cn.md +++ b/README_cn.md @@ -306,6 +306,11 @@ llm.nvim 免费的大语言模型插件,让你在Neovim中与大模型交互,支持任意一款大模型,比如Deepseek,GPT,GLM,kimi或者本地运行的大模型(比如ollama) + + Icon + minuet-ai.nvim + Minuet 提供实时代码补全功能,支持多个主流大语言模型,包括 Deepseek、OpenAI、Gemini、Claude、Ollama、Codestral 等。 + Icon codecompanion.nvim diff --git a/docs/minuet-ai.nvim/README.md b/docs/minuet-ai.nvim/README.md new file mode 100644 index 0000000..a0386bf --- /dev/null +++ b/docs/minuet-ai.nvim/README.md @@ -0,0 +1,182 @@ + +# Minuet AI + +Minuet AI: Dance with Intelligence in Your Code 💃. + +`Minuet-ai` brings the grace and harmony of a minuet to your coding process. +Just as dancers move during a minuet. + +# Features + +- AI-powered code completion with dual modes: + - Specialized prompts and various enhancements for chat-based LLMs on code completion tasks. + - Fill-in-the-middle (FIM) completion for compatible models (DeepSeek, + Codestral, Qwen, and others). +- Support for multiple AI providers (OpenAI, Claude, Gemini, Codestral, Ollama, and + OpenAI-compatible services). +- Customizable configuration options. +- Streaming support to enable completion delivery even with slower LLMs. +- Support `nvim-cmp`, `blink-cmp`, `virtual text` frontend. + +# Requirements + +- Neovim 0.10+. +- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) +- optional: [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) +- optional: [blink.cmp](https://github.com/Saghen/blink.cmp) +- An API key for at least one of the supported AI providers + +# Installation + +**Lazy.nvim**: + +```lua +specs = { + { + 'milanglacier/minuet-ai.nvim', + config = function() + require('minuet').setup { + -- Your configuration options here + } + end, + }, + { 'nvim-lua/plenary.nvim' }, + -- optional, if you are using virtual-text frontend, nvim-cmp is not + -- required. + { 'hrsh7th/nvim-cmp' }, + -- optional, if you are using virtual-text frontend, blink is not required. + { 'Saghen/blink.cmp' }, +} +``` + +**Rocks.nvim**: + +`Minuet` is available on luarocks.org. Simply run `Rocks install +minuet-ai.nvim` to install it like any other luarocks package. + +**Setting up with virtual text**: + +```lua +require('minuet').setup { + virtualtext = { + auto_trigger_ft = {}, + keymap = { + -- accept whole completion + accept = '', + -- accept one line + accept_line = '', + -- accept n lines (prompts for number) + -- e.g. "A-z 2 CR" will accept 2 lines + accept_n_lines = '', + -- Cycle to prev completion item, or manually invoke completion + prev = '', + -- Cycle to next completion item, or manually invoke completion + next = '', + dismiss = '', + }, + }, +} +``` + +**Setting up with nvim-cmp**: + +
+ +```lua +require('cmp').setup { + sources = { + { + -- Include minuet as a source to enable autocompletion + { name = 'minuet' }, + -- and your other sources + } + }, + performance = { + -- It is recommended to increase the timeout duration due to + -- the typically slower response speed of LLMs compared to + -- other completion sources. This is not needed when you only + -- need manual completion. + fetching_timeout = 2000, + }, +} + + +-- If you wish to invoke completion manually, +-- The following configuration binds `A-y` key +-- to invoke the configuration manually. +require('cmp').setup { + mapping = { + [""] = require('minuet').make_cmp_map() + -- and your other keymappings + }, +} +``` + +
+ +**Setting up with blink-cmp**: + +
+ +```lua +require('blink-cmp').setup { + keymap = { + -- Manually invoke minuet completion. + [''] = require('minuet').make_blink_map(), + }, + sources = { + -- Enable minuet for autocomplete + default = { 'lsp', 'path', 'buffer', 'snippets', 'minuet' }, + -- For manual completion only, remove 'minuet' from default + providers = { + minuet = { + name = 'minuet', + module = 'minuet.blink', + score_offset = 8, -- Gives minuet higher priority among suggestions + }, + }, + }, + -- Recommended to avoid unnecessary request + completion = { trigger = { prefetch_on_insert = false } }, +} +``` + +
+ +**LLM Provider Examples**: + +**Deepseek**: + +```lua +-- you can use deepseek with both openai_fim_compatible or openai_compatible provider +require('minuet').setup { + provider = 'openai_fim_compatible', + provider_options = { + openai_fim_compatible = { + api_key = 'DEEPSEEK_API_KEY', + name = 'deepseek', + optional = { + max_tokens = 256, + top_p = 0.9, + }, + }, + }, +} + + +-- or +require('minuet').setup { + provider = 'openai_compatible', + provider_options = { + openai_compatible = { + end_point = 'https://api.deepseek.com/v1/chat/completions', + api_key = 'DEEPSEEK_API_KEY', + name = 'deepseek', + optional = { + max_tokens = 256, + top_p = 0.9, + }, + }, + }, +} +``` diff --git a/docs/minuet-ai.nvim/README_cn.md b/docs/minuet-ai.nvim/README_cn.md new file mode 100644 index 0000000..31610dd --- /dev/null +++ b/docs/minuet-ai.nvim/README_cn.md @@ -0,0 +1,172 @@ +# Minuet AI + +Minuet AI:在您的代码中翩翩起舞,挥洒智能 💃。 + +`Minuet-ai` 将小步舞曲的优雅与和谐带入您的编码流程。正如舞者在小步舞曲中舞动一样。 + +# 特性 + +- 基于 AI 的代码补全,提供双重模式: + - 针对代码补全任务,为基于聊天的 LLMs 提供专门的提示和各种增强功能。 + - 针对兼容的模型(DeepSeek、Codestral、Qwen 等)提供中间填充 (FIM) 补全。 +- 支持多种 AI 提供商(OpenAI、Claude、Gemini、Codestral、Ollama 和兼容 OpenAI 的服务)。 +- 可自定义配置选项。 +- 支持流式传输,即使使用较慢的 LLMs 也能实现补全的交付。 +- 支持 `nvim-cmp`、`blink-cmp`、`virtual text` 前端。 + +# 要求 + +- Neovim 0.10+。 +- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) +- 可选: [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) +- 可选: [blink.cmp](https://github.com/Saghen/blink.cmp) +- 至少一个受支持的 AI 提供商的 API 密钥 + +# 安装 + +**Lazy.nvim:** + +```lua +specs = { + { + 'milanglacier/minuet-ai.nvim', + config = function() + require('minuet').setup { + -- 在此处配置您的选项 + } + end, + }, + { 'nvim-lua/plenary.nvim' }, + -- 可选,如果您使用 virtual-text 前端,则不需要 nvim-cmp。 + { 'hrsh7th/nvim-cmp' }, + -- 可选,如果您使用 virtual-text 前端,则不需要 blink。 + { 'Saghen/blink.cmp' }, +} +``` + +**Rocks.nvim:** + +`Minuet` 可在 luarocks.org 上获取。只需运行 `Rocks install minuet-ai.nvim` 即可像安装其他 luarocks 包一样安装它。 + +**使用 virtual text 进行设置:** + +```lua +require('minuet').setup { + virtualtext = { + auto_trigger_ft = {}, + keymap = { + -- 接受完整补全 + accept = '', + -- 接受一行 + accept_line = '', + -- 接受 n 行(提示输入数字) + -- 例如,“A-z 2 CR”将接受 2 行 + accept_n_lines = '', + -- 切换到上一个补全项,或手动调用补全 + prev = '', + -- 切换到下一个补全项,或手动调用补全 + next = '', + dismiss = '', + }, + }, +} +``` + +**使用 nvim-cmp 进行设置:** + +
+ +```lua +require('cmp').setup { + sources = { + { + -- 包含 minuet 作为源以启用自动补全 + { name = 'minuet' }, + -- 和您的其他来源 + } + }, + performance = { + -- 建议增加超时时间,因为与其他补全来源相比,LLMs 的响应速度通常较慢。如果您只需要手动补全,则不需要此设置。 + fetching_timeout = 2000, + }, +} + + +-- 如果你希望手动调用补全, +-- 以下配置将 `A-y` 键绑定到手动调用配置。 +require('cmp').setup { + mapping = { + [""] = require('minuet').make_cmp_map() + -- 和您的其他键映射 + }, +} +``` + +
+ +**使用 blink-cmp 进行设置:** + +
+ +```lua +require('blink-cmp').setup { + keymap = { + -- 手动调用 minuet 补全。 + [''] = require('minuet').make_blink_map(), + }, + sources = { + -- 启用 minuet 进行自动补全 + default = { 'lsp', 'path', 'buffer', 'snippets', 'minuet' }, + -- 仅对于手动补全,从默认值中删除 'minuet' + providers = { + minuet = { + name = 'minuet', + module = 'minuet.blink', + score_offset = 8, -- 在建议中赋予 minuet 更高的优先级 + }, + }, + }, + -- 建议避免不必要的请求 + completion = { trigger = { prefetch_on_insert = false } }, +} +``` + +
+ +**LLM 提供商示例:** + +**Deepseek:** + +```lua +-- 你可以使用 openai_fim_compatible 或 openai_compatible 提供商来使用 deepseek +require('minuet').setup { + provider = 'openai_fim_compatible', + provider_options = { + openai_fim_compatible = { + api_key = 'DEEPSEEK_API_KEY', + name = 'deepseek', + optional = { + max_tokens = 256, + top_p = 0.9, + }, + }, + }, +} + + +-- 或者 +require('minuet').setup { + provider = 'openai_compatible', + provider_options = { + openai_compatible = { + end_point = 'https://api.deepseek.com/v1/chat/completions', + api_key = 'DEEPSEEK_API_KEY', + name = 'deepseek', + optional = { + max_tokens = 256, + top_p = 0.9, + }, + }, + }, +} +```