Bryley / neoai.nvim

Neovim plugin for intracting with GPT models from OpenAI
MIT License
558 stars 51 forks source link

Syntax highlighting for code blocks in UI and option to keep history #35

Closed krishpop closed 1 year ago

krishpop commented 1 year ago

Hi! First of all, a sincere thanks for building this plugin. I have been enjoying it for the past few days and would love to continue using and refining it. I had a couple of questions regarding the UI regarding some potential bugs/configuration issues, as well as some improvements.

First, my NeoAI UI does not highlight syntax as shown in the demos, and I was wondering if there was anything in particular I need to download to enable it (or just do I just need to enable LSP syntax highlighting in markdown?) For example:

image

Second, I find myself frequently hiding and unhiding the NeoAI console since I often use splits and it obscures my code at times. However, this resets the context/erases the prior history when I toggle it off and on. Is it possible to keep add an option to keep NeoAI from erasing the history?

krishpop commented 1 year ago
image

The syntax highlighting is easy to do with neovim 0.9 (I needed to upgrade), by using the treesitter API to register neoai-output with the markdown language parser. This is what I added to do this:

vim.treesitter.language.register('markdown', 'neoai-output')

I also set vim.o.conceallevel = 1 so the backticks are invisible in the markdown response from gpt-3.5.