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

feat: provide a diff of changes for confirmation #119

Open
life00 opened this issue Sep 9, 2024 · 4 comments
Open

feat: provide a diff of changes for confirmation #119

life00 opened this issue Sep 9, 2024 · 4 comments

Comments

@life00
Copy link

life00 commented Sep 9, 2024

Hi. I love the plugin. I would like to make a feature request.

One thing I am missing is the ability to visually inspect the changes that the llm has done, so I end up just copying the original input above what I ask it to change. There is a better way definitely.

So there is one plugin that can be pretty helpful and it is diffview.nvim. My suggestion is to create an option in the configuration if the user wants to enable confirmation to modify the buffer, while also providing a diff view (with that plugin).

I am not a plugin dev, so sorry I can't help, but I am pretty sure it should not be very hard.

Thanks :D

Edit: I was actually thinking that a nice diff view could be provided by diffview.nvim but apparently it doesn't do that for stuff that is not git commits. I will research if its actually possible more, and maybe search for alternative plugins.

@life00
Copy link
Author

life00 commented Sep 9, 2024

Yeah so it seems its not really possible to do it with diffview.nvim because it does not support checking difference of non git commits, and here is the issue for it: sindrets/diffview.nvim#288

I have one other idea. Instead of relying on plugins, its possible to rely on other programs like diff. So basically just create two temporary files in /tmp/nvim-xxxxxx/, diff them using something like diff or delta, output it into a split buffer, and ask the user if they want to confirm. It would be nice if its possible to modify the program name in config, so I can set if its diff or delta.

Maybe someone has better suggestions. I'd really like to see such a feature.

@briskajanis1
Copy link

You could techinally:

  • Capture visual selection in register a
  • capture AI output in register B
  • create new tab with :tabnew
  • paste from register a
  • do a vsplit
  • create new buffer with :enew
  • paste from register b
  • do :windo diffthis

The tabclose when finished.

@life00
Copy link
Author

life00 commented Sep 11, 2024

@briskajanis1 I didn't know that neovim supports such nice diffs by default. This is even better. Thanks

@David-Kunz
Copy link
Owner

Hi @life00 ,

Thanks for this feature suggestion. I'll try to keep this plugin as minimal as possible, so I'm not sure if I will implement the diff feature, but I'll experiment a little.

Best regards,
David

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

No branches or pull requests

3 participants