David-Kunz / gen.nvim

Neovim plugin to generate text using LLMs with customizable prompts
The Unlicense
992 stars 64 forks source link

Option to enable word wrap? #25

Closed fredrikaverpil closed 7 months ago

fredrikaverpil commented 8 months ago

Hi and thanks for this excellent plugin!

I noticed that the output of e.g. :Gen Summarize can produce one very long line:

image

If I manually enabled word wrap, it becomes much more readable:

image

I think I would prefer to have this word wrapping "always on". Do you think it's possible to add an option to enable this?

-- lazy.nvim example
{
"David-Kunz/gen.nvim",
config = function()
  require("gen").setup({
    word_wrap = true
  })
end,
},
David-Kunz commented 8 months ago

Hi @fredrikaverpil ,

Thanks for this suggestion.

This PR allows to set the window config via

require('gen').win_config = { ... }

but it's not yet possible to modify the buffer options... let me think how to support this in the most generic way.

Best regards, David

samharju commented 8 months ago

As the output buffer is detected as filetype=markdown, I tried setting wrap on in ftplugin/markdown.lua. It works fine if I first open some markdown file, but not if the first markdown is opened by gen. Maybe a distinct filetype would help with this, or figuring out why ftplugin is not triggered by gen?

kjjuno commented 8 months ago

This PR should fix this issue

https://github.com/David-Kunz/gen.nvim/pull/36

David-Kunz commented 7 months ago

Should be fixed!

rensftw commented 5 months ago

Hey!

I can see this issue again in 9804316 I have an ftplugin for markdown with the following settings:

vim.opt_local.wrap = true
vim.opt_local.linebreak = true
vim.opt_local.breakindent = true 
vim.opt_local.showbreak = '⋮ ' 

These settings get applied when I open any Markdown file, but not in the markdown buffer that :Gen creates https://github.com/David-Kunz/gen.nvim/assets/22574186/993f466e-6039-411a-b7b4-4d4dbc0570e3