Skip to content

Commit

Permalink
feat(completion): improve copilot-cmp defaults (#129)
Browse files Browse the repository at this point in the history
feat: improve copilot-cmp defaults by re-enabling C-e to turn off cmp window to see hidden copilot suggestion and add C-x and C-z mappings to go to next and previous copilot suggestions
  • Loading branch information
parK-dev authored Apr 8, 2023
1 parent 78a0f36 commit 62599e1
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions lua/astrocommunity/completion/copilot-lua-cmp/copilot-lua-cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,14 @@ return {
fallback()
end
end, { "i", "s" })
opts.mapping["<C-e>"] = cmp.mapping {
i = function(fallback)
if copilot.is_visible() then
copilot.dismiss()
elseif not cmp.abort() then
fallback()
end
end,
c = function(fallback)
if copilot.is_visible() then
copilot.dismiss()
elseif not cmp.close() then
fallback()
end
end,
}

opts.mapping["<C-x>"] = cmp.mapping(function()
if copilot.is_visible() then copilot.next() end
end)

opts.mapping["<C-z>"] = cmp.mapping(function()
if copilot.is_visible() then copilot.prev() end
end)

return opts
end,
Expand Down

0 comments on commit 62599e1

Please sign in to comment.