feat: initial commit
- basic config according to spec
This commit is contained in:
commit
9b0446c5f6
36 files changed
+1114
No files matched your search
@@ -0,0 +1,93 @@
|
||||
-- Completion: minuet against a local llama-server, no cloud fallback.
|
||||
-- Agent: sidekick hosts my own agent CLI in a terminal split.
|
||||
local full = vim.g.profile == "full"
|
||||
local endpoint = vim.env.MINUET_ENDPOINT or "http://127.0.0.1:8012"
|
||||
|
||||
local function allowed(buf)
|
||||
buf = buf or vim.api.nvim_get_current_buf()
|
||||
local name = vim.api.nvim_buf_get_name(buf)
|
||||
local base = vim.fs.basename(name)
|
||||
return not (
|
||||
vim.b[buf].bigfile
|
||||
or vim.bo[buf].filetype == "gitcommit"
|
||||
or base:match("^%.env")
|
||||
or name:match("/secrets/")
|
||||
)
|
||||
end
|
||||
|
||||
local function agent(fn, opts)
|
||||
return function()
|
||||
require("sidekick.cli")[fn](vim.tbl_extend("force", { name = "agent" }, opts or {}))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"milanglacier/minuet-ai.nvim",
|
||||
cond = full,
|
||||
lazy = true, -- loaded by blink.cmp
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
keys = {
|
||||
{ "<leader>ta", "<cmd>Minuet blink toggle<cr>", desc = "Toggle AI completion" },
|
||||
},
|
||||
opts = {
|
||||
provider = "openai_fim_compatible",
|
||||
n_completions = 1,
|
||||
context_window = 4096,
|
||||
throttle = 1000,
|
||||
debounce = 400,
|
||||
request_timeout = 3,
|
||||
enable_predicates = {
|
||||
function()
|
||||
return allowed()
|
||||
end,
|
||||
},
|
||||
provider_options = {
|
||||
openai_fim_compatible = {
|
||||
name = "llama.cpp",
|
||||
api_key = "TERM", -- llama-server needs no key; any set env var works
|
||||
end_point = endpoint .. "/v1/completions",
|
||||
model = "qwen2.5-coder:3b",
|
||||
optional = { max_tokens = 56, top_p = 0.9 },
|
||||
template = {
|
||||
prompt = function(before, after, _)
|
||||
return "<|fim_prefix|>" .. before .. "<|fim_suffix|>" .. after .. "<|fim_middle|>"
|
||||
end,
|
||||
suffix = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"folke/sidekick.nvim",
|
||||
cond = full,
|
||||
keys = {
|
||||
{ "<C-.>", function() require("sidekick.cli").focus() end, desc = "Focus agent", mode = { "n", "t", "i", "x" } },
|
||||
{ "<leader>aa", agent("toggle", { focus = true }), desc = "Toggle agent" },
|
||||
{ "<leader>as", function() require("sidekick.cli").select() end, desc = "Select CLI session" },
|
||||
{ "<leader>at", agent("send", { msg = "{this}" }), desc = "Send this", mode = { "n", "x" } },
|
||||
{ "<leader>af", agent("send", { msg = "{file}" }), desc = "Send file" },
|
||||
{ "<leader>av", agent("send", { msg = "{selection}" }), desc = "Send selection", mode = "x" },
|
||||
{ "<leader>ap", agent("prompt"), desc = "Pick prompt", mode = { "n", "x" } },
|
||||
{ "<leader>ad", function() require("sidekick.cli").close() end, desc = "Detach session" },
|
||||
},
|
||||
opts = {
|
||||
nes = { enabled = false }, -- needs Copilot
|
||||
cli = {
|
||||
watch = true,
|
||||
mux = { enabled = false },
|
||||
win = { layout = "right", split = { width = 80 } },
|
||||
tools = {
|
||||
agent = { cmd = vim.split(vim.env.NVIM_AGENT_CMD or "agent", " ", { trimempty = true }) },
|
||||
},
|
||||
prompts = {
|
||||
review = "Review the current git diff (run `git diff`) for bugs, risks and simplifications.",
|
||||
explain = "Explain {this}",
|
||||
fix = "Fix these diagnostics in {file}:\n{diagnostics}",
|
||||
tests = "Write tests for {this}",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
-- All three installed; only the active one loads. lazy.nvim loads the others
|
||||
-- on :colorscheme.
|
||||
local schemes = { "catppuccin", "tokyonight", "kanagawa" }
|
||||
|
||||
local function cycle()
|
||||
local current = vim.g.colors_name or ""
|
||||
local idx = 1
|
||||
for i, name in ipairs(schemes) do
|
||||
if current:find("^" .. name) then
|
||||
idx = i
|
||||
end
|
||||
end
|
||||
local next = schemes[idx % #schemes + 1]
|
||||
vim.cmd.colorscheme(next)
|
||||
vim.notify("colorscheme: " .. next)
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
init = function()
|
||||
vim.keymap.set("n", "<leader>tc", cycle, { desc = "Cycle colorscheme" })
|
||||
end,
|
||||
config = function()
|
||||
require("catppuccin").setup({})
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
end,
|
||||
},
|
||||
{ "folke/tokyonight.nvim", lazy = true },
|
||||
{ "rebelot/kanagawa.nvim", lazy = true },
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
return {
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
version = "1.*",
|
||||
cond = vim.g.profile == "full",
|
||||
event = { "InsertEnter", "CmdlineEnter" },
|
||||
dependencies = { "rafamadriz/friendly-snippets", "milanglacier/minuet-ai.nvim" },
|
||||
opts = function()
|
||||
return {
|
||||
keymap = {
|
||||
preset = "default",
|
||||
["<A-y>"] = require("minuet").make_blink_map(),
|
||||
},
|
||||
snippets = { preset = "default" }, -- built-in vim.snippet
|
||||
sources = {
|
||||
default = { "lsp", "path", "snippets", "buffer", "minuet" },
|
||||
providers = {
|
||||
minuet = {
|
||||
name = "minuet",
|
||||
module = "minuet.blink",
|
||||
async = true,
|
||||
timeout_ms = 3000,
|
||||
score_offset = 50,
|
||||
},
|
||||
},
|
||||
},
|
||||
completion = { trigger = { prefetch_on_insert = false } },
|
||||
fuzzy = { implementation = "prefer_rust" },
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
-- Adapter paths come from the home-manager module (NVIM_* variables).
|
||||
local function setup_adapters(dap)
|
||||
local env = vim.env
|
||||
|
||||
-- Rust
|
||||
dap.adapters.codelldb = { type = "executable", command = env.NVIM_CODELLDB or "codelldb" }
|
||||
dap.configurations.rust = {
|
||||
{
|
||||
name = "Launch binary",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input("Binary: ", vim.fn.getcwd() .. "/target/debug/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
},
|
||||
}
|
||||
|
||||
-- Go
|
||||
dap.adapters.delve = {
|
||||
type = "server",
|
||||
port = "${port}",
|
||||
executable = { command = "dlv", args = { "dap", "-l", "127.0.0.1:${port}" } },
|
||||
}
|
||||
dap.configurations.go = {
|
||||
{ name = "Debug file", type = "delve", request = "launch", program = "${file}" },
|
||||
{ name = "Debug package", type = "delve", request = "launch", program = "${fileDirname}" },
|
||||
{ name = "Debug test", type = "delve", request = "launch", mode = "test", program = "${fileDirname}" },
|
||||
}
|
||||
|
||||
-- TypeScript / JavaScript
|
||||
dap.adapters["pwa-node"] = {
|
||||
type = "server",
|
||||
host = "127.0.0.1",
|
||||
port = "${port}",
|
||||
executable = { command = "js-debug", args = { "${port}", "127.0.0.1" } },
|
||||
}
|
||||
local js = {
|
||||
{ name = "Launch file", type = "pwa-node", request = "launch", program = "${file}", cwd = "${workspaceFolder}" },
|
||||
{ name = "Attach", type = "pwa-node", request = "attach", processId = require("dap.utils").pick_process },
|
||||
}
|
||||
for _, ft in ipairs({ "javascript", "typescript", "javascriptreact", "typescriptreact" }) do
|
||||
dap.configurations[ft] = js
|
||||
end
|
||||
|
||||
-- Python
|
||||
dap.adapters.python = {
|
||||
type = "executable",
|
||||
command = env.NVIM_DEBUGPY_PYTHON or "python3",
|
||||
args = { "-m", "debugpy.adapter" },
|
||||
}
|
||||
dap.configurations.python = {
|
||||
{
|
||||
name = "Launch file",
|
||||
type = "python",
|
||||
request = "launch",
|
||||
program = "${file}",
|
||||
pythonPath = function()
|
||||
local venv = env.VIRTUAL_ENV or (vim.fn.getcwd() .. "/.venv")
|
||||
local py = venv .. "/bin/python"
|
||||
return vim.fn.executable(py) == 1 and py or "python3"
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
-- PHP (Xdebug)
|
||||
dap.adapters.php = {
|
||||
type = "executable",
|
||||
command = env.NVIM_NODE or "node",
|
||||
args = { env.NVIM_PHP_DEBUG },
|
||||
}
|
||||
dap.configurations.php = {
|
||||
{ name = "Listen for Xdebug", type = "php", request = "launch", port = 9003 },
|
||||
}
|
||||
end
|
||||
|
||||
local function dap(fn)
|
||||
return function()
|
||||
require("dap")[fn]()
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
cond = vim.g.profile == "full",
|
||||
dependencies = { "rcarriga/nvim-dap-ui", "nvim-neotest/nvim-nio" },
|
||||
keys = {
|
||||
{ "<leader>db", dap("toggle_breakpoint"), desc = "Toggle breakpoint" },
|
||||
{ "<leader>dc", dap("continue"), desc = "Continue" },
|
||||
{ "<leader>di", dap("step_into"), desc = "Step into" },
|
||||
{ "<leader>do", dap("step_over"), desc = "Step over" },
|
||||
{ "<leader>dO", dap("step_out"), desc = "Step out" },
|
||||
{ "<leader>dq", dap("terminate"), desc = "Terminate" },
|
||||
{ "<leader>du", function() require("dapui").toggle() end, desc = "Toggle debug UI" },
|
||||
},
|
||||
config = function()
|
||||
local d, ui = require("dap"), require("dapui")
|
||||
ui.setup()
|
||||
d.listeners.after.event_initialized.dapui = ui.open
|
||||
d.listeners.before.event_terminated.dapui = ui.close
|
||||
d.listeners.before.event_exited.dapui = ui.close
|
||||
setup_adapters(d)
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
return {
|
||||
{
|
||||
"nvim-mini/mini.ai",
|
||||
event = "VeryLazy",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter-textobjects" },
|
||||
config = function()
|
||||
local ai = require("mini.ai")
|
||||
ai.setup({
|
||||
n_lines = 500,
|
||||
custom_textobjects = {
|
||||
f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }),
|
||||
c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }),
|
||||
},
|
||||
-- No bracket motions (QWERTZ).
|
||||
mappings = { goto_left = "", goto_right = "" },
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-mini/mini.surround",
|
||||
event = "VeryLazy",
|
||||
-- gz prefix so the built-in `s` stays untouched.
|
||||
opts = {
|
||||
mappings = {
|
||||
add = "gza",
|
||||
delete = "gzd",
|
||||
find = "gzf",
|
||||
find_left = "gzF",
|
||||
highlight = "gzh",
|
||||
replace = "gzr",
|
||||
update_n_lines = "gzn",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-mini/mini.pairs",
|
||||
event = "InsertEnter",
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
return {
|
||||
{
|
||||
"stevearc/oil.nvim",
|
||||
cmd = "Oil",
|
||||
keys = { { "-", "<cmd>Oil<cr>", desc = "Open parent directory" } },
|
||||
init = function()
|
||||
-- Load at startup only when nvim was opened on a directory.
|
||||
local arg = vim.fn.argc() == 1 and vim.fn.argv(0)
|
||||
local stat = arg and vim.uv.fs_stat(arg)
|
||||
if stat and stat.type == "directory" then
|
||||
require("lazy").load({ plugins = { "oil.nvim" } })
|
||||
end
|
||||
end,
|
||||
opts = { default_file_explorer = true },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
return {
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
cond = vim.g.profile == "full",
|
||||
event = "BufWritePre",
|
||||
cmd = "ConformInfo",
|
||||
keys = {
|
||||
{
|
||||
"<leader>lf",
|
||||
function()
|
||||
require("conform").format({ async = true, lsp_format = "fallback" })
|
||||
end,
|
||||
desc = "Format buffer",
|
||||
},
|
||||
{
|
||||
"<leader>tF",
|
||||
function()
|
||||
vim.b.disable_autoformat = not vim.b.disable_autoformat
|
||||
vim.notify("format on save: " .. (vim.b.disable_autoformat and "off" or "on"))
|
||||
end,
|
||||
desc = "Toggle format on save (buffer)",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
nix = { "nixfmt" },
|
||||
lua = { "stylua" },
|
||||
sh = { "shfmt" },
|
||||
bash = { "shfmt" },
|
||||
yaml = { "prettierd" },
|
||||
json = { "prettierd" },
|
||||
jsonc = { "prettierd" },
|
||||
markdown = { "prettierd" },
|
||||
rust = { "rustfmt" },
|
||||
go = { "goimports", "gofumpt" },
|
||||
javascript = { "prettierd" },
|
||||
javascriptreact = { "prettierd" },
|
||||
typescript = { "prettierd" },
|
||||
typescriptreact = { "prettierd" },
|
||||
python = { "ruff_format" },
|
||||
php = { "php_cs_fixer" },
|
||||
},
|
||||
format_on_save = function(buf)
|
||||
if vim.b[buf].disable_autoformat or vim.b[buf].bigfile then
|
||||
return
|
||||
end
|
||||
return { timeout_ms = 1000, lsp_format = "fallback" }
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
return {
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
opts = {
|
||||
on_attach = function(buf)
|
||||
local gs = require("gitsigns")
|
||||
local function map(mode, lhs, rhs, desc)
|
||||
vim.keymap.set(mode, lhs, rhs, { buffer = buf, desc = desc })
|
||||
end
|
||||
map("n", "<leader>gs", gs.stage_hunk, "Stage hunk")
|
||||
map("n", "<leader>gr", gs.reset_hunk, "Reset hunk")
|
||||
map("x", "<leader>gs", function()
|
||||
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||
end, "Stage selection")
|
||||
map("x", "<leader>gr", function()
|
||||
gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||
end, "Reset selection")
|
||||
map("n", "<leader>gb", gs.blame_line, "Blame line")
|
||||
map("n", "<leader>gp", gs.preview_hunk, "Preview hunk")
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
-- Only linters that don't run as an LSP.
|
||||
return {
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
cond = vim.g.profile == "full",
|
||||
event = { "BufReadPost", "BufNewFile", "BufWritePost" },
|
||||
config = function()
|
||||
local lint = require("lint")
|
||||
lint.linters_by_ft = { go = { "golangcilint" } }
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufReadPost", "BufWritePost", "InsertLeave" }, {
|
||||
group = vim.api.nvim_create_augroup("plugins.lint", { clear = true }),
|
||||
callback = function(ev)
|
||||
if vim.b[ev.buf].bigfile then
|
||||
return
|
||||
end
|
||||
lint.try_lint()
|
||||
if vim.bo[ev.buf].filetype == "php" and vim.fs.root(ev.buf, "phpstan.neon") then
|
||||
lint.try_lint("phpstan")
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
cond = vim.g.profile == "full",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = { "b0o/SchemaStore.nvim" },
|
||||
config = function()
|
||||
require("core.lsp").setup()
|
||||
end,
|
||||
},
|
||||
{ "b0o/SchemaStore.nvim", lazy = true },
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
{
|
||||
"MeanderingProgrammer/render-markdown.nvim",
|
||||
cond = vim.g.profile == "full",
|
||||
ft = "markdown",
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
-- snacks.nvim: only picker, lazygit, terminal and image are used.
|
||||
-- fff handles files and grep in the full profile; if its native library was
|
||||
-- not built (or in slim), those maps fall back to snacks.picker.
|
||||
local full = vim.g.profile == "full"
|
||||
|
||||
local fff_built
|
||||
local function use_fff()
|
||||
if fff_built == nil then
|
||||
fff_built = false
|
||||
local plugin = full and require("lazy.core.config").plugins["fff.nvim"]
|
||||
if plugin then
|
||||
local ext = jit.os == "OSX" and "dylib" or "so"
|
||||
fff_built = vim.uv.fs_stat(plugin.dir .. "/target/release/libfff_nvim." .. ext) ~= nil
|
||||
end
|
||||
end
|
||||
return fff_built
|
||||
end
|
||||
|
||||
local function files()
|
||||
if use_fff() then
|
||||
require("fff").find_files()
|
||||
else
|
||||
Snacks.picker.files()
|
||||
end
|
||||
end
|
||||
|
||||
local function grep()
|
||||
if use_fff() then
|
||||
require("fff").live_grep()
|
||||
else
|
||||
Snacks.picker.grep()
|
||||
end
|
||||
end
|
||||
|
||||
local keys = {
|
||||
{ "<leader>ff", files, desc = "Find files" },
|
||||
{ "<leader>fg", grep, desc = "Live grep" },
|
||||
{ "<leader>fw", function() Snacks.picker.grep_word() end, desc = "Grep word under cursor", mode = { "n", "x" } },
|
||||
{ "<leader>fb", function() Snacks.picker.buffers() end, desc = "Buffers" },
|
||||
{ "<leader>fh", function() Snacks.picker.help() end, desc = "Help" },
|
||||
{ "<leader>fk", function() Snacks.picker.keymaps() end, desc = "Keymaps" },
|
||||
{ "<leader>fd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" },
|
||||
{ "<C-/>", function() Snacks.terminal.toggle(nil, { win = { position = "float" } }) end, desc = "Toggle terminal", mode = { "n", "t" } },
|
||||
{ "<C-_>", function() Snacks.terminal.toggle(nil, { win = { position = "float" } }) end, desc = "which_key_ignore", mode = { "n", "t" } },
|
||||
}
|
||||
if full then
|
||||
table.insert(keys, { "<leader>fs", function() Snacks.picker.lsp_workspace_symbols() end, desc = "Workspace symbols" })
|
||||
end
|
||||
if vim.fn.executable("lazygit") == 1 then
|
||||
table.insert(keys, { "<leader>gg", function() Snacks.lazygit() end, desc = "Lazygit" })
|
||||
end
|
||||
|
||||
local picker = {}
|
||||
if full then
|
||||
-- <a-a> sends selected files or grep hits to the running agent.
|
||||
picker = {
|
||||
actions = {
|
||||
sidekick_send = function(...)
|
||||
return require("sidekick.cli.picker.snacks").send(...)
|
||||
end,
|
||||
},
|
||||
win = { input = { keys = { ["<a-a>"] = { "sidekick_send", mode = { "n", "i" } } } } },
|
||||
}
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"folke/snacks.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
keys = keys,
|
||||
opts = {
|
||||
picker = picker,
|
||||
lazygit = {},
|
||||
terminal = {},
|
||||
image = { enabled = full },
|
||||
},
|
||||
},
|
||||
{
|
||||
"dmtrKovalenko/fff.nvim",
|
||||
cond = full,
|
||||
lazy = true,
|
||||
-- Only the Lua library; the workspace also has bins that fail to link.
|
||||
build = "cargo build --release -p fff-nvim --lib",
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
local function lsp_names()
|
||||
local names = vim.tbl_map(function(c)
|
||||
return c.name
|
||||
end, vim.lsp.get_clients({ bufnr = 0 }))
|
||||
return table.concat(names, ",")
|
||||
end
|
||||
|
||||
local function agent_marker()
|
||||
if not package.loaded["sidekick"] then
|
||||
return ""
|
||||
end
|
||||
local ok, sessions = pcall(function()
|
||||
return require("sidekick.status").cli()
|
||||
end)
|
||||
return (ok and sessions and #sessions > 0) and "agent" or ""
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-mini/mini.statusline",
|
||||
lazy = false,
|
||||
config = function()
|
||||
local sl = require("mini.statusline")
|
||||
sl.setup({
|
||||
content = {
|
||||
active = function()
|
||||
local mode, mode_hl = sl.section_mode({ trunc_width = 120 })
|
||||
local git = sl.section_git({ trunc_width = 40 })
|
||||
local diagnostics = sl.section_diagnostics({ trunc_width = 75 })
|
||||
local filename = sl.section_filename({ trunc_width = 140 })
|
||||
local location = sl.section_location({ trunc_width = 75 })
|
||||
return sl.combine_groups({
|
||||
{ hl = mode_hl, strings = { mode } },
|
||||
{ hl = "MiniStatuslineDevinfo", strings = { git, diagnostics } },
|
||||
"%<",
|
||||
{ hl = "MiniStatuslineFilename", strings = { filename } },
|
||||
"%=",
|
||||
{ hl = "MiniStatuslineFileinfo", strings = { agent_marker(), lsp_names() } },
|
||||
{ hl = mode_hl, strings = { location } },
|
||||
})
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
local function nt(fn)
|
||||
return function()
|
||||
fn(require("neotest"))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
cond = vim.g.profile == "full",
|
||||
dependencies = {
|
||||
"nvim-neotest/nvim-nio",
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"rouge8/neotest-rust",
|
||||
"fredrikaverpil/neotest-golang",
|
||||
"marilari88/neotest-vitest",
|
||||
"nvim-neotest/neotest-jest",
|
||||
"nvim-neotest/neotest-python",
|
||||
"V13Axel/neotest-pest",
|
||||
"olimorris/neotest-phpunit",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>tt", nt(function(n) n.run.run() end), desc = "Run nearest test" },
|
||||
{ "<leader>tf", nt(function(n) n.run.run(vim.fn.expand("%")) end), desc = "Run test file" },
|
||||
{ "<leader>ts", nt(function(n) n.summary.toggle() end), desc = "Test summary" },
|
||||
{ "<leader>to", nt(function(n) n.output.open({ enter = true }) end), desc = "Test output" },
|
||||
{ "<leader>td", nt(function(n) n.run.run({ strategy = "dap" }) end), desc = "Debug nearest test" },
|
||||
},
|
||||
config = function()
|
||||
require("neotest").setup({
|
||||
adapters = {
|
||||
require("neotest-rust"),
|
||||
require("neotest-golang")({}),
|
||||
require("neotest-vitest"),
|
||||
require("neotest-jest")({}),
|
||||
require("neotest-python")({ dap = { justMyCode = false } }),
|
||||
require("neotest-pest"),
|
||||
require("neotest-phpunit"),
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
-- nvim-treesitter (main branch) only installs parsers. Highlighting, folds and
|
||||
-- indent are started natively per buffer.
|
||||
local parsers = {
|
||||
slim = { "lua", "nix", "bash", "yaml", "json", "markdown" },
|
||||
full = {
|
||||
"lua",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"query",
|
||||
"nix",
|
||||
"bash",
|
||||
"yaml",
|
||||
"json",
|
||||
"toml",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"rust",
|
||||
"go",
|
||||
"gomod",
|
||||
"typescript",
|
||||
"tsx",
|
||||
"javascript",
|
||||
"python",
|
||||
"php",
|
||||
"html",
|
||||
"css",
|
||||
"dockerfile",
|
||||
"gitcommit",
|
||||
"diff",
|
||||
},
|
||||
}
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
branch = "main",
|
||||
lazy = false, -- main branch does not support lazy loading
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter").install(parsers[vim.g.profile])
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = vim.api.nvim_create_augroup("plugins.treesitter", { clear = true }),
|
||||
callback = function(ev)
|
||||
if vim.b[ev.buf].bigfile or not pcall(vim.treesitter.start, ev.buf) then
|
||||
return
|
||||
end
|
||||
vim.bo[ev.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
vim.wo.foldmethod = "expr"
|
||||
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
-- Supplies @function/@class queries; mini.ai builds the text objects.
|
||||
{ "nvim-treesitter/nvim-treesitter-textobjects", branch = "main", lazy = true },
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
local groups = {
|
||||
{ "<leader>f", group = "Find" },
|
||||
{ "<leader>g", group = "Git" },
|
||||
{ "<leader>t", group = "Test and toggles" },
|
||||
{ "<leader>b", group = "Buffers" },
|
||||
}
|
||||
if vim.g.profile == "full" then
|
||||
vim.list_extend(groups, {
|
||||
{ "<leader>l", group = "LSP" },
|
||||
{ "<leader>d", group = "Debug" },
|
||||
{ "<leader>a", group = "AI agent" },
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = { spec = groups },
|
||||
},
|
||||
}
|
||||
Reference in new issue
Block a user