LazyVim.LazyVim/lua/lazyvim/plugins/extras/ai/codeium.lua
Manuuurino b51279c6d7
fix(codeium): doesnt automatically load when vim.g.ai_cmp is set to false (#5182)
## Description

I think the title of the PR says it all. Before the user has to manually
load/trigger the plugin via the cmd (`:Codeium Auth`) or by requiring.

PS: The copilot extra also has this event.

~~PPS: Ive also noticed that supermaven doesnt have this event setup,
perhaps it suffers to the same issue when this option is disabled?~~

Edit:
For the PPS, have tested supermaven, i can confirm, it loads properly.

## Related Issue(s)

<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots

<!-- Add screenshots of the changes if applicable. -->

## Checklist

- [x] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
2024-12-18 22:28:39 +01:00

76 lines
1.6 KiB
Lua

return {
-- codeium
{
"Exafunction/codeium.nvim",
cmd = "Codeium",
event = "InsertEnter",
build = ":Codeium Auth",
opts = {
enable_cmp_source = vim.g.ai_cmp,
virtual_text = {
enabled = not vim.g.ai_cmp,
key_bindings = {
accept = false, -- handled by nvim-cmp / blink.cmp
next = "<M-]>",
prev = "<M-[>",
},
},
},
},
-- add ai_accept action
{
"Exafunction/codeium.nvim",
opts = function()
LazyVim.cmp.actions.ai_accept = function()
if require("codeium.virtual_text").get_current_completion_item() then
LazyVim.create_undo()
vim.api.nvim_input(require("codeium.virtual_text").accept())
return true
end
end
end,
},
-- codeium cmp source
{
"hrsh7th/nvim-cmp",
optional = true,
dependencies = { "codeium.nvim" },
opts = function(_, opts)
table.insert(opts.sources, 1, {
name = "codeium",
group_index = 1,
priority = 100,
})
end,
},
{
"nvim-lualine/lualine.nvim",
optional = true,
event = "VeryLazy",
opts = function(_, opts)
table.insert(opts.sections.lualine_x, 2, LazyVim.lualine.cmp_source("codeium"))
end,
},
vim.g.ai_cmp and {
"saghen/blink.cmp",
optional = true,
dependencies = { "codeium.nvim", "saghen/blink.compat" },
opts = {
sources = {
compat = { "codeium" },
providers = {
codeium = {
kind = "Codeium",
score_offset = 100,
async = true,
},
},
},
},
} or nil,
}