Skip to content

Commit ddcf89d

Browse files
committed
refactor(completion): update AI plugins to use the new astrocommunity.recipes.ai boilerplate
1 parent 7f8edca commit ddcf89d

File tree

6 files changed

+79
-99
lines changed

6 files changed

+79
-99
lines changed

lua/astrocommunity/completion/codeium-nvim/init.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ return {
44
cmd = "Codeium",
55
opts = {
66
enable_chat = true,
7+
virtual_text = { key_bindings = { accept = false } },
78
},
89
dependencies = {
910
{
@@ -20,6 +21,17 @@ return {
2021
---@param opts AstroCoreOpts
2122
opts = function(_, opts)
2223
return require("astrocore").extend_tbl(opts, {
24+
options = {
25+
g = {
26+
-- set the ai_accept function
27+
ai_accept = function()
28+
if require("codeium.virtual_text").get_current_completion_item() then
29+
vim.api.nvim_input(require("codeium.virtual_text").accept())
30+
return true
31+
end
32+
end,
33+
},
34+
},
2335
mappings = {
2436
n = {
2537
["<Leader>;"] = {
@@ -36,6 +48,7 @@ return {
3648
},
3749
},
3850
specs = {
51+
{ import = "astrocommunity.recipes.ai" },
3952
{
4053
"hrsh7th/nvim-cmp",
4154
optional = true,

lua/astrocommunity/completion/copilot-lua-cmp/README.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

lua/astrocommunity/completion/copilot-lua-cmp/init.lua

Lines changed: 0 additions & 77 deletions
This file was deleted.

lua/astrocommunity/completion/copilot-lua/init.lua

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,28 @@ return {
22
"zbirenbaum/copilot.lua",
33
cmd = "Copilot",
44
event = "User AstroFile",
5-
opts = { suggestion = { auto_trigger = true, debounce = 150 } },
5+
opts = { suggestion = {
6+
auto_trigger = true,
7+
debounce = 150,
8+
keymap = { accept = false },
9+
} },
10+
specs = {
11+
{ import = "astrocommunity.recipes.ai" },
12+
{
13+
"AstroNvim/astrocore",
14+
opts = {
15+
options = {
16+
g = {
17+
-- set the ai_accept function
18+
ai_accept = function()
19+
if require("copilot.suggestion").is_visible() then
20+
require("copilot.suggestion").accept()
21+
return true
22+
end
23+
end,
24+
},
25+
},
26+
},
27+
},
28+
},
629
}

lua/astrocommunity/completion/supermaven-nvim/init.lua

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,32 @@ return {
33
event = "VeryLazy",
44
opts = {
55
keymaps = {
6-
accept_suggestion = "<C-l>",
6+
accept_suggestion = false,
77
clear_suggestion = "<C-h>",
88
accept_word = "<C-w>",
99
},
1010
log_level = "warn",
1111
disable_inline_completion = false, -- disables inline completion for use with cmp
1212
disable_keymaps = false, -- disables built in keymaps for more manual control
1313
},
14+
specs = {
15+
{ import = "astrocommunity.recipes.ai" },
16+
{
17+
"AstroNvim/astrocore",
18+
opts = {
19+
options = {
20+
g = {
21+
-- set the ai_accept function
22+
ai_accept = function()
23+
local suggestion = require "supermaven-nvim.completion_preview"
24+
if suggestion.has_suggestion() then
25+
vim.schedule(function() suggestion.on_accept_suggestion() end)
26+
return true
27+
end
28+
end,
29+
},
30+
},
31+
},
32+
},
33+
},
1434
}

lua/astrocommunity/completion/tabnine-nvim/init.lua

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,25 @@ return {
44
build = vim.loop.os_uname().sysname == "Windows_NT" and "pwsh.exe -file .\\dl_binaries.ps1" or "./dl_binaries.sh",
55
cmd = { "TabnineStatus", "TabnineDisable", "TabnineEnable", "TabnineToggle" },
66
event = "User AstroFile",
7-
opts = { accept_keymap = "<C-e>" },
7+
opts = { accept_keymap = false },
8+
specs = {
9+
{ import = "astrocommunity.recipes.ai" },
10+
{
11+
"AstroNvim/astrocore",
12+
opts = {
13+
options = {
14+
g = {
15+
-- set the ai_accept function
16+
ai_accept = function()
17+
local keymaps = require "tabnine.keymaps"
18+
if keymaps.has_suggestion() then
19+
keymaps.accept_suggestion()
20+
return true
21+
end
22+
end,
23+
},
24+
},
25+
},
26+
},
27+
},
828
}

0 commit comments

Comments
 (0)