Files
Panama/config/dot/nvim/lua/plugins/avante.lua

273 lines
7.7 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
return {
'yetone/avante.nvim',
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
-- ⚠️ must add this setting! ! !
build = vim.fn.has('win32') ~= 0
and 'powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false'
or 'make',
event = 'VeryLazy',
version = false, -- Never set this value to '*'! Never!
---@module 'avante'
---@type avante.Config
opts = {
instructions_file = 'avante.md',
provider = 'claude',
auto_suggestions_provider = 'claude',
providers = {
claude = {
endpoint = 'https://api.anthropic.com',
model = 'claude-sonnet-4-5-20250929',
timeout = 30000,
extra_request_body = {
temperature = 0.75,
max_tokens = 20480,
},
},
openai = {
endpoint = 'https://api.openai.com/v1',
model = 'gpt-5.2',
extra_request_body = {
temperature = 1,
max_completion_tokens = 8192,
},
},
},
acp_providers = {
["claude-code"] = {
command = "npx",
args = { "@zed-industries/claude-code-acp" },
env = {
NODE_NO_WARNINGS = "1",
ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY"),
},
},
},
rag_service = {
enabled = true,
host_path = '/home/gib/Documents/Code',
runner = 'docker',
llm = {
provider = 'openai',
endpoint = 'https://api.openai.com/v1',
api_key = 'OPENAI_API_KEY',
model = 'gpt-5-mini',
extra = {
temperature = 1,
max_tokens = 512,
},
},
embed = {
provider = 'openai',
endpoint = 'https://api.openai.com/v1',
api_key = 'OPENAI_API_KEY',
model = 'text-embedding-3-large',
extra = nil,
},
docker_extra_args = '',
},
web_search_engine = {
provider = 'searxng',
proxy = nil,
},
system_prompt = function()
local hub = require('mcphub').get_hub_instance()
return hub and hub:get_active_servers_prompt() or ''
end,
custom_tools = function()
return {
require('mcphub.extensions.avante').mcp_tool(),
}
end,
behaviour = {
auto_suggestions = false,
auto_set_highlight_group = true,
auto_set_keymaps = true,
auto_apply_diff_after_generation = false,
support_paste_from_clipboard = true,
minimize_diff = true,
enable_token_counting = true,
auto_approve_tool_permissions = true,
},
prompt_logger = {
enabled = true,
log_dir = vim.fn.stdpath("cache") .. "/avante_prompts", -- directory where logs are saved
fortune_cookie_on_success = false, -- shows a random fortune after each logged prompt (requires `fortune` installed)
next_prompt = {
normal = "<C-n>", -- load the next (newer) prompt log in normal mode
insert = "<C-n>",
},
prev_prompt = {
normal = "<C-p>", -- load the previous (older) prompt log in normal mode
insert = "<C-p>",
},
},
mappings = {
--- @class AvanteConflictMappings
diff = {
ours = 'co',
theirs = 'ct',
all_theirs = 'ca',
both = 'cb',
cursor = 'cc',
next = ']x',
prev = '[x',
},
suggestion = {
accept = '<M-l>',
next = '<M-]>',
prev = '<M-[>',
dismiss = '<C-]>',
},
jump = {
next = ']]',
prev = '[[',
},
submit = {
normal = '<CR>',
insert = '<C-s>',
},
cancel = {
normal = { '<C-c>', '<Esc>', 'q' },
insert = { '<C-c>' },
},
sidebar = {
apply_all = 'A',
apply_cursor = 'a',
retry_user_request = 'r',
edit_user_request = 'e',
switch_windows = '<Tab>',
reverse_switch_windows = '<S-Tab>',
remove_file = 'd',
add_file = '@',
close = { '<Esc>', 'q' },
close_from_input = nil,
},
},
selection = {
enabled = true,
hint_display = 'delayed',
},
hints = { enabled = true },
windows = {
---@type "right" | "left" | "top" | "bottom"
position = "right", -- the position of the sidebar
wrap = true, -- similar to vim.o.wrap
width = 30, -- default % based on available width
sidebar_header = {
enabled = true, -- true, false to enable/disable the header
align = "center", -- left, center, right for title
rounded = true,
},
spinner = {
editing = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
generating = { "·", "", "", "", "", "" }, -- Spinner characters for the 'generating' state
thinking = { "🤯", "🙄" }, -- Spinner characters for the 'thinking' state
},
input = {
prefix = "> ",
height = 8, -- Height of the input window in vertical layout
},
edit = {
border = "rounded",
start_insert = true, -- Start insert mode when opening the edit window
},
ask = {
floating = false, -- Open the 'AvanteAsk' prompt in a floating window
start_insert = true, -- Start insert mode when opening the ask window
border = "rounded",
---@type "ours" | "theirs"
focus_on_apply = "ours", -- which diff to focus after applying
},
},
highlights = {
diff = {
current = 'DiffText',
incoming = 'DiffAdd',
},
},
--- @class AvanteConflictUserConfig
diff = {
autojump = true,
---@type string | fun(): any
list_opener = 'copen',
override_timeoutlen = 500,
},
suggestion = {
debounce = 600,
throttle = 600,
},
},
dependencies = {
{ 'nvim-lua/plenary.nvim' },
{ 'MunifTanjim/nui.nvim' },
{ 'hrsh7th/nvim-cmp' },
{ 'nvim-treesitter/nvim-treesitter' },
{ 'stevearc/dressing.nvim' },
{ 'nvim-tree/nvim-web-devicons' },
{ 'folke/snacks.nvim' },
{
'ravitemer/mcphub.nvim',
build = "npm install -g mcp-hub@latest",
config = function()
require'mcphub'.setup({
config = vim.fn.expand('/home/gib/.config/mcphub/servers.json'),
port = 37373,
shutdown_delay = 60 * 10 * 000,
use_bundled_binary = false,
mcp_request_timeout = 60000,
auto_approve = true,
auto_toggle_mcp_servers = true,
extensions = {
avante = {
make_slash_commands = true,
},
},
native_servers = {},
ui = {
window = {
width = 0.8,
height = 0.8,
align = 'center',
relative = 'editor',
zindex = 50,
border = 'rounded',
},
wo = {
winhl = 'Normal:MCPHubNormal,FloatBorder:MCPHubBorder',
},
},
log = {
level = vim.log.levels.WARN,
to_file = false,
file_path = nil,
prefix = 'MCPHub',
},
})
end
},
{
-- support for image pasting
'HakonHarnes/img-clip.nvim',
event = 'VeryLazy',
opts = {
-- recommended settings
default = {
embed_image_as_base64 = false,
prompt_for_file_name = false,
drag_and_drop = {
insert_mode = true,
},
},
},
},
{
'MeanderingProgrammer/render-markdown.nvim',
opts = {
file_types = { 'markdown', 'Avante' },
},
ft = { 'markdown', 'Avante' },
},
},
}