jackMort / ChatGPT.nvim

ChatGPT Neovim Plugin: Effortless Natural Language Generation with OpenAI's ChatGPT API
Apache License 2.0
3.71k stars 310 forks source link

help panel in chat and edit #336

Closed Moerliy closed 9 months ago

Moerliy commented 10 months ago

This PR tackles the issue mentioned in #44 and the discussion #43. resolve #44

Context

I too wanted a way to display help information. A popup would have done the job but I wanted a way to leave the help information open while using the plugin. Then I saw the way options are displayed on went from there.

Code context

I implemented it with a category for extra panels in mind and a way to track them. In edit, these extra panels are options and help, and in chat, they are help, options, and sessions which I separated and gave session an extra keybind to toggle on and off. The ratio of the show panel is rendered dynamic in regards to the amount of open extra panels. The key binds are obtained through the config file so they will display the correct key bind even if changed in custom configs.

Demo

Don't mind the screen record artifacts. Typical Wayland Nvidia experience

https://github.com/jackMort/ChatGPT.nvim/assets/100203892/bffa127c-8260-4ed7-b2b7-3af4b0577181

The video will not work, so here are some screenshots: image image image

Moerliy commented 10 months ago

@jackMort would love for you to have a look at it.

jackMort commented 9 months ago

Thank you for your work, and I apologize for the delay. My initial idea was to implement it as a popup window. I have mixed feelings about making it a separate panel. What do you think about modifying your code to use a popup window that displays above the interface?

Moerliy commented 9 months ago

My initial idea was to implement it as a popup window.

My first idea was to implement a popup too but the more I thought about it the less I liked it. It has the same effect as a separate panel but one drawback. You can't keep the popup open while using the plugin. I thought the possibility to leave help open while working would be beneficial. Like a cheat-sheet that you can glance at.

jackMort commented 9 months ago

alright, i think it makes sense, I added two small fixes to fill the remaining space when multiple panels are open, let me know if it works for you, after that we can merge, thanks!

jackMort commented 9 months ago

screenshot-nimbusweb me-2023 12 14-11_29_34

I also styled it a bit, let me know if it works for you, thanks again!

Moerliy commented 9 months ago

Very nice changes. I did some monkey tests and tried to force some buggs to appear but didn't get any except for the ones already mentioned in #335.