feat: update nvim and add gemini cli
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
return {
|
||||
{
|
||||
"yetone/avante.nvim",
|
||||
enabled = false, -- 临时禁用 avante
|
||||
opts = function(_, opts)
|
||||
-- 配置使用 Gemini CLI 的 ACP (Agent Client Protocol)
|
||||
-- 强制使用 Gemini CLI 的 ACP (Agent Client Protocol)
|
||||
-- 注意:必须明确设置,覆盖 LazyVim 的默认配置
|
||||
opts.provider = "gemini-cli"
|
||||
opts.auto_suggestions_provider = opts.auto_suggestions_provider or "gemini-cli"
|
||||
opts.auto_suggestions_provider = "gemini-cli"
|
||||
|
||||
-- 清除可能存在的 claude 配置(如果 LazyVim 设置了的话)
|
||||
if opts.claude then
|
||||
opts.claude = nil
|
||||
end
|
||||
|
||||
-- 配置 ACP providers
|
||||
-- 使用网页登录(OAuth)方式,不需要 API Key
|
||||
@@ -28,19 +35,53 @@ return {
|
||||
-- 不设置 GEMINI_API_KEY,让 Gemini CLI 使用已缓存的 OAuth 凭证
|
||||
-- 如果必须使用 API Key,可以取消下面的注释:
|
||||
-- GEMINI_API_KEY = os.getenv("GEMINI_API_KEY"),
|
||||
|
||||
-- 代理配置(如果需要通过代理访问)
|
||||
-- 从环境变量读取代理设置,如果没有设置则使用系统默认
|
||||
HTTP_PROXY = os.getenv("HTTP_PROXY") or os.getenv("http_proxy"),
|
||||
HTTPS_PROXY = os.getenv("HTTPS_PROXY") or os.getenv("https_proxy"),
|
||||
ALL_PROXY = os.getenv("ALL_PROXY") or os.getenv("all_proxy"),
|
||||
NO_PROXY = os.getenv("NO_PROXY") or os.getenv("no_proxy"),
|
||||
|
||||
-- 如果需要手动指定代理,可以取消下面的注释并修改为你的代理地址:
|
||||
-- HTTP_PROXY = "http://127.0.0.1:7890",
|
||||
-- HTTPS_PROXY = "http://127.0.0.1:7890",
|
||||
-- 或者使用 SOCKS5 代理:
|
||||
-- ALL_PROXY = "socks5://127.0.0.1:7890",
|
||||
},
|
||||
-- 不设置 auth_method,让 CLI 自动使用已缓存的 OAuth 凭证
|
||||
}
|
||||
|
||||
-- 可选:配置其他 Gemini provider 设置(用于非 ACP 模式)
|
||||
-- 确保 providers 表中没有 claude 的配置
|
||||
opts.providers = opts.providers or {}
|
||||
if opts.providers.claude then
|
||||
opts.providers.claude = nil
|
||||
end
|
||||
|
||||
-- 可选:配置其他 Gemini provider 设置(用于非 ACP 模式)
|
||||
opts.providers.gemini = opts.providers.gemini or {
|
||||
-- 如果将来需要使用 REST API 模式,可以在这里配置
|
||||
-- api_key = os.getenv("GEMINI_API_KEY"),
|
||||
}
|
||||
|
||||
-- 调试:打印当前配置的 provider(可选,用于验证)
|
||||
-- vim.notify("Avante provider set to: " .. opts.provider, vim.log.levels.INFO)
|
||||
|
||||
return opts
|
||||
end,
|
||||
-- LazyVim 会自动调用 setup,这里不需要再次调用
|
||||
-- 但如果需要验证,可以取消下面的注释
|
||||
-- config = function(_, opts)
|
||||
-- vim.defer_fn(function()
|
||||
-- local avante = require("avante")
|
||||
-- if avante and avante.config then
|
||||
-- local current_provider = avante.config.provider or "unknown"
|
||||
-- vim.notify("Avante provider: " .. current_provider, vim.log.levels.INFO)
|
||||
-- end
|
||||
-- end, 1000)
|
||||
-- end,
|
||||
-- 确保在 LazyVim 的配置之后加载
|
||||
priority = 1000,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user