David-Kunz / gen.nvim

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

Text outside the floating windows #53

Closed micheleavellaNUT closed 3 months ago

micheleavellaNUT commented 6 months ago

Hi, I'm new to nvim and I am currently using the Gen plugin. Recently, I noticed an issue when using the AI (Mistral) inside nvim. When the answer provided by the AI is long and fits onto a single line, it goes beyond the boundaries of the floating window. Does anyone have any advice on how to resolve this issue?

Additionally, I was wondering if it is possible to customize the size and position of the floating windows.

2023-12-15_19-11

David-Kunz commented 6 months ago

Hi @micheleavellaNUT ,

What should happen is that at the end of the line, the text will continue in the new line. Example:

Screenshot 2023-12-17 at 10 14 05

There's the unofficial config option win_config, but I might remove it in the future. You can also use vertical splits with display_mode = 'split'.

Joseph-D-Bradshaw commented 5 months ago

I didn't used to suffer from this, but I got it on a new machine where I also setup neovim from scratch. I think it would be helpful to see a config to compare @micheleavellaNUT as I have an old working config in the git history of my dotfiles. I might be able to find out why

iFrostizz commented 4 months ago

This happens if you don't set the :set wrap option, the text is going to overflow the buffer. It might be good to default to this option for windows opened by gen (or add it as a configuration ?).

David-Kunz commented 4 months ago

Hi @iFrostizz ,

Thanks, this is already done by nvim.gen:

        vim.api.nvim_win_set_option(M.float_win, "wrap", true)
paulobazooka commented 4 months ago

Thank you for your help, I had the same problem and noticed that I had set it not to break lines.

Joseph-D-Bradshaw commented 3 months ago

I do not get wrapping unless I explicitly call :set wrap when the floating window is open. I am on the latest commit (87fbe81).

Extremely minimal configuration:

  -- Minimal configuration
  {
    "David-Kunz/gen.nvim",
    opts = {
      model = "deepseek-coder:6.7b",
  },

I know this is not a problem with gen.nvim but likely my own setup, how to debug it I am hoping one of the other commenters might be able to provide if they solved their issue - this doesn't happen with display_mode = "split" so I know it is a floating window specific issue.