Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jameshiew/nvim-magic
:genie: Pluggable framework for using AI code assistance in Neovim
https://github.com/jameshiew/nvim-magic
lua neovim neovim-plugin nvim openai openai-codex
Last synced: about 2 months ago
JSON representation
:genie: Pluggable framework for using AI code assistance in Neovim
- Host: GitHub
- URL: https://github.com/jameshiew/nvim-magic
- Owner: jameshiew
- License: mit
- Archived: true
- Created: 2021-09-11T11:54:52.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-06-08T12:06:18.000Z (over 1 year ago)
- Last Synced: 2024-08-01T19:57:44.766Z (5 months ago)
- Topics: lua, neovim, neovim-plugin, nvim, openai, openai-codex
- Language: Lua
- Homepage:
- Size: 1.09 MB
- Stars: 195
- Watchers: 5
- Forks: 15
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
> :warning: This repository is no longer maintained. The plugin was last tested to work with Neovim v0.8.3 and OpenAI's API as it was on 14 February, 2023.
> 🍴 There is a fork with ChatGPT support at
# nvim-magic
![ci](https://github.com/jameshiew/nvim-magic/actions/workflows/ci.yml/badge.svg)
A pluggable framework for integrating AI code assistance into Neovim. The goals are to make using AI code assistance unobtrusive, and to make it easy to create and share new flows that use AI code assistance. Go to [quickstart](#quickstart) for how to install. It currently works with [OpenAI Codex](https://openai.com/blog/openai-codex/).
## Features
### Completion (`mcs`)
### Generating a docstring (`mds`)
### Asking for an alteration (`mss`)
## Quickstart
### Prerequisites
- latest stable version of Neovim (nightly may work as well)
- `curl`
- OpenAI API key### Installation
```lua
-- using packer.nvim
use({
'jameshiew/nvim-magic',
config = function()
require('nvim-magic').setup()
end,
requires = {
'nvim-lua/plenary.nvim',
'MunifTanjim/nui.nvim'
}
})
```See [docs/config.md](docs/config.md) if you want to override the default configuration e.g. to turn off the default keymaps, or use a different OpenAI engine than the default one (`davinci-codex`). Your OpenAI account might not have access to `davinci-codex` if it is not in the OpenAI Codex private beta (as of 2022-02-02).
Your API key should be made available to your Neovim session in an environment variable `OPENAI_API_KEY`. See [docs/openai.md](docs/openai.md) for more details. Note that API calls may be charged for by OpenAI depending on the engine used.
```shell
export OPENAI_API_KEY='your-api-key-here'
```### Keymaps
These flows have keymaps set by default for visual mode selections (though you can disable this by passing `use_default_keymap = false` in the setup config).
You can map your own key sequences to the predefined ``s if you don't want to use the default keymaps.
| `` | default keymap | mode | action |
| ------------------------------------- | -------------- | ------ | ------------------------------------------ |
| `nvim-magic-append-completion` | `mcs` | visual | Fetch and append completion |
| `nvim-magic-suggest-alteration` | `mss` | visual | Ask for an alteration to the selected text |
| `nvim-magic-suggest-docstring` | `mds` | visual | Generate a docstring |## Development
There is a [development container](https://containers.dev/) specified under the [`.devcontainer`](.devcontainer/) directory, that builds and installs the latest stable version of Neovim, and sets it up to use the local `nvim-magic` repo as a plugin.