2025-10-19 10:01:51 +01:00
|
|
|
-- AI code completion
|
2025-11-10 09:19:30 +00:00
|
|
|
|
2025-12-08 00:52:01 +00:00
|
|
|
if vim.fn.getenv 'COPILOT_API_KEY' ~= vim.NIL then
|
2025-11-10 09:19:30 +00:00
|
|
|
return {
|
|
|
|
|
'zbirenbaum/copilot.lua',
|
|
|
|
|
event = 'InsertEnter',
|
|
|
|
|
config = function()
|
|
|
|
|
require('copilot').setup {
|
|
|
|
|
suggestion = {
|
|
|
|
|
enabled = true,
|
|
|
|
|
auto_trigger = true,
|
|
|
|
|
keymap = {
|
2025-12-08 00:52:01 +00:00
|
|
|
accept = '<A-a>',
|
2025-11-10 09:19:30 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
filetypes = {
|
|
|
|
|
yaml = true,
|
|
|
|
|
markdown = true,
|
|
|
|
|
gitcommit = true,
|
|
|
|
|
gitrebase = true,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
end,
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
2025-10-19 10:01:51 +01:00
|
|
|
return {
|
|
|
|
|
'milanglacier/minuet-ai.nvim',
|
|
|
|
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
|
|
|
|
config = function()
|
|
|
|
|
require('minuet').setup {
|
|
|
|
|
virtualtext = {
|
2025-10-19 13:07:29 +01:00
|
|
|
auto_trigger_ft = { '*' },
|
2025-10-29 20:29:38 +00:00
|
|
|
auto_trigger_ignore_ft = { 'help', 'TelescopePrompt', 'codecompanion' },
|
2025-10-19 10:01:51 +01:00
|
|
|
keymap = {
|
|
|
|
|
accept = '<A-A>',
|
|
|
|
|
accept_line = '<A-a>',
|
|
|
|
|
-- accept n lines (prompts for number)
|
|
|
|
|
-- e.g. "A-z 2 CR" will accept 2 lines
|
|
|
|
|
accept_n_lines = '<A-z>',
|
|
|
|
|
-- Cycle to prev completion item, or manually invoke completion
|
|
|
|
|
prev = '<A-[>',
|
|
|
|
|
-- Cycle to next completion item, or manually invoke completion
|
|
|
|
|
next = '<A-]>',
|
|
|
|
|
dismiss = '<A-e>',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
provider = 'openai_compatible',
|
|
|
|
|
request_timeout = 3,
|
2025-10-19 13:07:29 +01:00
|
|
|
throttle = 500, -- Increase to reduce costs and avoid rate limits
|
2025-12-08 00:52:01 +00:00
|
|
|
debounce = 400, -- Increase to reduce costs and avoid rate limits
|
2025-10-19 13:07:29 +01:00
|
|
|
n_completions = 1,
|
2025-12-08 00:52:01 +00:00
|
|
|
before_cursor_filter_length = 10,
|
2025-10-19 10:01:51 +01:00
|
|
|
provider_options = {
|
|
|
|
|
openai_compatible = {
|
|
|
|
|
api_key = 'COMPLETION_OPENAI_API_KEY',
|
|
|
|
|
end_point = vim.env.COMPLETION_OPENAI_API_BASE .. '/v1/chat/completions',
|
|
|
|
|
model = vim.env.COMPLETION_MODEL,
|
|
|
|
|
name = 'Openrouter',
|
|
|
|
|
optional = {
|
2025-10-19 13:07:29 +01:00
|
|
|
max_tokens = 300,
|
2025-10-19 10:01:51 +01:00
|
|
|
top_p = 0.9,
|
|
|
|
|
provider = {
|
|
|
|
|
-- Prioritize throughput for faster completion
|
|
|
|
|
sort = 'throughput',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
end,
|
|
|
|
|
}
|