supermaven-inc / supermaven-nvim

The official Neovim plugin for Supermaven
https://supermaven.com/
MIT License
279 stars 16 forks source link

FR: support dot-repeat #55

Open chrisgrieser opened 3 weeks ago

chrisgrieser commented 3 weeks ago

One feature that would be very useful is to dot-repeat (.) the previous completion made the AI.

For reference, of all the AI completion plugins I tried, I think only neocodeium, has that feature.

AlejandroSuero commented 3 weeks ago

@chrisgrieser This would be something like for example:

Supermaven suggested: "function test(opts)"
if pressing ".": write "function test(opts)"
Supermaven suggested: "  if opts then\n    print(vim.inspect(opts))\n  end"
if pressing ".": write "  if opts ..."

Basically storing last accepted suggestion and when pressing . rewrite it under the cursor?

chrisgrieser commented 3 weeks ago

Basically storing last accepted suggestion and when pressing . rewrite it under the cursor?

exactly!

AlejandroSuero commented 3 weeks ago

@chrisgrieser I implemented the dot-repeat functionality in the PR linked here.

Personally, I wouldn't use dot-repeat with . as it conflicts with . functionality provided by Neovim itself, but maybe introducing a keymap like <C-r> for repeat in Insert Mode could be better as default, and exposing repeat_suggestion under keymaps to change the default one.