zbirenbaum / copilot.lua

Fully featured & enhanced replacement for copilot.vim complete with API for interacting with Github Copilot
MIT License
2.45k stars 67 forks source link

(imp) Suggest `word by word` to keep suggesting when `auto_trigger = false` #183

Closed mattiasbonte closed 1 year ago

mattiasbonte commented 1 year ago

Hi!

A while ago (https://github.com/zbirenbaum/copilot.lua/issues/85) the possibility to accept word by word was implemented (thanks btw 🎉 !).

I've reduced my copilot suggestion to not show automatically suggestion.auto_trigger = false. So that I get in the habbit of thinking first instead of it being thrown in the face 😃. So if I desire a suggestion i can trigger it. Now this works quite well, but when accepting the suggestion word by word, it stops suggesting after I accept a word.

Ideally this would keep on suggesting after a word was accepted instead of having to trigger the next suggestion manually again.

This would reduce some keypresses

Low prio but thought this behavior would be nice!

Thanks for your time 🙏🏼

MunifTanjim commented 1 year ago

You can make your custom keymap for this:

vim.keymap.set("i", "<M-Right>", function()
  require("copilot.suggestion").accept_word()
  require("copilot.suggestion").next()
end, { desc = "[copilot] accept (word) and next suggestion" })

Since it's already possible... I don't think it's worth adding another configuration option for this in the plugin.

mattiasbonte commented 1 year ago

Thanks for thinking for me @MunifTanjim. 😅