yetone / avante.nvim

Use your Neovim like using Cursor AI IDE!
Apache License 2.0
4.99k stars 165 forks source link

Cmd + K equivalent of Cursor #273

Open luisiacc opened 2 weeks ago

luisiacc commented 2 weeks ago

They have this very handy functionality with Cmd + K where they select a block of text and prompt it to do an action in that block of text, and it replaces the entire text selected with the AI response.

This can be done with AvanteAsk of course, but this is way handier for quick changes.

I think it'd look good using something like vim.ui.input on the selected block and then replacing the text with the ai response, like:

CleanShot 2024-08-27 at 02 19 20@2x

It looks like this on cursor:

https://github.com/user-attachments/assets/190f1c29-52bb-4f59-b176-581e4b54b20f

I don't think we need the diff for this case, it'll just be in the way.

aarnphm commented 2 weeks ago

I think this makes sense, will put up a PR

luisiacc commented 2 weeks ago

that was fast

aarnphm commented 2 weeks ago

We haven't finished every thing yet, still need to stream text and generate diff. I will reopen to track this

oxysoft commented 2 weeks ago

+1 to this issue,, the in-line editing features are even more important imo. Can you imagine a hydra mode with a bunch of shortcuts mapped to refactor prompts? document this function, improve that, a literal machine gun of AI black magic

yetone commented 2 weeks ago

The first version of the editing mode has been implemented, and a better editing experience will be implemented later.