https://github.com/psaia/prompt-ai.vim
qc-ai - Quickly configure you vim runtime with natural language.
https://github.com/psaia/prompt-ai.vim
ai neovim openai vim
Last synced: 10 months ago
JSON representation
qc-ai - Quickly configure you vim runtime with natural language.
- Host: GitHub
- URL: https://github.com/psaia/prompt-ai.vim
- Owner: psaia
- Created: 2025-06-07T18:26:23.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-09T00:29:21.000Z (about 1 year ago)
- Last Synced: 2025-06-09T01:26:31.666Z (about 1 year ago)
- Topics: ai, neovim, openai, vim
- Language: Lua
- Homepage:
- Size: 7.77 MB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ⚡️ prompt-ai - configure vim with natural language
**prompt-ai** is a super lightweight Neovim plugin that lets you configure your editor using natural language prompts like:
* `:P use a light theme and turn on line numbers`
* `:P optimize for viewing large files`
* `:P replace word "foo" with "bar"`
* `:P use the kanagawa-lotus colorscheme`
* `:P format file`
* Or really anything you can think of.

---
## ✨ Features
* Easily apply prompt config via natural language (`:P`)
* Caches responses to avoid redundant API calls
* Remembers previous conversations (limited to recent history)
* Saves history and cache to disk across sessions
* Configurable model, temperature, and history length
* Commands to clear history and cache
> [!TIP]
> This plugin focuses solely on one thing: on-the-fly Vim prompt generation.
> If you're looking for AI-powered file editing or manipulation, check out [vim-ai](https://github.com/madox2/vim-ai). prompt-ai and vim-ai compliment each other well.
---
## 📦 Requirements
* Neovim 0.8+
* OpenAI API key in your environment:
```sh
export OPENAI_API_KEY="sk-..."
```
## 🚀 Installation (Lazy.nvim)
```lua
{
"psaia/prompt-ai.vim",
config = function()
require("prompt_ai").setup({
model = "o4-mini", -- or "o4-mini" (default)
temperature = 1 , -- controls creativity (default: 1)
max_history = 8, -- max prompt/response pairs remembered (default: 8)
})
end,
cmd = { "P", "PClearHistory", "PClearCache" },
}
```
---
## Usage
### Configure with Natural Language
```vim
:P use gruvbox with transparent background
```
### Clear History
```vim
:PClearHistory
```
### Clear Cache
```vim
:PClearCache
```
---
## Where Data is Stored
| File | Purpose |
| -------------------------------------------- | ----------------------- |
| `~/.local/share/nvim/ai_config_history.json` | Prompt/response history |
| `~/.local/share/nvim/ai_config_cache.json` | Prompt → code cache |
| `/tmp/nvim_ai_config.log` | Log file (debug) |
---
## Privacy & Safety
No telemetry or analytics. Your prompts and configs are never stored or sent anywhere beyond OpenAI's API.
---
## Ideas for the Future
* Intelligently contextualize pre-installed plugins for more relevant prompts
* Different models other than OpenAI
* Telescope integration for history
* Floating preview of generated code
---
#### 🖤 Created by [@psaia](https://github.com/psaia)