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,2 @@
|
|||||||
|
result
|
||||||
|
.direnv
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
vim.bo.expandtab = false
|
||||||
|
vim.bo.shiftwidth = 4
|
||||||
|
vim.bo.tabstop = 4
|
||||||
|
vim.bo.softtabstop = 0
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
vim.bo.shiftwidth = 4
|
||||||
|
vim.bo.tabstop = 4
|
||||||
|
vim.bo.softtabstop = 4
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
vim.bo.shiftwidth = 4
|
||||||
|
vim.bo.tabstop = 4
|
||||||
|
vim.bo.softtabstop = 4
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
vim.bo.shiftwidth = 4
|
||||||
|
vim.bo.tabstop = 4
|
||||||
|
vim.bo.softtabstop = 4
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
description = "Neovim config: Nix provides binaries, Lua provides behaviour";
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{ self }:
|
||||||
|
{
|
||||||
|
homeManagerModules.default = import ./nix/module.nix self;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
vim.loader.enable()
|
||||||
|
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.g.maplocalleader = "\\"
|
||||||
|
vim.g.profile = vim.env.NVIM_PROFILE == "slim" and "slim" or "full"
|
||||||
|
|
||||||
|
require("core.options")
|
||||||
|
require("core.keymaps")
|
||||||
|
require("core.autocmds")
|
||||||
|
require("core.bigfile")
|
||||||
|
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not vim.uv.fs_stat(lazypath) then
|
||||||
|
local out = vim.fn.system({
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--filter=blob:none",
|
||||||
|
"--branch=stable",
|
||||||
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
|
lazypath,
|
||||||
|
})
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
vim.api.nvim_echo({ { "Failed to clone lazy.nvim:\n" .. out, "ErrorMsg" } }, true, {})
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = { { import = "plugins" } },
|
||||||
|
install = { colorscheme = { "catppuccin" } },
|
||||||
|
checker = { enabled = false },
|
||||||
|
change_detection = { notify = false },
|
||||||
|
rocks = { enabled = false },
|
||||||
|
performance = {
|
||||||
|
rtp = {
|
||||||
|
disabled_plugins = { "gzip", "netrwPlugin", "tarPlugin", "tohtml", "tutor", "zipPlugin" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"SchemaStore.nvim": { "branch": "main", "commit": "4794bb7a4cf66b894f0029c3094b7936a8c0e8fe" },
|
||||||
|
"blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" },
|
||||||
|
"catppuccin": { "branch": "main", "commit": "edefef779ab08ce1a4a404713e3012b0d202bd35" },
|
||||||
|
"conform.nvim": { "branch": "master", "commit": "016802de402556da54c36bd7359b441266b01cdd" },
|
||||||
|
"fff.nvim": { "branch": "main", "commit": "b3b8cede0beb95272ebc2c72c648269f9c5228b3" },
|
||||||
|
"friendly-snippets": { "branch": "main", "commit": "b2ea5c41a150ba72fb656eedb4ed0a86d138d945" },
|
||||||
|
"gitsigns.nvim": { "branch": "main", "commit": "ef707fb93301a9b856f36eae4c8f56f5b988a794" },
|
||||||
|
"kanagawa.nvim": { "branch": "master", "commit": "bb85e4bfc8d89b0e62c8fa53ccdd13d12e2f77b3" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||||
|
"mini.ai": { "branch": "main", "commit": "a4f5648dedf435e6306205135d1babb563b55d28" },
|
||||||
|
"mini.pairs": { "branch": "main", "commit": "03eb1f0062a2cee5314d1ac3939246e4bb21352e" },
|
||||||
|
"mini.statusline": { "branch": "main", "commit": "d7133a9a244a8d93ccee42ff37fb9499af5956fb" },
|
||||||
|
"mini.surround": { "branch": "main", "commit": "5357f00aca51a3b43e7775901b1ad9699f8c2678" },
|
||||||
|
"minuet-ai.nvim": { "branch": "main", "commit": "50bf63b031c0391e926fdf0b3d044d37846e6e34" },
|
||||||
|
"neotest": { "branch": "master", "commit": "27bf921498043f7ecd821d6db68d05de244bbd02" },
|
||||||
|
"neotest-golang": { "branch": "main", "commit": "65b2be63c3de00e6f15c05388ebdc8d603dbd727" },
|
||||||
|
"neotest-jest": { "branch": "main", "commit": "0e7979d51301dfae5ef839d771bd28cf593fde3f" },
|
||||||
|
"neotest-pest": { "branch": "main", "commit": "3388a5f00001303020ce885e18007ccd1835212c" },
|
||||||
|
"neotest-phpunit": { "branch": "main", "commit": "40e53c4294726a16f34f1a383a94c570553c6d46" },
|
||||||
|
"neotest-python": { "branch": "master", "commit": "1b56ca4ba51c6014f986d6548ee629bdc95589d1" },
|
||||||
|
"neotest-rust": { "branch": "main", "commit": "2c9941d4a358839918fac21d20fc8fef0e1ad05f" },
|
||||||
|
"neotest-vitest": { "branch": "main", "commit": "b0c265743c877058068dbc40d104ea5d40e6b257" },
|
||||||
|
"nvim-dap": { "branch": "master", "commit": "cfa2d58f4537aca6ca83e2de1a0d9f1491121264" },
|
||||||
|
"nvim-dap-ui": { "branch": "master", "commit": "cc9dd33aade7f20bae414d0cba163bc60d4d4b43" },
|
||||||
|
"nvim-lint": { "branch": "master", "commit": "52107ce2076a27a285af781248e2c59bad817cd0" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "cc404d425c7752f56b8eaa269107be44d888ea51" },
|
||||||
|
"nvim-nio": { "branch": "master", "commit": "edcc181a875301dd21840189aa2f2f9ad69fc172" },
|
||||||
|
"nvim-treesitter": { "branch": "main", "commit": "610734c5d3e59761d5f79318d120633374537fa5" },
|
||||||
|
"nvim-treesitter-textobjects": { "branch": "main", "commit": "5c7b0263797dfd1bd6202f2b219f3b53a80b2187" },
|
||||||
|
"oil.nvim": { "branch": "master", "commit": "d3733d933833a0e59b813ecec99341527adf0c28" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
|
||||||
|
"render-markdown.nvim": { "branch": "main", "commit": "8e8795368391036643b622875a6da6a51bcd33f4" },
|
||||||
|
"sidekick.nvim": { "branch": "main", "commit": "3d80a47e6375f6d647c9695d3afea6fa1b3275df" },
|
||||||
|
"snacks.nvim": { "branch": "main", "commit": "882c996cf28183f4d63640de0b4c02ec886d01f2" },
|
||||||
|
"tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" },
|
||||||
|
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
return {
|
||||||
|
before_init = function(_, config)
|
||||||
|
config.settings = vim.tbl_deep_extend("force", config.settings or {}, {
|
||||||
|
json = { schemas = require("schemastore").json.schemas(), validate = { enable = true } },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
return {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = { version = "LuaJIT" },
|
||||||
|
workspace = { checkThirdParty = false, library = { vim.env.VIMRUNTIME } },
|
||||||
|
telemetry = { enable = false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
return {
|
||||||
|
settings = {
|
||||||
|
["rust-analyzer"] = { check = { command = "clippy" } },
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
return {
|
||||||
|
before_init = function(_, config)
|
||||||
|
config.settings = vim.tbl_deep_extend("force", config.settings or {}, {
|
||||||
|
yaml = {
|
||||||
|
schemaStore = { enable = false, url = "" }, -- SchemaStore.nvim supplies them
|
||||||
|
schemas = require("schemastore").yaml.schemas(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
local group = vim.api.nvim_create_augroup("core.autocmds", { clear = true })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
|
group = group,
|
||||||
|
callback = function()
|
||||||
|
vim.hl.on_yank()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("VimResized", {
|
||||||
|
group = group,
|
||||||
|
command = "tabdo wincmd =",
|
||||||
|
})
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
-- Files above the limit get vim.b.bigfile = true. Treesitter, LSP, linting and
|
||||||
|
-- AI completion check that flag; syntax and folding are switched off here.
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.limit = 1024 * 1024
|
||||||
|
|
||||||
|
local group = vim.api.nvim_create_augroup("core.bigfile", { clear = true })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("BufReadPre", {
|
||||||
|
group = group,
|
||||||
|
callback = function(ev)
|
||||||
|
local stat = vim.uv.fs_stat(ev.match)
|
||||||
|
if stat and stat.size > M.limit then
|
||||||
|
vim.b[ev.buf].bigfile = true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
group = group,
|
||||||
|
callback = function(ev)
|
||||||
|
if not vim.b[ev.buf].bigfile then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
vim.schedule(function()
|
||||||
|
if vim.api.nvim_buf_is_valid(ev.buf) then
|
||||||
|
vim.bo[ev.buf].syntax = ""
|
||||||
|
vim.api.nvim_buf_call(ev.buf, function()
|
||||||
|
vim.wo.foldmethod = "manual"
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
-- Plugin-independent maps. Plugin maps live in their spec's `keys`.
|
||||||
|
local map = vim.keymap.set
|
||||||
|
|
||||||
|
map({ "n", "x" }, "<leader>y", '"+y', { desc = "Yank to system clipboard" })
|
||||||
|
map({ "n", "x" }, "<leader>p", '"+p', { desc = "Paste from system clipboard" })
|
||||||
|
|
||||||
|
map("n", "<leader>bd", "<cmd>bdelete<cr>", { desc = "Delete buffer" })
|
||||||
|
map("n", "<leader>bo", "<cmd>%bdelete|edit#|bdelete#<cr>", { desc = "Delete other buffers" })
|
||||||
|
|
||||||
|
map("n", "<leader>tw", function()
|
||||||
|
vim.wo.wrap = not vim.wo.wrap
|
||||||
|
end, { desc = "Toggle wrap" })
|
||||||
|
|
||||||
|
map("n", "<leader>tD", function()
|
||||||
|
vim.diagnostic.enable(not vim.diagnostic.is_enabled())
|
||||||
|
end, { desc = "Toggle diagnostics" })
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
-- Servers start through native vim.lsp.enable. nvim-lspconfig only supplies
|
||||||
|
-- defaults; overrides live in lsp/<server>.lua. Called from plugins/lsp.lua.
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.servers = {
|
||||||
|
"nixd",
|
||||||
|
"lua_ls",
|
||||||
|
"bashls",
|
||||||
|
"yamlls",
|
||||||
|
"jsonls",
|
||||||
|
"marksman",
|
||||||
|
"rust_analyzer",
|
||||||
|
"gopls",
|
||||||
|
"vtsls",
|
||||||
|
"eslint",
|
||||||
|
"basedpyright",
|
||||||
|
"ruff",
|
||||||
|
"intelephense",
|
||||||
|
}
|
||||||
|
|
||||||
|
local function restart()
|
||||||
|
vim.cmd(vim.fn.exists(":lsp") == 2 and "lsp restart" or "LspRestart")
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
group = vim.api.nvim_create_augroup("core.lsp", { clear = true }),
|
||||||
|
callback = function(ev)
|
||||||
|
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||||
|
if not client then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if vim.b[ev.buf].bigfile then
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.lsp.buf_detach_client(ev.buf, client.id)
|
||||||
|
end)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if client.name == "ruff" then
|
||||||
|
client.server_capabilities.hoverProvider = false -- basedpyright owns hover
|
||||||
|
end
|
||||||
|
|
||||||
|
local function map(lhs, rhs, desc)
|
||||||
|
vim.keymap.set("n", lhs, rhs, { buffer = ev.buf, desc = desc })
|
||||||
|
end
|
||||||
|
map("<leader>li", "<cmd>checkhealth vim.lsp<cr>", "LSP info")
|
||||||
|
map("<leader>lr", restart, "Restart LSP servers")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.lsp.enable(M.servers)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
local o = vim.opt
|
||||||
|
|
||||||
|
o.number = true
|
||||||
|
o.relativenumber = true
|
||||||
|
o.signcolumn = "yes"
|
||||||
|
o.termguicolors = true
|
||||||
|
o.showmode = false -- mini.statusline shows it
|
||||||
|
|
||||||
|
o.expandtab = true
|
||||||
|
o.shiftwidth = 2
|
||||||
|
o.tabstop = 2
|
||||||
|
o.softtabstop = 2
|
||||||
|
|
||||||
|
o.undofile = true -- undodir defaults to stdpath("state")/undo
|
||||||
|
o.swapfile = false
|
||||||
|
|
||||||
|
o.scrolloff = 8
|
||||||
|
o.splitright = true
|
||||||
|
o.splitbelow = true
|
||||||
|
o.ignorecase = true
|
||||||
|
o.smartcase = true
|
||||||
|
|
||||||
|
o.foldlevel = 99 -- treesitter sets foldexpr per buffer
|
||||||
|
o.updatetime = 250
|
||||||
|
|
||||||
|
-- Clipboard is not synced. Over SSH, "+ goes through OSC 52.
|
||||||
|
if vim.env.SSH_TTY then
|
||||||
|
vim.g.clipboard = "osc52"
|
||||||
|
end
|
||||||
@@ -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 },
|
||||||
|
},
|
||||||
|
}
|
||||||
+131
@@ -0,0 +1,131 @@
|
|||||||
|
src:
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.programs.nvim-config;
|
||||||
|
full = cfg.profile == "full";
|
||||||
|
|
||||||
|
# Slim also needs tree-sitter and a C compiler so its few parsers can compile.
|
||||||
|
baseTools = with pkgs; [
|
||||||
|
ripgrep
|
||||||
|
fd
|
||||||
|
git
|
||||||
|
tree-sitter
|
||||||
|
stdenv.cc
|
||||||
|
];
|
||||||
|
|
||||||
|
# rustup supplies cargo, rustfmt, clippy and rust-analyzer (and the nightly
|
||||||
|
# toolchain fff builds with), so those are not listed separately.
|
||||||
|
fullTools = with pkgs; [
|
||||||
|
lazygit
|
||||||
|
rustup
|
||||||
|
cargo-nextest
|
||||||
|
llama-cpp
|
||||||
|
|
||||||
|
nixd
|
||||||
|
nixfmt
|
||||||
|
lua-language-server
|
||||||
|
stylua
|
||||||
|
bash-language-server
|
||||||
|
shfmt
|
||||||
|
shellcheck
|
||||||
|
yaml-language-server
|
||||||
|
vscode-langservers-extracted
|
||||||
|
marksman
|
||||||
|
prettierd
|
||||||
|
|
||||||
|
go
|
||||||
|
gopls
|
||||||
|
gotools
|
||||||
|
gofumpt
|
||||||
|
golangci-lint
|
||||||
|
delve
|
||||||
|
|
||||||
|
vtsls
|
||||||
|
vscode-js-debug
|
||||||
|
|
||||||
|
basedpyright
|
||||||
|
ruff
|
||||||
|
|
||||||
|
intelephense # unfree: the host must allow it
|
||||||
|
phpPackages.php-cs-fixer
|
||||||
|
phpPackages.phpstan
|
||||||
|
];
|
||||||
|
|
||||||
|
# Kept out of home.packages to avoid colliding with other pythons/nodes.
|
||||||
|
debugpy = pkgs.python3.withPackages (ps: [ ps.debugpy ]);
|
||||||
|
lldb = pkgs.vscode-extensions.vadimcn.vscode-lldb;
|
||||||
|
phpDebug = pkgs.vscode-extensions.xdebug.php-debug;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.programs.nvim-config = {
|
||||||
|
enable = lib.mkEnableOption "the nvim-config Neovim setup";
|
||||||
|
|
||||||
|
profile = lib.mkOption {
|
||||||
|
type = lib.types.enum [
|
||||||
|
"full"
|
||||||
|
"slim"
|
||||||
|
];
|
||||||
|
default = "full";
|
||||||
|
description = "full for dev machines, slim for servers.";
|
||||||
|
};
|
||||||
|
|
||||||
|
checkout = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = null;
|
||||||
|
example = "/Users/johannes/Repos/nvim";
|
||||||
|
description = ''
|
||||||
|
Absolute path to a local checkout. When set, ~/.config/nvim links to it
|
||||||
|
out of store so edits apply without a switch. When null, it links to
|
||||||
|
the flake source in the Nix store.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
minuetEndpoint = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "http://127.0.0.1:8012";
|
||||||
|
description = "Base URL of the llama-server used for AI completion.";
|
||||||
|
};
|
||||||
|
|
||||||
|
agent = {
|
||||||
|
command = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "agent";
|
||||||
|
description = "Command sidekick.nvim runs for the agent tool.";
|
||||||
|
};
|
||||||
|
package = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.package;
|
||||||
|
default = null;
|
||||||
|
description = "Package providing the agent binary.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
home.packages = [
|
||||||
|
pkgs.neovim
|
||||||
|
]
|
||||||
|
++ baseTools
|
||||||
|
++ lib.optionals full fullTools
|
||||||
|
++ lib.optional (full && cfg.agent.package != null) cfg.agent.package;
|
||||||
|
|
||||||
|
home.sessionVariables = {
|
||||||
|
NVIM_PROFILE = cfg.profile;
|
||||||
|
}
|
||||||
|
// lib.optionalAttrs full {
|
||||||
|
MINUET_ENDPOINT = cfg.minuetEndpoint;
|
||||||
|
NVIM_AGENT_CMD = cfg.agent.command;
|
||||||
|
NVIM_CODELLDB = "${lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";
|
||||||
|
NVIM_DEBUGPY_PYTHON = "${debugpy}/bin/python3";
|
||||||
|
NVIM_PHP_DEBUG = "${phpDebug}/share/vscode/extensions/xdebug.php-debug/out/phpDebug.js";
|
||||||
|
NVIM_NODE = "${pkgs.nodejs}/bin/node";
|
||||||
|
};
|
||||||
|
|
||||||
|
xdg.configFile."nvim".source =
|
||||||
|
if cfg.checkout != null then config.lib.file.mkOutOfStoreSymlink cfg.checkout else src;
|
||||||
|
};
|
||||||
|
}
|
||||||
Whitespace-only changes.
@@ -0,0 +1,6 @@
|
|||||||
|
column_width = 120
|
||||||
|
line_endings = "Unix"
|
||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 2
|
||||||
|
quote_style = "AutoPreferDouble"
|
||||||
|
call_parentheses = "Always"
|
||||||
Reference in new issue
Block a user