This PR introduces a new Neovim Python plugin, vim_llm_stream.py, which leverages pynvim and litellm to enhance the editing experience by integrating large language models directly into Neovim. The plugin captures the current buffer's contents and the cursor's position, sends this context along with a user-defined request to litellm, and processes the response by simulating key presses in Neovim.
Key features and decisions made in this implementation include:
Buffer and Cursor Context: By sending the entire buffer's contents and the cursor's position to litellm, we ensure that the model's response is as relevant and contextual as possible. This approach allows for more accurate and useful suggestions or actions based on the current state of the editor.
Flexible User Requests: The plugin accepts arguments with the LLMStream command, allowing users to specify their request to litellm dynamically. This flexibility enables a wide range of interactions, from code suggestions to documentation lookups, directly within Neovim.
Direct Key Press Simulation: The response from litellm is treated as a series of Neovim key presses. This method was chosen for its simplicity and directness, allowing the plugin to perform a variety of actions without the need for complex parsing or additional APIs.
This initial version is a foundational step towards deeply integrating large language models into the Neovim ecosystem, opening up possibilities for advanced code assistance, automated refactoring, and more, all within the familiar Neovim interface. Future enhancements could include more sophisticated parsing of litellm responses, customization options for the model and request parameters, and improved error handling and user feedback mechanisms.
This PR introduces a new Neovim Python plugin,
vim_llm_stream.py
, which leverages pynvim and litellm to enhance the editing experience by integrating large language models directly into Neovim. The plugin captures the current buffer's contents and the cursor's position, sends this context along with a user-defined request to litellm, and processes the response by simulating key presses in Neovim.Key features and decisions made in this implementation include:
LLMStream
command, allowing users to specify their request to litellm dynamically. This flexibility enables a wide range of interactions, from code suggestions to documentation lookups, directly within Neovim.This initial version is a foundational step towards deeply integrating large language models into the Neovim ecosystem, opening up possibilities for advanced code assistance, automated refactoring, and more, all within the familiar Neovim interface. Future enhancements could include more sophisticated parsing of litellm responses, customization options for the model and request parameters, and improved error handling and user feedback mechanisms.
Closes issue #1