doc: add Kurama622/llm.nvim

This commit is contained in:
Kurama622 2025-01-13 23:25:52 +08:00
parent 4178d67d23
commit d166df9b25
4 changed files with 166 additions and 0 deletions

View File

@ -149,6 +149,11 @@ English/[简体中文](https://github.com/deepseek-ai/awesome-deepseek-integrati
<td> <a href="https://github.com/deepseek-ai/awesome-deepseek-integration/blob/main/docs/avante.nvim/README.md"> avante.nvim </a> </td>
<td> avante.nvim is an open-source autopilot in IDE </td>
</tr>
<tr>
<td> <img src="https://github.com/user-attachments/assets/d66dfc62-8e69-4b00-8549-d0158e48e2e0" alt="Icon" width="64" height="auto" /> </td>
<td> <a href="docs/llm.nvim/README.md"> llm.nvim </a> </td>
<td> A free large language model(LLM) plugin that allows you to interact with LLM in Neovim. Supports any LLM, such as Deepseek, GPT, GLM, Kimi or local LLMs (such as ollama). </td>
</tr>
</table>
### JetBrains Extensions

View File

@ -142,6 +142,11 @@
<td> <a href="https://github.com/deepseek-ai/awesome-deepseek-integration/blob/main/docs/avante.nvim/README_cn.md"> avante.nvim </a> </td>
<td> 开源 IDE 插件,使用 LLM 做你的编程助手 </td>
</tr>
<tr>
<td> <img src="https://github.com/user-attachments/assets/d66dfc62-8e69-4b00-8549-d0158e48e2e0" alt="Icon" width="64" height="auto" /> </td>
<td> <a href="docs/llm.nvim/README.md"> llm.nvim </a> </td>
<td> 免费的大语言模型插件让你在Neovim中与大模型交互支持任意一款大模型比如DeepseekGPTGLMkimi或者本地运行的大模型(比如ollama) </td>
</tr>
</table>
### JetBrains 插件

78
docs/llm.nvim/README.md Normal file
View File

@ -0,0 +1,78 @@
> [!IMPORTANT]
> A free large language model(LLM) plugin that allows you to interact with LLM in Neovim.
>
> The main functions include but are not limited to:
>
> - AI chat
> - Word translation
> - Code explanation
> - Code optimization
> - Test case generation
> - AI translation
> - Generation of git commit messages
> - Generation of docstrings
Link: [Github:Kurama622/llm.nvim](https://github.com/Kurama622/llm.nvim)
# Install
- lazy.nvim
```lua
return {
{
"Kurama622/llm.nvim",
dependencies = { "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim" },
cmd = { "LLMSesionToggle", "LLMSelectedTextHandler", "LLMAppHandler" },
config = function()
require("llm").setup({
url = "https://api.deepseek.com/chat/completions",
model = "deepseek-chat",
api_type = "openai",
max_tokens = 4096,
temperature = 0.3,
top_p = 0.7,
prompt = "You are a helpful Chinese assistant.",
prefix = {
user = { text = " ", hl = "Title" },
assistant = { text = " ", hl = "Added" },
},
-- history_path = "/tmp/llm-history",
save_session = true,
max_history = 15,
max_history_name_length = 20,
-- stylua: ignore
keys = {
-- The keyboard mapping for the input window.
["Input:Submit"] = { mode = "n", key = "<cr>" },
["Input:Cancel"] = { mode = {"n", "i"}, key = "<C-c>" },
["Input:Resend"] = { mode = {"n", "i"}, key = "<C-r>" },
-- only works when "save_session = true"
["Input:HistoryNext"] = { mode = {"n", "i"}, key = "<C-j>" },
["Input:HistoryPrev"] = { mode = {"n", "i"}, key = "<C-k>" },
-- The keyboard mapping for the output window in "split" style.
["Output:Ask"] = { mode = "n", key = "i" },
["Output:Cancel"] = { mode = "n", key = "<C-c>" },
["Output:Resend"] = { mode = "n", key = "<C-r>" },
-- The keyboard mapping for the output and input windows in "float" style.
["Session:Toggle"] = { mode = "n", key = "<leader>ac" },
["Session:Close"] = { mode = "n", key = {"<esc>", "Q"} },
},
})
end,
keys = {
{ "<leader>ac", mode = "n", "<cmd>LLMSessionToggle<cr>" },
{ "<leader>ae", mode = "v", "<cmd>LLMSelectedTextHandler 请解释下面这段代码<cr>" },
{ "<leader>ts", mode = "x", "<cmd>LLMSelectedTextHandler 英译汉<cr>" },
},
},
}
```

View File

@ -0,0 +1,78 @@
> [!IMPORTANT]
> 免费的大语言模型插件让你在Neovim中与大模型交互
>
> 主要功能包括但不限于:
>
> - AI对话
> - 划词翻译
> - 解释代码
> - 优化代码
> - 生成测试用例
> - AI翻译
> - 生成git commit信息
> - 生成docstring
链接: [Github:Kurama622/llm.nvim](https://github.com/Kurama622/llm.nvim)
# 安装
- lazy.nvim
```lua
return {
{
"Kurama622/llm.nvim",
dependencies = { "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim" },
cmd = { "LLMSesionToggle", "LLMSelectedTextHandler", "LLMAppHandler" },
config = function()
require("llm").setup({
url = "https://api.deepseek.com/chat/completions",
model = "deepseek-chat",
api_type = "openai",
max_tokens = 4096,
temperature = 0.3,
top_p = 0.7,
prompt = "You are a helpful Chinese assistant.",
prefix = {
user = { text = " ", hl = "Title" },
assistant = { text = " ", hl = "Added" },
},
-- history_path = "/tmp/llm-history",
save_session = true,
max_history = 15,
max_history_name_length = 20,
-- stylua: ignore
keys = {
-- The keyboard mapping for the input window.
["Input:Submit"] = { mode = "n", key = "<cr>" },
["Input:Cancel"] = { mode = {"n", "i"}, key = "<C-c>" },
["Input:Resend"] = { mode = {"n", "i"}, key = "<C-r>" },
-- only works when "save_session = true"
["Input:HistoryNext"] = { mode = {"n", "i"}, key = "<C-j>" },
["Input:HistoryPrev"] = { mode = {"n", "i"}, key = "<C-k>" },
-- The keyboard mapping for the output window in "split" style.
["Output:Ask"] = { mode = "n", key = "i" },
["Output:Cancel"] = { mode = "n", key = "<C-c>" },
["Output:Resend"] = { mode = "n", key = "<C-r>" },
-- The keyboard mapping for the output and input windows in "float" style.
["Session:Toggle"] = { mode = "n", key = "<leader>ac" },
["Session:Close"] = { mode = "n", key = {"<esc>", "Q"} },
},
})
end,
keys = {
{ "<leader>ac", mode = "n", "<cmd>LLMSessionToggle<cr>" },
{ "<leader>ae", mode = "v", "<cmd>LLMSelectedTextHandler 请解释下面这段代码<cr>" },
{ "<leader>ts", mode = "x", "<cmd>LLMSelectedTextHandler 英译汉<cr>" },
},
},
}
```