Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate Chat Functionality in Neovim Using ToggleTerm #361

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

SujitSakore
Copy link

This issue [CLI] Refact chat in Neovim #351 discusses the integration of chat functionality into Neovim by utilizing the existing code completion support provided in the Refact project. The proposed solution involves leveraging the toggleterm plugin to create a floating terminal for chat interactions. The implementation allows users to toggle the chat interface using a keyboard shortcut, enhancing the development experience by enabling context-aware communication directly within the IDE.

@olegklimov
Copy link
Contributor

Cool!

@olegklimov
Copy link
Contributor

I'll try it on the weekend!

@SujitSakore
Copy link
Author

Hello @olegklimov , could you please check and let me know if any changes are needed so I can work on them? I would also appreciate it if you could accept my pull request.

@olegklimov
Copy link
Contributor

Hi @SujitSakore !

image

I see there's lua code inside a python file, I'm confused :D

The other file, chat_with_at_command.py doesn't seem to be relevant at all, but it's used in the lua script, I'm confused again )

@SujitSakore
Copy link
Author

Hello, @olegklimov
I’ve integrated the toggleterm plugin into Neovim to create floating terminals for both the Refact tool and a simple Python-based chatbot. The setup involves defining two terminal instances—one for running the Refact command and another for executing a Python chat script. Specific keyboard shortcuts are assigned to toggle these terminals. For the Refact terminal, pressing Alt + e opens or closes a floating terminal running the refact . command. Similarly, the Python chat terminal can be toggled with Alt + c, where a simple chatbot script runs.

The Python chat script starts a basic conversation in the terminal, allowing messages to be typed and interacted with. Typing "exit" will end the chat session. This integration enables a seamless workflow between coding with Refact and interacting with the chatbot, all within Neovim’s terminal windows.

The init.lua file is used because Neovim supports Lua as its main configuration language, which is faster and more flexible. Lua is recommended for modern Neovim setups and plugins like toggleterm, making it easier to manage terminals, set key mappings, and configure plugins.

#351

@SujitSakore
Copy link
Author

Hello @olegklimov,
Could you please take a look at the changes I've made? Let me know if there’s anything that needs adjustment or further clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants