Files
trade-iac/ansible/files/operator-dotfiles/nvim/lua/plugins.lua

192 lines
4.7 KiB
Lua

-- ======================================================================
-- plugins.lua — Plugin specifications for lazy.nvim
-- ======================================================================
return {
-- File explorer
{
"preservim/nerdtree",
cmd = { "NERDTree", "NERDTreeToggle", "NERDTreeFind", "NERDTreeFocus" },
},
-- Git integration
{
"tpope/vim-fugitive",
event = "VeryLazy",
},
-- Commenting
{
"tpope/vim-commentary",
event = "VeryLazy",
},
-- LSP and completion
{
"neoclide/coc.nvim",
branch = "release",
build = "npm ci",
event = "VeryLazy",
},
-- REPL integration (tmux)
{
"jpalardy/vim-slime",
init = function()
vim.g.slime_target = "tmux"
if vim.fn.exists("g:slime_python_ipython") == 0 then
vim.g.slime_python_ipython = 1
end
end,
},
-- OSC52 clipboard (remote SSH/tmux)
{
"ojroques/vim-oscyank",
event = "VimEnter",
init = function()
vim.g.oscyank_term = "tmux"
vim.g.oscyank_silent = true
end,
config = function()
local grp = vim.api.nvim_create_augroup("osc52_yank", { clear = true })
vim.api.nvim_create_autocmd("TextYankPost", {
group = grp,
callback = function()
if vim.v.event.operator == "y" and vim.v.event.regname == "" then
vim.cmd([[OSCYankRegister "]])
end
end,
})
end,
},
-- Debugging (DAP)
{
"mfussenegger/nvim-dap",
config = function()
local dap = require("dap")
dap.adapters.gdb = {
type = "executable",
command = "gdb-multiarch",
args = { "-i", "dap" },
}
local function pick_elf()
return vim.fn.input("ELF: ", vim.fn.getcwd() .. "/", "file")
end
local function normalize_target(t)
t = t or ""
if vim.trim then
t = vim.trim(t)
else
t = t:gsub("^%s+", ""):gsub("%s+$", "")
end
t = t:gsub("^target%s+extended%-remote%s+", "")
t = t:gsub("^target%s+remote%s+", "")
t = t:gsub("^extended%-remote%s+", "")
t = t:gsub("^remote%s+", "")
return t
end
local function pick_target()
local default = normalize_target(vim.env.HAZARD3_GDB_TARGET)
if default == "" then
default = "localhost:3333"
end
return normalize_target(vim.fn.input("GDB target (host:port): ", default))
end
local hazard3_attach = {
name = "Hazard3 (attach gdb-remote)",
type = "gdb",
request = "attach",
program = pick_elf,
target = pick_target,
cwd = "${workspaceFolder}",
}
local function add_cfg(ft, cfg)
dap.configurations[ft] = dap.configurations[ft] or {}
for _, existing in ipairs(dap.configurations[ft]) do
if existing.name == cfg.name then
return
end
end
table.insert(dap.configurations[ft], cfg)
end
for _, ft in ipairs({ "c", "cpp", "asm", "" }) do
add_cfg(ft, hazard3_attach)
end
pcall(function()
vim.api.nvim_create_user_command("Hazard3Attach", function()
dap.run(hazard3_attach)
end, { desc = "DAP: Hazard3 attach" })
end)
vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticError" })
vim.fn.sign_define("DapStopped", { text = "", texthl = "DiagnosticInfo", linehl = "Visual" })
pcall(function()
require("hazard3_dap").setup()
end)
end,
},
{
"rcarriga/nvim-dap-ui",
dependencies = {
"mfussenegger/nvim-dap",
"nvim-neotest/nvim-nio",
},
config = function()
local dap = require("dap")
local dapui = require("dapui")
dapui.setup({
-- ASCII/unicode-friendly icons (no codicons required)
icons = { expanded = "v", collapsed = ">", current_frame = ">" },
controls = {
enabled = true,
element = "repl",
icons = {
pause = "||",
play = ">",
step_into = "",
step_over = "",
step_out = "",
step_back = "",
run_last = "",
terminate = "X",
disconnect = "D",
},
},
})
dap.listeners.after.event_initialized["dapui"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui"] = function()
dapui.close()
end
end,
},
{
"theHamsta/nvim-dap-virtual-text",
dependencies = {
"mfussenegger/nvim-dap",
},
opts = {},
},
}