mirror of
https://github.com/marcogll/omarchy_setup.git
synced 2026-01-13 21:35:16 +00:00
- Integrated mg_dotfiles as regular directory (not submodule) - Added .zshrc.local.example template for local configs without secrets - Added mg_dotfiles/zsh/.zshrc.local to .gitignore to protect API keys - Updated README to reflect mg_dotfiles integration and new structure - Added nvim configuration directory with LazyVim setup
241 lines
9.8 KiB
Lua
241 lines
9.8 KiB
Lua
return {
|
|
{
|
|
"yetone/avante.nvim",
|
|
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
|
|
-- ⚠️ must add this setting! ! !
|
|
build = function()
|
|
-- conditionally use the correct build system for the current OS
|
|
if vim.fn.has("win32") == 1 then
|
|
return "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false"
|
|
else
|
|
return "make"
|
|
end
|
|
end,
|
|
event = "VeryLazy",
|
|
version = false, -- Never set this value to "*"! Never!
|
|
---@module 'avante'
|
|
---@type avante.Config
|
|
opts = function(_, opts)
|
|
-- Track avante's internal state during resize
|
|
local in_resize = false
|
|
local original_cursor_win = nil
|
|
local avante_filetypes = { "Avante", "AvanteInput", "AvanteAsk", "AvanteSelectedFiles" }
|
|
|
|
-- Check if current window is avante
|
|
local function is_in_avante_window()
|
|
local win = vim.api.nvim_get_current_win()
|
|
local buf = vim.api.nvim_win_get_buf(win)
|
|
local ft = vim.api.nvim_buf_get_option(buf, "filetype")
|
|
|
|
for _, avante_ft in ipairs(avante_filetypes) do
|
|
if ft == avante_ft then
|
|
return true, win, ft
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
-- Temporarily move cursor away from avante during resize
|
|
local function temporarily_leave_avante()
|
|
local is_avante, avante_win, avante_ft = is_in_avante_window()
|
|
if is_avante and not in_resize then
|
|
in_resize = true
|
|
original_cursor_win = avante_win
|
|
|
|
-- Find a non-avante window to switch to
|
|
local target_win = nil
|
|
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
|
local buf = vim.api.nvim_win_get_buf(win)
|
|
local ft = vim.api.nvim_buf_get_option(buf, "filetype")
|
|
|
|
local is_avante_ft = false
|
|
for _, aft in ipairs(avante_filetypes) do
|
|
if ft == aft then
|
|
is_avante_ft = true
|
|
break
|
|
end
|
|
end
|
|
|
|
if not is_avante_ft and vim.api.nvim_win_is_valid(win) then
|
|
target_win = win
|
|
break
|
|
end
|
|
end
|
|
|
|
-- Switch to non-avante window if found
|
|
if target_win then
|
|
vim.api.nvim_set_current_win(target_win)
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
-- Restore cursor to original avante window
|
|
local function restore_cursor_to_avante()
|
|
if in_resize and original_cursor_win and vim.api.nvim_win_is_valid(original_cursor_win) then
|
|
-- Small delay to ensure resize is complete
|
|
vim.defer_fn(function()
|
|
pcall(vim.api.nvim_set_current_win, original_cursor_win)
|
|
in_resize = false
|
|
original_cursor_win = nil
|
|
end, 50)
|
|
end
|
|
end
|
|
|
|
-- Prevent duplicate windows cleanup
|
|
local function cleanup_duplicate_avante_windows()
|
|
local seen_filetypes = {}
|
|
local windows_to_close = {}
|
|
|
|
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
|
local buf = vim.api.nvim_win_get_buf(win)
|
|
local ft = vim.api.nvim_buf_get_option(buf, "filetype")
|
|
|
|
-- Special handling for Ask and Select Files panels
|
|
if ft == "AvanteAsk" or ft == "AvanteSelectedFiles" then
|
|
if seen_filetypes[ft] then
|
|
-- Found duplicate, mark for closing
|
|
table.insert(windows_to_close, win)
|
|
else
|
|
seen_filetypes[ft] = win
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Close duplicate windows
|
|
for _, win in ipairs(windows_to_close) do
|
|
if vim.api.nvim_win_is_valid(win) then
|
|
pcall(vim.api.nvim_win_close, win, true)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Create autocmd group for resize fix
|
|
vim.api.nvim_create_augroup("AvanteResizeFix", { clear = true })
|
|
|
|
-- Main resize handler for Resize
|
|
vim.api.nvim_create_autocmd({ "VimResized" }, {
|
|
group = "AvanteResizeFix",
|
|
callback = function()
|
|
-- Move cursor away from avante before resize processing
|
|
local moved = temporarily_leave_avante()
|
|
|
|
if moved then
|
|
-- Let resize happen, then restore cursor
|
|
vim.defer_fn(function()
|
|
restore_cursor_to_avante()
|
|
-- Force a clean redraw
|
|
vim.cmd("redraw!")
|
|
end, 100)
|
|
end
|
|
|
|
-- Cleanup duplicates after resize completes
|
|
vim.defer_fn(cleanup_duplicate_avante_windows, 150)
|
|
end,
|
|
})
|
|
|
|
-- Prevent avante from responding to scroll/resize events during resize
|
|
vim.api.nvim_create_autocmd({ "WinScrolled", "WinResized" }, {
|
|
group = "AvanteResizeFix",
|
|
pattern = "*",
|
|
callback = function(args)
|
|
local buf = args.buf
|
|
if buf and vim.api.nvim_buf_is_valid(buf) then
|
|
local ft = vim.api.nvim_buf_get_option(buf, "filetype")
|
|
|
|
for _, avante_ft in ipairs(avante_filetypes) do
|
|
if ft == avante_ft then
|
|
-- Prevent event propagation for avante buffers during resize
|
|
if in_resize then
|
|
return true -- This should stop the event
|
|
end
|
|
break
|
|
end
|
|
end
|
|
end
|
|
end,
|
|
})
|
|
|
|
-- Additional cleanup on focus events
|
|
vim.api.nvim_create_autocmd("FocusGained", {
|
|
group = "AvanteResizeFix",
|
|
callback = function()
|
|
-- Reset resize state on focus gain
|
|
in_resize = false
|
|
original_cursor_win = nil
|
|
-- Clean up any duplicate windows
|
|
vim.defer_fn(cleanup_duplicate_avante_windows, 100)
|
|
end,
|
|
})
|
|
|
|
return {
|
|
-- add any opts here
|
|
-- for example
|
|
provider = "copilot",
|
|
providers = {
|
|
copilot = {
|
|
model = "claude-sonnet-4",
|
|
},
|
|
},
|
|
cursor_applying_provider = "copilot",
|
|
auto_suggestions_provider = "copilot",
|
|
behaviour = {
|
|
enable_cursor_planning_mode = true,
|
|
},
|
|
-- File selector configuration
|
|
--- @alias FileSelectorProvider "native" | "fzf" | "mini.pick" | "snacks" | "telescope" | string
|
|
file_selector = {
|
|
provider = "snacks", -- Avoid native provider issues
|
|
provider_opts = {},
|
|
},
|
|
windows = {
|
|
---@type "right" | "left" | "top" | "bottom" | "smart"
|
|
position = "left", -- 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 = false,
|
|
},
|
|
input = {
|
|
prefix = "> ",
|
|
height = 8, -- Height of the input window in vertical layout
|
|
},
|
|
edit = {
|
|
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
|
|
---@type "ours" | "theirs"
|
|
focus_on_apply = "ours", -- which diff to focus after applying
|
|
},
|
|
},
|
|
system_prompt = "Este GPT es un clon del usuario, un arquitecto líder frontend especializado en Angular y React, con experiencia en arquitectura limpia, arquitectura hexagonal y separación de lógica en aplicaciones escalables. Tiene un enfoque técnico pero práctico, con explicaciones claras y aplicables, siempre con ejemplos útiles para desarrolladores con conocimientos intermedios y avanzados.\n\nHabla con un tono profesional pero cercano, relajado y con un toque de humor inteligente. Evita formalidades excesivas y usa un lenguaje directo, técnico cuando es necesario, pero accesible. Su estilo es argentino, sin caer en clichés, y utiliza expresiones como 'buenas acá estamos' o 'dale que va' según el contexto.\n\nSus principales áreas de conocimiento incluyen:\n- Desarrollo frontend con Angular, React y gestión de estado avanzada (Redux, Signals, State Managers propios como Gentleman State Manager y GPX-Store).\n- Arquitectura de software con enfoque en Clean Architecture, Hexagonal Architecure y Scream Architecture.\n- Implementación de buenas prácticas en TypeScript, testing unitario y end-to-end.\n- Loco por la modularización, atomic design y el patrón contenedor presentacional \n- Herramientas de productividad como LazyVim, Tmux, Zellij, OBS y Stream Deck.\n- Mentoría y enseñanza de conceptos avanzados de forma clara y efectiva.\n- Liderazgo de comunidades y creación de contenido en YouTube, Twitch y Discord.\n\nA la hora de explicar un concepto técnico:\n1. Explica el problema que el usuario enfrenta.\n2. Propone una solución clara y directa, con ejemplos si aplica.\n3. Menciona herramientas o recursos que pueden ayudar.\n\nSi el tema es complejo, usa analogías prácticas, especialmente relacionadas con construcción y arquitectura. Si menciona una herramienta o concepto, explica su utilidad y cómo aplicarlo sin redundancias.\n\nAdemás, tiene experiencia en charlas técnicas y generación de contenido. Puede hablar sobre la importancia de la introspección, có...",
|
|
}
|
|
end,
|
|
dependencies = {
|
|
"MunifTanjim/nui.nvim",
|
|
{
|
|
-- 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,
|
|
},
|
|
-- required for Windows users
|
|
use_absolute_path = true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|