Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/jdnewman85/openai-vim

OpenAI Neovim Integration Plugin
https://github.com/jdnewman85/openai-vim

copilot lua neovim neovim-plugin openai teal

Last synced: 3 months ago
JSON representation

OpenAI Neovim Integration Plugin

Awesome Lists containing this project

README

        

# OpenAI Vim integration plugin

Sorry, this isn't quite ready yet
Soon(TM)

Don't use it yet

# Alternatives
Here are some alternatives in the interim. I've not actually used any, and can't make any recommendations.
- [github/copilot.vim](https://github.com/github/copilot.vim)
- [tom-doerr/vim_codex](https://github.com/tom-doerr/vim_codex)
- [aduros/ai.vim](https://github.com/aduros/ai.vim)
- [jessfraz/openai.vim](https://github.com/jessfraz/openai.vim)
- [jackMort/ChatGPT.nvim](https://github.com/jackMort/ChatGPT.nvim)

# WIP
Neovim only for now anyway, newish(TBD) version

Written in [Teal](https://github.com/teal-language/tl)

# TODO
- README.md
- WIP
- Initial release
- Screenshots
- Example vim init
- User defined keybinds
- Example default keybinds
- Error handling

# Goals
- Integrate openai endpoints effectively
- Operations: Complete, insert, and edit
- Model selection and Parameter settings
- Tokenize text locally, and use treesitter to help with:
- Determining tokens to be sent to AI
- Entire file
- Selection
- Up to cursor
- Multiple marked ranges
- Lexical scope w/ treesitter
- Enclosing function
- Enclosing class
- Imported
- Choose method based on expressions including possibly factors:
- Operation
- Preference/settings
- Number of input tokens
- Number of available tokens for output
- Costs
- Codex vs Text
- Locally stored prior data, including AI prompts and responses
- Error messages
- All
- W/ prompt
- Single
- Range
- Selection
- Stops @ end of
- Line
- Function
- Class
- List
- Comments
- Assist with predicting cost based on cost-per-token, selected settings, etc
- Impossible to _guarantee_ anything here without API access to this information

## Requirements
- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) - curl
- Actually requires this [forked version](https://github.com/jdnewman85/plenary.nvim) until I PR [Server Sent Events](https://en.wikipedia.org/wiki/Server-sent_events) support
- Optional
- [utf8.nvim](https://github.com/uga-rosa/utf8.nvim) - tokenization functionality
- [dressing.nvim](https://github.com/stevearc/dressing.nvim) - prettier menus
- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) - prettier menus
- Embeds files from
- [Neovim types](https://github.com/teal-language/teal-types/blob/master/types/neovim/vim.d.tl) from [teal-types](https://github.com/teal-language/teal-types)

## API Key
Expects your openai api key in environment variable `OPENAI_APIKEY` - Note: *IT IS NOT A FREE SERVICE!* (though they do provide some starting credit)

## Keybinds
Terrible keybinds for the functionality so far are in [plugin/openai-test.lua](https://github.com/jdnewman85/openai-vim/blob/main/plugin/openai-test.lua)
- They are truly terrible and temporary - I've put no thought in to them
- They are hardcoded for development, likely end users would put everything from [plugin/openai-test.lua](https://github.com/jdnewman85/openai-vim/blob/main/plugin/openai-test.lua) in their vim init.
- They aren't documented, wait till they are.

# May rename and generalize to other apis in the future
# MIT