Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sudo-burger/m0.nvim

Minimalistic LLM plugin for Neovim.
https://github.com/sudo-burger/m0.nvim

anthropic llm neovim-plugin openai

Last synced: 13 days ago
JSON representation

Minimalistic LLM plugin for Neovim.

Awesome Lists containing this project

README

        

# m0.nvim

## Introduction
Yet another Neovim plugin interacting with LLMs.

* Chat and rewrite modes.
* Project scan (adds repo code to context).
* Supports Anthropic prompt caching (OpenAI caching is implicit).
* Configure any number of LLM backends and prompts.
* Switch backends and prompts at any time.
* Minimal codebase.

Supported APIs:
* OpenAI: completions (https://platform.openai.com/docs/api-reference/making-requests)
* Anthropic: messages (https://docs.anthropic.com/claude/reference/messages_post)
- Supports prompt caching for project scans.

## Installation

Using [lazy.nvim](https://github.com/folke/lazy.nvim)
``` lua
return {
'sudo-burger/m0.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-telescope/telescope.nvim',
},
opts = {
providers = {
['anthropic'] = {
api_key = ,
},
['openai'] = {
api_key = ,
},
['mistral'] = {
api_key = ,
},
},
backends = {
['openai:gpt-4o-mini-nostream'] = {
provider = 'openai',
model = { name = 'gpt-4o-mini', max_completion_tokens = 128 },
stream = false,
temperature = 0.8,
},
['anthropic:claude-3-haiku'] = {
provider = 'anthropic',
model = { name = 'claude-3-haiku-20240307' },
},
['mistral:mistral-large-latest-stream'] = {
provider = 'mistral',
model = { name = 'mistral-large-latest', max_tokens = 3000 },
},
},
default_backend_name = 'openai:gpt-4o-mini-nostream',
prompts = {
['Helpful assistant'] = 'You are a helpful assistant.',
['Marilyn Monroe'] = 'Assume the persona of Marilyn Monroe.',
},
default_prompt_name = 'Helpful assistant',
section_mark = '-*-*-*-*-*-*-*-*-',
},
keys = {
{ 'ab', '(M0 backend)', desc = 'M0 backend' },
{ 'ac', '(M0 chat)', desc = 'M0 chat', mode = { 'n', 'v' } },
{ 'ai', '(M0 info)', desc = 'M0 info' },
{ 'ap', '(M0 prompt)', desc = 'M0 prompt' },
{ 'ar', '(M0 rewrite)', desc = 'M0 rewrite', mode = { 'v' } },
{ 'as', '(M0 scan_project)', desc = 'M0 scan_project' },
},
}
```

## Usage
- ":M0 chat" start/continue chat.
- ":M0 rewrite" rewrite selected text.
- ":M0 scan_project" include the current project as conversation context.
- ":M0 backend": select a backend.
- ":M0 prompt": select a prompt.
* ":M0 info": show status and configuration.

## Similar Projects
- [karthink/GPTel](https://github.com/karthink/gptel)
- [CamdenClark/flyboy](https://github.com/CamdenClark/flyboy)
- [gsuuon/model.nvim](https://github.com/gsuuon/model.nvim)