https://github.com/cmpadden/llm.nvim
Chatblade integration for Neovim
https://github.com/cmpadden/llm.nvim
chatblade chatgpt llm neovim
Last synced: about 1 year ago
JSON representation
Chatblade integration for Neovim
- Host: GitHub
- URL: https://github.com/cmpadden/llm.nvim
- Owner: cmpadden
- Created: 2024-02-15T21:49:02.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-09T02:19:45.000Z (about 1 year ago)
- Last Synced: 2025-05-13T00:03:15.814Z (about 1 year ago)
- Topics: chatblade, chatgpt, llm, neovim
- Language: Lua
- Homepage:
- Size: 1.2 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Leverage llm, a CLI utility and Python library for interacting with Large Language Models, from your Neovim editor.
## Setup
### Prerequisites
1. Install the [llm](https://github.com/simonw/llm) CLI
2. Set the API key for the LLM provider of your choice
### Installation & Configuration
```lua
-- lazy.nvim
{
"cmpadden/llm.nvim",
keys = {
{ "x", ":LLM", mode = "v" },
},
cmd = {
"LLM",
},
opts = {
-- `llm` flag configuration parameters
model = "claude-3.5-haiku", -- TEXT Model to use
system = nil, -- TEXT System prompt to use
continue = nil, -- Continue the most recent conversation.
conversation = nil, -- TEXT Continue the conversation with the given ID.
template = nil, -- TEXT Template to use
param = nil, -- ... Parameters for template
option = nil, -- ... key/value options for the model
-- nvim-specific configuration parameters
insert_as_comment = true -- BOOL Insert the prompt response as a comment
}
}
```
## Usage
### Bindings
Select text, and send it to LLM with your key binding of choice. For the example
of `x`, you can visually select a line or paragraph, send it to LLM, and
the response will be inserted below your cursor.
```
vipx
```
### Commands
The following user commands have been made available. This allows you to handle sessions
so that you can send snippets to LLM, and ask follow-up questions with persisted
context.
| Command | Parameters | Description |
| ---------------------- | --------- | ----------------------------------------------------------------- |
| LLM | `string?` | Prompt LLM with visual selection and/or an additional query |
## Motivation
If all you wish to do is to pass text to `llm` from your Neovim session, then you may be better off defining a key binding like so:
```lua
vim.keymap.set("v", "x", ':!LLM -e -r')
```
However, _llm.nvim_ intends to offer some quality of life improvements over such a bindings.