diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..5cef8ac --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,31 @@ +# Agent instructions + +This is a small Neovim config: Nix provides the binaries, Lua provides the behaviour. + +**The spec is the source of truth:** `Neovim Spec.md` in the Obsidian vault (`10 Projekte/Privat/Neovim Spec.md`). +Read it before changing anything. If code and spec disagree, ask which one is right. + +## Rules + +1. **Spec first.** A new plugin, keymap or setting gets a row or line in the spec with a reason, in the same change. + Every plugin in `lazy-lock.json` must appear in the spec's plugin table. +2. **Native first.** Add a plugin only when the built-in feature is clearly worse. Do not add a distribution, Mason, + Copilot or any cloud AI completion. +3. **Nix installs tools.** Language servers, formatters, linters and debug adapters go into `nix/module.nix`, + never into the Lua config. +4. **Two profiles.** `full` (default) and `slim` (servers). Heavy plugins use `cond = vim.g.profile == "full"`. + In slim, maps for disabled plugins must not exist. +5. **Layout.** One file per plugin or tight group in `lua/plugins/`. Plugin-independent settings live in + `lua/core/`. Per-server LSP overrides live in `lsp/.lua`, per-filetype options in `after/ftplugin/`. +6. **Lazy loading.** Load on event, command, key or filetype. Only the colourscheme, mini.statusline, + mini.tabline and snacks core load at startup. Budget: under 50 ms. +7. **Treesitter is native.** nvim-treesitter only installs parsers. Highlighting starts through `vim.treesitter.start()`. +8. **Keymaps.** The owner uses a German QWERTZ keyboard, so never add a map that needs `[` or `]`. + Every map has a `desc`. No map overrides a built-in motion, except the ones listed in the spec. +9. **Style.** `stylua` with `stylua.toml` (120 columns, 2 spaces, double quotes). + +## Checks + +- Load a changed file headless: `nvim --headless -u NONE "+lua dofile('')" +qa`. +- Run `:checkhealth` in both profiles (`NVIM_PROFILE=slim nvim`) after larger changes. +- After adding or removing a plugin, run `:Lazy sync` and commit `lazy-lock.json`. diff --git a/lazy-lock.json b/lazy-lock.json index a9f4095..ccfb46a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,17 +1,27 @@ { - "SchemaStore.nvim": { "branch": "main", "commit": "4794bb7a4cf66b894f0029c3094b7936a8c0e8fe" }, + "SchemaStore.nvim": { "branch": "main", "commit": "13a365fa7a893891fe8724390ad7e608d1c1c59b" }, "blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" }, "catppuccin": { "branch": "main", "commit": "edefef779ab08ce1a4a404713e3012b0d202bd35" }, + "codediff.nvim": { "branch": "main", "commit": "09d9ebef2cc5a5c04db7a349cd6c61bdf84ecc8e" }, "conform.nvim": { "branch": "master", "commit": "016802de402556da54c36bd7359b441266b01cdd" }, - "fff.nvim": { "branch": "main", "commit": "b3b8cede0beb95272ebc2c72c648269f9c5228b3" }, - "friendly-snippets": { "branch": "main", "commit": "b2ea5c41a150ba72fb656eedb4ed0a86d138d945" }, + "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, + "edgy.nvim": { "branch": "main", "commit": "8bfd2808994a988c975694122f68624b8a219f5f" }, + "fff.nvim": { "branch": "main", "commit": "922bede74a531e66b469c73b628ac7ddfe278c63" }, + "flash.nvim": { "branch": "main", "commit": "5f0f270fdc7c5b0c21d903ee85b9cb06f2ac636a" }, + "friendly-snippets": { "branch": "main", "commit": "7a1c9f7897a4eb078b157a04c7af81e5869215b1" }, "gitsigns.nvim": { "branch": "main", "commit": "ef707fb93301a9b856f36eae4c8f56f5b988a794" }, + "gopher.nvim": { "branch": "main", "commit": "f397bed1c35f29f4f85d60a210650e677a8c5cb4" }, "kanagawa.nvim": { "branch": "master", "commit": "bb85e4bfc8d89b0e62c8fa53ccdd13d12e2f77b3" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, - "mini.ai": { "branch": "main", "commit": "a4f5648dedf435e6306205135d1babb563b55d28" }, + "markview.nvim": { "branch": "main", "commit": "aadb6d817577d553bbef61e8b9073f1bf4b87e08" }, + "mini.ai": { "branch": "main", "commit": "f40e4fe729a568357218d599edb5ca107cf94af4" }, + "mini.hipatterns": { "branch": "main", "commit": "b435ff459774b7ec234f1ae2834062f5829e75fa" }, + "mini.icons": { "branch": "main", "commit": "eab3e692d796d78ea6ffc978d8a380ff26fcf4e3" }, + "mini.indentscope": { "branch": "main", "commit": "b26a8ee619c0f4158dd4df1a8151b236b7d100bc" }, "mini.pairs": { "branch": "main", "commit": "03eb1f0062a2cee5314d1ac3939246e4bb21352e" }, "mini.statusline": { "branch": "main", "commit": "d7133a9a244a8d93ccee42ff37fb9499af5956fb" }, - "mini.surround": { "branch": "main", "commit": "5357f00aca51a3b43e7775901b1ad9699f8c2678" }, + "mini.surround": { "branch": "main", "commit": "f993f66edfc2741cc515aa1f782816fd5c17bc14" }, + "mini.tabline": { "branch": "main", "commit": "d77cc478ec18fc8e8651b69233b02d5b32ed2b74" }, "minuet-ai.nvim": { "branch": "main", "commit": "50bf63b031c0391e926fdf0b3d044d37846e6e34" }, "neotest": { "branch": "master", "commit": "27bf921498043f7ecd821d6db68d05de244bbd02" }, "neotest-golang": { "branch": "main", "commit": "65b2be63c3de00e6f15c05388ebdc8d603dbd727" }, @@ -21,19 +31,31 @@ "neotest-python": { "branch": "master", "commit": "1b56ca4ba51c6014f986d6548ee629bdc95589d1" }, "neotest-rust": { "branch": "main", "commit": "2c9941d4a358839918fac21d20fc8fef0e1ad05f" }, "neotest-vitest": { "branch": "main", "commit": "b0c265743c877058068dbc40d104ea5d40e6b257" }, + "noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" }, + "nui.nvim": { "branch": "main", "commit": "10fc361835c856ba4233ef5ea135b919bf3dce97" }, "nvim-dap": { "branch": "master", "commit": "cfa2d58f4537aca6ca83e2de1a0d9f1491121264" }, - "nvim-dap-ui": { "branch": "master", "commit": "cc9dd33aade7f20bae414d0cba163bc60d4d4b43" }, + "nvim-dap-view": { "branch": "main", "commit": "bfaf50b3f513f78d8ab3e5fe02128dda05be4945" }, + "nvim-early-retirement": { "branch": "main", "commit": "d73ddf7b8b776aa917947142873a05f733103757" }, "nvim-lint": { "branch": "master", "commit": "52107ce2076a27a285af781248e2c59bad817cd0" }, - "nvim-lspconfig": { "branch": "master", "commit": "cc404d425c7752f56b8eaa269107be44d888ea51" }, + "nvim-lspconfig": { "branch": "master", "commit": "443d92c6bea761ab54cdde46fb197a2b4d614bdd" }, "nvim-nio": { "branch": "master", "commit": "edcc181a875301dd21840189aa2f2f9ad69fc172" }, - "nvim-treesitter": { "branch": "main", "commit": "610734c5d3e59761d5f79318d120633374537fa5" }, + "nvim-treesitter": { "branch": "main", "commit": "60c0f468de3e636fa660a419d537e8033aca4e39" }, + "nvim-treesitter-context": { "branch": "master", "commit": "8decd73460d26ef0a0befb745d022dd1fc2c38b8" }, "nvim-treesitter-textobjects": { "branch": "main", "commit": "5c7b0263797dfd1bd6202f2b219f3b53a80b2187" }, "oil.nvim": { "branch": "master", "commit": "d3733d933833a0e59b813ecec99341527adf0c28" }, + "overseer.nvim": { "branch": "master", "commit": "a93d9f6d6defdac4bcd6d2c8ba988650e42e0a0e" }, + "persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" }, "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, - "render-markdown.nvim": { "branch": "main", "commit": "8e8795368391036643b622875a6da6a51bcd33f4" }, + "render-markdown.nvim": { "branch": "main", "commit": "9c235bedc4f96145e63fcad5b78cd78bce8822c4" }, "rose-pine": { "branch": "main", "commit": "ff483051a47e27d84bdef47703538df1ed9f4a47" }, "sidekick.nvim": { "branch": "main", "commit": "3d80a47e6375f6d647c9695d3afea6fa1b3275df" }, "snacks.nvim": { "branch": "main", "commit": "882c996cf28183f4d63640de0b4c02ec886d01f2" }, + "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, + "todoage.nvim": { "branch": "main", "commit": "9ef8a1524b64775c119621558ce1aa490c303471" }, "tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" }, + "treesj": { "branch": "main", "commit": "9f349ba62c524f065d6f43254d731ddf8319b9bf" }, + "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, + "ts-error-translator.nvim": { "branch": "main", "commit": "558abff11b9e8f4cefc0de09df780c56841c7a4b" }, + "typst-preview.nvim": { "branch": "master", "commit": "1c2e19486397be1c580b560fc50ee36abe329c46" }, "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } } diff --git a/lsp/gopls.lua b/lsp/gopls.lua new file mode 100644 index 0000000..c5d7c68 --- /dev/null +++ b/lsp/gopls.lua @@ -0,0 +1,25 @@ +return { + settings = { + gopls = { + buildFlags = { "-tags=unittest" }, + vulncheck = "Imports", + codelenses = { + gc_details = true, + gc_details_all = true, + generate = true, + regenerate_cgo = true, + tidy = true, + run_govulncheck = true, + }, + hints = { + assignVariableTypes = true, + compositeLiteralFields = true, + compositeLiteralTypes = true, + constantValues = true, + functionTypeParameters = true, + parameterNames = true, + rangeVariableTypes = true, + }, + }, + }, +} diff --git a/lsp/intelephense.lua b/lsp/intelephense.lua new file mode 100644 index 0000000..811d257 --- /dev/null +++ b/lsp/intelephense.lua @@ -0,0 +1,5 @@ +return { + settings = { + intelephense = { telemetry = { enabled = false } }, + }, +} diff --git a/lsp/lua_ls.lua b/lsp/lua_ls.lua index aee3856..9fe0a93 100644 --- a/lsp/lua_ls.lua +++ b/lsp/lua_ls.lua @@ -3,6 +3,7 @@ return { Lua = { runtime = { version = "LuaJIT" }, workspace = { checkThirdParty = false, library = { vim.env.VIMRUNTIME } }, + hint = { enable = true }, telemetry = { enable = false }, }, }, diff --git a/lsp/nixd.lua b/lsp/nixd.lua new file mode 100644 index 0000000..87c8bc8 --- /dev/null +++ b/lsp/nixd.lua @@ -0,0 +1,5 @@ +return { + settings = { + nixd = { formatting = { command = { "nixfmt" } } }, + }, +} diff --git a/lsp/rust_analyzer.lua b/lsp/rust_analyzer.lua index 0a5eb8b..6504b5d 100644 --- a/lsp/rust_analyzer.lua +++ b/lsp/rust_analyzer.lua @@ -1,5 +1,21 @@ +-- bacon runs the checker (plugins/lint.lua), so rust-analyzer keeps its default `cargo check`. return { settings = { - ["rust-analyzer"] = { check = { command = "clippy" } }, + ["rust-analyzer"] = { + cargo = { allFeatures = true, buildScripts = { enable = true } }, + checkOnSave = true, + diagnostics = { enable = true }, + procMacro = { + enable = true, + ignored = { + ["async-trait"] = { "async_trait" }, + ["napi-derive"] = { "napi" }, + ["async-recursion"] = { "async_recursion" }, + }, + }, + files = { + excludeDirs = { ".direnv", ".git", ".github", ".gitlab", "bin", "node_modules", "target", "venv", ".venv" }, + }, + }, }, } diff --git a/lsp/yamlls.lua b/lsp/yamlls.lua index 049b66e..a82f98b 100644 --- a/lsp/yamlls.lua +++ b/lsp/yamlls.lua @@ -4,6 +4,7 @@ return { yaml = { schemaStore = { enable = false, url = "" }, -- SchemaStore.nvim supplies them schemas = require("schemastore").yaml.schemas(), + keyOrdering = false, }, }) end, diff --git a/lua/core/autocmds.lua b/lua/core/autocmds.lua index 64af0d4..e9462f5 100644 --- a/lua/core/autocmds.lua +++ b/lua/core/autocmds.lua @@ -7,6 +7,53 @@ vim.api.nvim_create_autocmd("TextYankPost", { end, }) +-- Runs on BufEnter so ftplugins cannot add the options back. +vim.api.nvim_create_autocmd("BufEnter", { + group = group, + callback = function() + vim.opt_local.formatoptions:remove({ "c", "r", "o" }) + end, +}) + +vim.api.nvim_create_autocmd("FileType", { + group = group, + pattern = { "help", "man", "qf", "checkhealth" }, + callback = function(ev) + vim.bo[ev.buf].buflisted = false + vim.keymap.set("n", "q", "close", { buffer = ev.buf, silent = true, desc = "Close window" }) + end, +}) + +vim.api.nvim_create_autocmd("BufWritePre", { + group = group, + callback = function(ev) + if ev.match:match("^%w+://") then + return + end + vim.fn.mkdir(vim.fs.dirname(vim.uv.fs_realpath(ev.match) or ev.match), "p") + end, +}) + +vim.api.nvim_create_autocmd("BufReadPost", { + group = group, + callback = function(ev) + local mark = vim.api.nvim_buf_get_mark(ev.buf, '"') + if mark[1] > 0 and mark[1] <= vim.api.nvim_buf_line_count(ev.buf) then + pcall(vim.api.nvim_win_set_cursor, 0, mark) + end + end, +}) + +vim.api.nvim_create_autocmd("TermOpen", { + group = group, + callback = function() + vim.opt_local.number = false + vim.opt_local.relativenumber = false + vim.opt_local.signcolumn = "no" + vim.opt_local.scrolloff = 0 + end, +}) + vim.api.nvim_create_autocmd("VimResized", { group = group, command = "tabdo wincmd =", diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua index 214c017..a77053e 100644 --- a/lua/core/keymaps.lua +++ b/lua/core/keymaps.lua @@ -4,13 +4,54 @@ local map = vim.keymap.set map({ "n", "x" }, "y", '"+y', { desc = "Yank to system clipboard" }) map({ "n", "x" }, "p", '"+p', { desc = "Paste from system clipboard" }) -map("n", "bd", "bdelete", { desc = "Delete buffer" }) -map("n", "bo", "%bdelete|edit#|bdelete#", { desc = "Delete other buffers" }) +-- Diagnostic jumps without [ and ] (QWERTZ). The default [d / ]d still work. +map("n", "n", function() + vim.diagnostic.jump({ count = vim.v.count1, float = true }) +end, { desc = "Next diagnostic" }) +map("n", "N", function() + vim.diagnostic.jump({ count = -vim.v.count1, float = true }) +end, { desc = "Previous diagnostic" }) -map("n", "tw", function() - vim.wo.wrap = not vim.wo.wrap -end, { desc = "Toggle wrap" }) +-- Buffer and window navigation +map("n", "", "bprevious", { desc = "Prev buffer" }) +map("n", "", "bnext", { desc = "Next buffer" }) +for _, dir in ipairs({ "h", "j", "k", "l" }) do + map("n", "", "" .. dir, { desc = "Window " .. dir }) + map("t", "", "" .. dir, { desc = "Window " .. dir }) +end +map("n", "", "resize +2", { desc = "Window taller" }) +map("n", "", "resize -2", { desc = "Window shorter" }) +map("n", "", "vertical resize -2", { desc = "Window narrower" }) +map("n", "", "vertical resize +2", { desc = "Window wider" }) -map("n", "tD", function() - vim.diagnostic.enable(not vim.diagnostic.is_enabled()) -end, { desc = "Toggle diagnostics" }) +-- Editing helpers +map({ "i", "n" }, "", "noh", { desc = "Escape and clear hlsearch" }) +map("n", "", "zz", { desc = "Half page down" }) +map("n", "", "zz", { desc = "Half page up" }) +map("x", "J", ":m '>+1gv=gv", { desc = "Move selection down" }) +map("x", "K", ":m '<-2gv=gv", { desc = "Move selection up" }) +map("x", "<", "", ">gv", { desc = "Indent right" }) +map("x", "P", '"_dP', { desc = "Paste keep register" }) + +-- Selection by treesitter node, LSP selection range as fallback +map({ "n", "x", "o" }, "", function() + if vim.treesitter.get_parser(nil, nil, { error = false }) then + require("vim.treesitter._select").select_parent(vim.v.count1) + else + vim.lsp.buf.selection_range(vim.v.count1) + end +end, { desc = "Select parent node" }) +map({ "n", "x", "o" }, "", function() + if vim.treesitter.get_parser(nil, nil, { error = false }) then + require("vim.treesitter._select").select_child(vim.v.count1) + else + vim.lsp.buf.selection_range(-vim.v.count1) + end +end, { desc = "Select child node" }) + +map("n", "fl", function() + local value = vim.fn.fnamemodify(vim.fn.expand("%"), ":~:.") .. ":" .. vim.fn.line(".") + vim.fn.setreg("+", value) + vim.notify("Copied " .. value) +end, { desc = "Copy path:line" }) diff --git a/lua/core/lsp.lua b/lua/core/lsp.lua index 7187d9a..b467961 100644 --- a/lua/core/lsp.lua +++ b/lua/core/lsp.lua @@ -16,6 +16,7 @@ M.servers = { "basedpyright", "ruff", "intelephense", + "tinymist", } local function restart() @@ -39,6 +40,11 @@ function M.setup() if client.name == "ruff" then client.server_capabilities.hoverProvider = false -- basedpyright owns hover end + if client.name == "vtsls" then + -- prettierd formats TypeScript + client.server_capabilities.documentFormattingProvider = false + client.server_capabilities.documentRangeFormattingProvider = false + end local function map(lhs, rhs, desc) vim.keymap.set("n", lhs, rhs, { buffer = ev.buf, desc = desc }) @@ -48,6 +54,24 @@ function M.setup() end, }) + -- No inline text; the diagnostic under the cursor opens in a float on CursorHold. + vim.diagnostic.config({ + virtual_text = false, + signs = true, + underline = true, + update_in_insert = false, + severity_sort = true, + float = { border = "rounded", source = true }, + }) + vim.api.nvim_create_autocmd("CursorHold", { + group = vim.api.nvim_create_augroup("core.lsp.float", { clear = true }), + callback = function() + vim.diagnostic.open_float(nil, { focusable = false, scope = "cursor", prefix = " " }) + end, + }) + + vim.lsp.inlay_hint.enable(true) -- gopls and lua_ls hints; ui toggles + vim.lsp.enable(M.servers) end diff --git a/lua/core/options.lua b/lua/core/options.lua index e9a10a1..55e4ebb 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -2,8 +2,24 @@ local o = vim.opt o.number = true o.relativenumber = true -o.signcolumn = "yes" +o.signcolumn = "yes:2" o.termguicolors = true +o.cursorline = true +o.mouse = "a" +o.laststatus = 3 +o.inccommand = "split" +o.linebreak = true +o.autowrite = true +o.timeoutlen = 300 +o.pumheight = 10 +o.pumblend = 10 +o.shada = { "'10", "<0", "s10", "h" } + +-- Unused language hosts +vim.g.loaded_perl_provider = 0 +vim.g.loaded_ruby_provider = 0 +vim.g.loaded_node_provider = 0 +vim.g.loaded_python3_provider = 0 o.showmode = false -- mini.statusline shows it o.expandtab = true diff --git a/lua/core/toggles.lua b/lua/core/toggles.lua new file mode 100644 index 0000000..972c447 --- /dev/null +++ b/lua/core/toggles.lua @@ -0,0 +1,110 @@ +-- UI toggles under u. The chosen state is saved to stdpath("state")/ui_toggles.json +-- and applied again on the next start. Called from the snacks config in plugins/picker.lua. +local M = {} + +function M.setup() + local toggle = require("snacks").toggle + local state_path = vim.fn.stdpath("state") .. "/ui_toggles.json" + local state = {} + + local ok, lines = pcall(vim.fn.readfile, state_path) + if ok then + local decoded_ok, decoded = pcall(vim.json.decode, table.concat(lines, "\n")) + if decoded_ok and type(decoded) == "table" then + state = decoded + end + end + + local function save() + vim.fn.mkdir(vim.fs.dirname(state_path), "p") + vim.fn.writefile({ vim.json.encode(state) }, state_path) + end + + -- Wrap the toggle's setter so every change is stored, restore the saved value, then map it. + local function persist(t, lhs) + local set = t.opts.set + t.opts.set = function(value) + set(value) + state[t.opts.id] = value + save() + end + if state[t.opts.id] ~= nil then + t:set(state[t.opts.id]) + end + t:map(lhs) + end + + -- Window options are per window, so apply the saved values to every new window. + local function apply_window_state() + if state.spell ~= nil then + vim.wo.spell = state.spell + end + if state.wrap ~= nil then + vim.wo.wrap = state.wrap + end + if state.line_number ~= nil then + vim.wo.number = state.line_number + vim.wo.relativenumber = state.line_number and state.relativenumber ~= false or false + elseif state.relativenumber ~= nil then + vim.wo.relativenumber = state.relativenumber + end + end + + persist(toggle.option("spell", { name = "Spelling" }), "us") + persist(toggle.option("wrap", { name = "Wrap" }), "uw") + persist(toggle.option("relativenumber", { name = "Relative number" }), "uL") + persist(toggle.line_number(), "ul") + persist(toggle.diagnostics(), "ud") + persist( + toggle({ + id = "diagnostic_virtual_text", + name = "Diagnostic virtual text", + get = function() + return vim.diagnostic.config().virtual_text ~= false + end, + set = function(enabled) + vim.diagnostic.config({ + virtual_text = enabled and { severity = { min = vim.diagnostic.severity.WARN } } or false, + }) + end, + }), + "uv" + ) + persist(toggle.treesitter(), "uT") + persist(toggle.inlay_hints(), "ui") + persist( + toggle({ + id = "indent_guides", + name = "Indent guides", + get = function() + return not vim.g.miniindentscope_disable + end, + set = function(enabled) + vim.g.miniindentscope_disable = not enabled + end, + }), + "ug" + ) + + apply_window_state() + local group = vim.api.nvim_create_augroup("core.toggles", { clear = true }) + vim.api.nvim_create_autocmd({ "BufWinEnter", "WinNew" }, { + group = group, + callback = function(ev) + apply_window_state() + if state.treesitter == false then + pcall(vim.treesitter.stop, ev.buf) + end + end, + }) + vim.api.nvim_create_autocmd("LspAttach", { + group = group, + callback = function(ev) + if state.inlay_hints ~= nil then + vim.lsp.inlay_hint.enable(state.inlay_hints, { bufnr = ev.buf }) + end + end, + }) +end + +return M diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index dd237d8..9372488 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -29,6 +29,27 @@ return { opts = { flavour = "auto", background = { light = "latte", dark = "mocha" }, + -- Only the integrations for plugins this config uses, so nothing else is set up at startup. + default_integrations = false, + auto_integrations = false, + integrations = { + treesitter = true, + native_lsp = { enabled = true }, + semantic_tokens = true, + blink_cmp = { style = "bordered" }, + flash = true, + gitsigns = true, + snacks = { enabled = true }, + render_markdown = true, + markview = true, + mini = { enabled = true, indentscope_color = "mauve" }, + neotest = true, + noice = true, + dap = true, + dap_ui = false, + treesitter_context = true, + which_key = true, + }, }, config = function(_, opts) require("catppuccin").setup(opts) diff --git a/lua/plugins/completion.lua b/lua/plugins/completion.lua index 9d31c9b..0d2fc3e 100644 --- a/lua/plugins/completion.lua +++ b/lua/plugins/completion.lua @@ -9,8 +9,13 @@ return { return { keymap = { preset = "default", + [""] = { "accept", "fallback" }, + [""] = { "scroll_documentation_down", "fallback" }, + [""] = { "scroll_documentation_up", "fallback" }, [""] = require("minuet").make_blink_map(), }, + appearance = { nerd_font_variant = "mono" }, + signature = { enabled = true }, snippets = { preset = "default" }, -- built-in vim.snippet sources = { default = { "lsp", "path", "snippets", "buffer", "minuet" }, diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index e002b99..9ef3dbd 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -84,23 +84,32 @@ return { { "mfussenegger/nvim-dap", cond = vim.g.profile == "full", - dependencies = { "rcarriga/nvim-dap-ui", "nvim-neotest/nvim-nio" }, + dependencies = { "igorlfs/nvim-dap-view" }, keys = { { "db", dap("toggle_breakpoint"), desc = "Toggle breakpoint" }, + { + "dB", + function() require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) end, + desc = "Conditional breakpoint", + }, + { "dr", function() require("dap").repl.open() end, desc = "Open REPL" }, { "dc", dap("continue"), desc = "Continue" }, { "di", dap("step_into"), desc = "Step into" }, { "do", dap("step_over"), desc = "Step over" }, { "dO", dap("step_out"), desc = "Step out" }, { "dq", dap("terminate"), desc = "Terminate" }, - { "du", function() require("dapui").toggle() end, desc = "Toggle debug UI" }, + { "dv", function() require("dap-view").toggle() end, desc = "Toggle debug view" }, }, 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) + local sign = vim.fn.sign_define + sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint" }) + sign("DapBreakpointCondition", { text = "◆", texthl = "DapBreakpointCondition" }) + sign("DapBreakpointRejected", { text = "✖", texthl = "DapBreakpointRejected" }) + sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint" }) + sign("DapStopped", { text = "▶", texthl = "DapStopped", linehl = "debugPC" }) + + require("dap-view").setup({ auto_toggle = true }) + setup_adapters(require("dap")) end, }, } diff --git a/lua/plugins/editing.lua b/lua/plugins/editing.lua index d07e28d..e33ba8f 100644 --- a/lua/plugins/editing.lua +++ b/lua/plugins/editing.lua @@ -32,6 +32,48 @@ return { }, }, }, + { + "folke/flash.nvim", + keys = { + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash jump" }, + }, + opts = {}, + }, + { + "Wansmer/treesj", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + keys = { + { "j", function() require("treesj").toggle() end, desc = "Toggle block split/join" }, + }, + opts = { use_default_keymaps = false, max_join_length = 150 }, + }, + { + "nvim-treesitter/nvim-treesitter-context", + event = { "BufReadPost", "BufNewFile" }, + opts = { max_lines = 2, multiline_threshold = 1, mode = "cursor", separator = "-" }, + }, + { + "nvim-mini/mini.hipatterns", + event = "VeryLazy", + config = function() + local hi = require("mini.hipatterns") + hi.setup({ highlighters = { hex_color = hi.gen_highlighter.hex_color() } }) + end, + }, + { + "nvim-mini/mini.indentscope", + event = "VeryLazy", + opts = { symbol = "|", options = { try_as_border = true } }, + init = function() + vim.api.nvim_create_autocmd("FileType", { + group = vim.api.nvim_create_augroup("plugins.indentscope", { clear = true }), + pattern = { "help", "lazy", "snacks_picker_input", "snacks_picker_list", "oil" }, + callback = function(ev) + vim.b[ev.buf].miniindentscope_disable = true + end, + }) + end, + }, { "nvim-mini/mini.pairs", event = "InsertEnter", diff --git a/lua/plugins/files.lua b/lua/plugins/files.lua index a276723..08aedff 100644 --- a/lua/plugins/files.lua +++ b/lua/plugins/files.lua @@ -2,7 +2,7 @@ return { { "stevearc/oil.nvim", cmd = "Oil", - keys = { { "-", "Oil", desc = "Open parent directory" } }, + keys = { { "-", "Oil", mode = { "n", "v" }, 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) @@ -11,6 +11,10 @@ return { require("lazy").load({ plugins = { "oil.nvim" } }) end end, - opts = { default_file_explorer = true }, + opts = { + default_file_explorer = true, + columns = { "icon", "size" }, + view_options = { show_hidden = true, natural_order = "fast" }, + }, }, } diff --git a/lua/plugins/format.lua b/lua/plugins/format.lua index be91fb6..7976980 100644 --- a/lua/plugins/format.lua +++ b/lua/plugins/format.lua @@ -28,7 +28,7 @@ return { sh = { "shfmt" }, bash = { "shfmt" }, yaml = { "prettierd" }, - json = { "prettierd" }, + json = { "jq" }, jsonc = { "prettierd" }, markdown = { "prettierd" }, rust = { "rustfmt" }, diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index aaaccc1..3b92282 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -17,6 +17,12 @@ return { gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) end, "Reset selection") map("n", "gb", gs.blame_line, "Blame line") + map("n", "gt", gs.toggle_current_line_blame, "Toggle line blame") + map("n", "gS", gs.stage_buffer, "Stage buffer") + map("n", "gR", gs.reset_buffer, "Reset buffer") + -- Hunk navigation without [ and ] (QWERTZ) + map("n", "h", function() gs.nav_hunk("next") end, "Next hunk") + map("n", "H", function() gs.nav_hunk("prev") end, "Previous hunk") map("n", "gp", gs.preview_hunk, "Preview hunk") end, }, diff --git a/lua/plugins/lang.lua b/lua/plugins/lang.lua new file mode 100644 index 0000000..31933c3 --- /dev/null +++ b/lua/plugins/lang.lua @@ -0,0 +1,50 @@ +-- Language-specific plugins. Servers, formatters and linters live in core/lsp.lua, +-- plugins/format.lua and plugins/lint.lua; Nix installs the binaries. +local full = vim.g.profile == "full" + +local go_keys = { + { "cA", "GoTestsAll", "Generate all tests" }, + { "cC", "GoCmt", "Generate comment" }, + { "cD", ":GoGet ", "Get dependency" }, + { "cE", "GoTestsExp", "Generate exported tests" }, + { "cg", "GoGenerate %", "Generate current file" }, + { "cI", ":GoImpl ", "Implement interface" }, + { "cM", ":GoMod ", "Run module command" }, + { "cN", "GoNew", "Generate constructor" }, + { "cR", "GoTagRm", "Remove tags" }, + { "cS", "GoTagAdd json", "Add JSON tags" }, + { "cT", "GoTestAdd", "Generate test" }, + { "cW", "GoWork sync", "Sync workspace" }, + { "cY", "GoTagAdd yaml", "Add YAML tags" }, + { "ce", "GoIfErr", "Generate if err" }, + { "cm", "GoMod tidy", "Tidy module" }, +} + +return { + { + "chomosuke/typst-preview.nvim", + cond = full, + ft = "typst", + version = "1.*", + opts = { + port = 8000, + dependencies_bin = { tinymist = "tinymist", websocat = "websocat" }, + }, + }, + { + "olexsmir/gopher.nvim", + cond = full, + ft = "go", + dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter" }, + opts = {}, + keys = vim.tbl_map(function(k) + return { k[1], k[2], desc = "Go: " .. k[3], ft = "go" } + end, go_keys), + }, + { + "dmmulroy/ts-error-translator.nvim", + cond = full, + ft = { "typescript", "typescriptreact" }, + opts = {}, + }, +} diff --git a/lua/plugins/lint.lua b/lua/plugins/lint.lua index 3a2f7f3..d371acd 100644 --- a/lua/plugins/lint.lua +++ b/lua/plugins/lint.lua @@ -6,7 +6,7 @@ return { event = { "BufReadPost", "BufNewFile", "BufWritePost" }, config = function() local lint = require("lint") - lint.linters_by_ft = { go = { "golangcilint" } } + lint.linters_by_ft = { go = { "golangcilint" }, rust = { "bacon" } } vim.api.nvim_create_autocmd({ "BufReadPost", "BufWritePost", "InsertLeave" }, { group = vim.api.nvim_create_augroup("plugins.lint", { clear = true }), diff --git a/lua/plugins/markdown.lua b/lua/plugins/markdown.lua index 82bf366..95b8876 100644 --- a/lua/plugins/markdown.lua +++ b/lua/plugins/markdown.lua @@ -1,8 +1,22 @@ +local full = vim.g.profile == "full" + return { { + -- Inline rendering while editing. "MeanderingProgrammer/render-markdown.nvim", - cond = vim.g.profile == "full", + cond = full, ft = "markdown", opts = {}, }, + { + -- Rendered preview in a split. Automatic rendering is off, so it never doubles up with render-markdown. + "OXY2DEV/markview.nvim", + cond = full, + cmd = "Markview", + keys = { { "mp", "Markview splitToggle", desc = "Markdown preview split" } }, + opts = { + preview = { enable = false, filetypes = { "markdown", "typst" } }, + experimental = { prefer_nvim = true, file_open_command = "tabnew" }, + }, + }, } diff --git a/lua/plugins/picker.lua b/lua/plugins/picker.lua index 88a4a88..cce4bc8 100644 --- a/lua/plugins/picker.lua +++ b/lua/plugins/picker.lua @@ -32,19 +32,91 @@ local function grep() end end +local function fuzzy_grep() + if use_fff() then + require("fff").live_grep({ grep = { modes = { "fuzzy", "plain" } } }) + else + Snacks.picker.grep() + end +end + +-- The dashboard centres every line on its own, so pad them all to one width to keep the art aligned. +local header = (function() + local lines = { + [[ __ __]], + [[ |__| ____ | | _________ ____ ______ ____ ___________]], + [[ | |/ _ \| |/ /\_ __ \_/ __ \ / ___// \_/ __ \_ __ \]], + [[ | ( <_> ) < | | \/\ ___/ \___ \| | \ ___/| | \/]], + [[/\__| |\____/|__|_ \ |__| \___ >____ >___| /\___ >__|]], + [[\______| \/ \/ \/ \/ \/]], + } + local width = 0 + for _, line in ipairs(lines) do + width = math.max(width, #line) + end + for i, line in ipairs(lines) do + lines[i] = line .. string.rep(" ", width - #line) + end + return table.concat(lines, "\n") +end)() + +-- The finder entries press the same leader maps as below, so fff and the snacks fallback stay in one place. +local dashboard = { + enabled = true, + width = 66, -- the header is 64 columns wide + preset = { + header = header, + keys = { + { icon = " ", key = "f", desc = "Find file", action = "ff" }, + { icon = " ", key = "r", desc = "Recent files", action = "fr" }, + { icon = " ", key = "w", desc = "Find word", action = "fw" }, + { icon = " ", key = "g", desc = "Grep", action = "fg" }, + { icon = " ", key = "p", desc = "Projects", action = "fp" }, + { + icon = " ", + key = "s", + desc = "Restore session", + action = function() + require("persistence").load() + end, + }, + { icon = "󰒲 ", key = "l", desc = "Lazy", action = ":Lazy" }, + { icon = " ", key = "q", desc = "Quit", action = ":qa" }, + }, + }, +} + local keys = { { "ff", files, desc = "Find files" }, + { "", files, desc = "Find files" }, + { ",", function() Snacks.picker.buffers() end, desc = "Buffers" }, + { "fr", function() Snacks.picker.recent() end, desc = "Recent files" }, + { "fp", function() Snacks.picker.projects() end, desc = "Projects" }, + { "fR", function() Snacks.picker.resume() end, desc = "Resume last picker" }, + { "fu", function() Snacks.picker.undo() end, desc = "Undo history" }, + { "fG", fuzzy_grep, desc = "Fuzzy grep" }, + { "gB", function() Snacks.picker.git_branches() end, desc = "Git branches" }, + { "gc", function() Snacks.picker.git_log() end, desc = "Git log" }, + { "gC", function() Snacks.picker.git_log_file() end, desc = "Git log (file)" }, + { "gx", function() Snacks.picker.git_status() end, desc = "Git status" }, + { "bd", function() Snacks.bufdelete() end, desc = "Delete buffer" }, + { "bD", function() Snacks.bufdelete({ force = true }) end, desc = "Delete buffer (force)" }, + { "bo", function() Snacks.bufdelete.other() end, desc = "Delete other buffers" }, + { "bb", "e #", desc = "Alternate buffer" }, { "fg", grep, desc = "Live grep" }, { "fw", function() Snacks.picker.grep_word() end, desc = "Grep word under cursor", mode = { "n", "x" } }, { "fb", function() Snacks.picker.buffers() end, desc = "Buffers" }, { "fh", function() Snacks.picker.help() end, desc = "Help" }, { "fk", function() Snacks.picker.keymaps() end, desc = "Keymaps" }, { "fd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" }, + { "cn", function() Snacks.words.jump(vim.v.count1) end, desc = "Next reference", mode = { "n", "t" } }, + { "cp", function() Snacks.words.jump(-vim.v.count1) end, desc = "Previous reference", mode = { "n", "t" } }, { "", function() Snacks.terminal.toggle(nil, { win = { position = "float" } }) end, desc = "Toggle terminal", mode = { "n", "t" } }, { "", function() Snacks.terminal.toggle(nil, { win = { position = "float" } }) end, desc = "which_key_ignore", mode = { "n", "t" } }, } if full then table.insert(keys, { "fs", function() Snacks.picker.lsp_workspace_symbols() end, desc = "Workspace symbols" }) + table.insert(keys, { "fo", function() Snacks.picker.lsp_symbols() end, desc = "Document symbols" }) end if vim.fn.executable("lazygit") == 1 then table.insert(keys, { "gg", function() Snacks.lazygit() end, desc = "Lazygit" }) @@ -70,11 +142,19 @@ return { priority = 1000, keys = keys, opts = { + dashboard = dashboard, picker = picker, lazygit = {}, terminal = {}, image = { enabled = full }, + words = { enabled = true }, + statuscolumn = { enabled = true }, + quickfile = { enabled = true }, }, + config = function(_, opts) + require("snacks").setup(opts) + require("core.toggles").setup() + end, }, { "dmtrKovalenko/fff.nvim", diff --git a/lua/plugins/statusline.lua b/lua/plugins/statusline.lua index f2585f7..004a3ce 100644 --- a/lua/plugins/statusline.lua +++ b/lua/plugins/statusline.lua @@ -16,6 +16,24 @@ local function agent_marker() end return { + { + "nvim-mini/mini.icons", + lazy = true, + opts = {}, + init = function() + -- Plugins that ask for nvim-web-devicons (mini.tabline, oil) get mini.icons instead. + package.preload["nvim-web-devicons"] = function() + require("mini.icons").mock_nvim_web_devicons() + return package.loaded["nvim-web-devicons"] + end + end, + }, + { + "nvim-mini/mini.tabline", + lazy = false, + dependencies = { "nvim-mini/mini.icons" }, + opts = { tabpage_section = "none" }, + }, { "nvim-mini/mini.statusline", lazy = false, diff --git a/lua/plugins/test.lua b/lua/plugins/test.lua index f6aa827..f25c56c 100644 --- a/lua/plugins/test.lua +++ b/lua/plugins/test.lua @@ -26,9 +26,55 @@ return { { "ts", nt(function(n) n.summary.toggle() end), desc = "Test summary" }, { "to", nt(function(n) n.output.open({ enter = true }) end), desc = "Test output" }, { "td", nt(function(n) n.run.run({ strategy = "dap" }) end), desc = "Debug nearest test" }, + { "tA", nt(function(n) n.run.run(vim.uv.cwd()) end), desc = "Run all tests" }, + { "tl", nt(function(n) n.run.run_last() end), desc = "Run last test" }, + { "tO", nt(function(n) n.output_panel.toggle() end), desc = "Test output panel" }, + { "tW", nt(function(n) n.watch.toggle(vim.fn.expand("%")) end), desc = "Watch test file" }, }, config = function() + -- One-line test errors in the diagnostics of neotest's own namespace. + vim.diagnostic.config({ + virtual_text = { + format = function(d) + return (d.message:gsub("%s+", " "):gsub("^%s+", "")) + end, + }, + }, vim.api.nvim_create_namespace("neotest")) + require("neotest").setup({ + discovery = { enabled = true, concurrent = 0 }, + running = { concurrent = true }, + summary = { animated = true }, + consumers = { + -- neotest has no "discovery done" event, so debounce the per-file events into a progress message. + discovery_progress = function(client) + local count, msg_id = 0, nil + local timer = vim.uv.new_timer() + local function progress(text, status) + msg_id = vim.api.nvim_echo({ { text } }, true, { + kind = "progress", + source = "neotest", + title = "Neotest", + status = status, + id = msg_id, + }) + end + client.listeners.discover_positions = function() + count = count + 1 + progress(("Discovering tests: %d files"):format(count), "running") + timer:stop() + timer:start( + 800, + 0, + vim.schedule_wrap(function() + progress(("Discovered tests in %d files"):format(count), "success") + count, msg_id = 0, nil + end) + ) + end + return {} + end, + }, adapters = { require("neotest-rust"), require("neotest-golang")({}), diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 9462491..ffdf406 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -27,6 +27,8 @@ local parsers = { "dockerfile", "gitcommit", "diff", + "typst", + "regex", }, } diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua new file mode 100644 index 0000000..0c3ce49 --- /dev/null +++ b/lua/plugins/ui.lua @@ -0,0 +1,81 @@ +-- Message, prompt and window-layout UI. Full profile only. +local full = vim.g.profile == "full" + +return { + { + "folke/noice.nvim", + cond = full, + event = "VeryLazy", + dependencies = { "MunifTanjim/nui.nvim" }, + keys = { + { "un", function() require("noice").cmd("dismiss") end, desc = "Dismiss notifications" }, + { "uN", function() require("noice").cmd("all") end, desc = "Show all messages" }, + }, + opts = { + lsp = { + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + }, + }, + presets = { + bottom_search = true, + command_palette = true, + long_message_to_split = true, + inc_rename = false, + lsp_doc_border = true, + }, + }, + }, + { + "stevearc/dressing.nvim", + cond = full, + event = "VeryLazy", + opts = { input = { default_prompt = ">" } }, + }, + { + "folke/edgy.nvim", + cond = full, + event = "VeryLazy", + init = function() + vim.opt.splitkeep = "screen" + end, + opts = { + bottom = { + { ft = "qf", title = "QuickFix" }, + { + ft = "help", + size = { height = 20 }, + filter = function(buf) + return vim.bo[buf].buftype == "help" + end, + }, + { ft = "neotest-output-panel", size = { height = 15 } }, + { ft = "trouble", title = "Trouble", size = { height = 15 } }, + { ft = "dap-repl", title = "REPL", size = { height = 12 } }, + }, + right = { + { ft = "sidekick_terminal", title = "Agent", size = { width = 80 } }, + }, + left = { + { + ft = "snacks_picker", + title = "Symbols", + filter = function(buf) + return vim.b[buf].snacks_picker_id == "lsp_symbols" + end, + size = { width = 0.2 }, + }, + { ft = "neotest-summary", title = "Neotest Summary", size = { width = 0.2 } }, + }, + options = { left = { size = 30 }, bottom = { size = 15 }, right = { size = 40 } }, + animate = { enabled = false }, + }, + }, + { + "chrisgrieser/nvim-early-retirement", + cond = full, + event = "VeryLazy", + opts = { retirementAgeMins = 20, ignoreUnsavedChangesBufs = true }, + }, +} diff --git a/lua/plugins/whichkey.lua b/lua/plugins/whichkey.lua index b4d89af..b08c0a3 100644 --- a/lua/plugins/whichkey.lua +++ b/lua/plugins/whichkey.lua @@ -3,12 +3,18 @@ local groups = { { "g", group = "Git" }, { "t", group = "Test and toggles" }, { "b", group = "Buffers" }, + { "q", group = "Session" }, + { "u", group = "UI toggles" }, } if vim.g.profile == "full" then vim.list_extend(groups, { { "l", group = "LSP" }, { "d", group = "Debug" }, { "a", group = "AI agent" }, + { "c", group = "Code" }, + { "m", group = "Markdown" }, + { "o", group = "Tasks" }, + { "x", group = "Diagnostics lists" }, }) end diff --git a/lua/plugins/workflow.lua b/lua/plugins/workflow.lua new file mode 100644 index 0000000..5aaa45b --- /dev/null +++ b/lua/plugins/workflow.lua @@ -0,0 +1,114 @@ +-- Sessions, tasks, todo comments, diagnostics lists and git diffs. +local full = vim.g.profile == "full" + +return { + { + "folke/persistence.nvim", + event = "BufReadPre", + -- No autoload: the dashboard shows first, `s` there or qs restores the session. + opts = {}, + keys = { + { "qs", function() require("persistence").load() end, desc = "Restore session" }, + { "ql", function() require("persistence").load({ last = true }) end, desc = "Restore last session" }, + { "qS", function() require("persistence").select() end, desc = "Select session" }, + { "qd", function() require("persistence").stop() end, desc = "Don't save current session" }, + { + "qx", + function() + local persistence = require("persistence") + local file = persistence.current() + if file and vim.fn.filereadable(file) == 1 then + vim.fn.delete(file) + vim.notify("Deleted session for " .. vim.fn.getcwd()) + end + persistence.stop() + end, + desc = "Delete current session", + }, + { + "qX", + function() + -- Branch sessions are stored as %%.vim + local persistence = require("persistence") + local project = persistence.current({ branch = false }) + local sessions = vim.list_extend( + vim.fn.glob(project, true, true), + vim.fn.glob(project:sub(1, -5) .. "%%*.vim", true, true) + ) + for _, session in ipairs(sessions) do + vim.fn.delete(session) + end + persistence.stop() + vim.notify(("Deleted %d session(s) for %s"):format(#sessions, vim.fn.getcwd())) + end, + desc = "Delete all project sessions", + }, + }, + }, + { + "stevearc/overseer.nvim", + cond = full, + cmd = { "OverseerRun", "OverseerToggle", "OverseerTaskAction" }, + keys = { + { "or", "OverseerRun", desc = "Run task" }, + { "oo", "OverseerToggle", desc = "Toggle task window" }, + { "oa", "OverseerTaskAction", desc = "Task action" }, + }, + opts = { + strategy = { "terminal", use_shell = true, direction = "horizontal", size = 15, auto_scroll = true }, + }, + }, + { + "folke/todo-comments.nvim", + cond = full, + dependencies = { "nvim-lua/plenary.nvim" }, + event = { "BufReadPost", "BufNewFile" }, + opts = {}, + keys = { + { "ft", function() Snacks.picker.todo_comments() end, desc = "Find todos" }, + { + "fT", + function() Snacks.picker.todo_comments({ keywords = { "TODO", "FIX", "FIXME" } }) end, + desc = "Find todos and fixes", + }, + }, + }, + { + "harukikuri/todoage.nvim", + cond = full, + event = "BufReadPost", + opts = {}, + }, + { + "folke/trouble.nvim", + cond = full, + cmd = "Trouble", + opts = {}, + keys = { + { "xx", "Trouble diagnostics toggle", desc = "Diagnostics (Trouble)" }, + { "xb", "Trouble diagnostics toggle filter.buf=0", desc = "Buffer diagnostics (Trouble)" }, + { "xq", "Trouble qflist toggle", desc = "Quickfix list (Trouble)" }, + { "xl", "Trouble loclist toggle", desc = "Location list (Trouble)" }, + }, + }, + { + "esmuellert/codediff.nvim", + cond = full, + cmd = "CodeDiff", + keys = { + { "gd", "CodeDiff", desc = "Diff status" }, + { "gm", "CodeDiff main...", desc = "Diff from main" }, + { "gM", "CodeDiff main", desc = "Diff with main" }, + { "gf", "CodeDiff file main... --inline", desc = "File diff from main" }, + { "gF", "CodeDiff file main --inline", desc = "File diff with main" }, + { + "gL", + function() + local line = vim.fn.line(".") + vim.cmd(("%d,%dCodeDiff history"):format(line, line)) + end, + desc = "Current line history", + }, + }, + }, +} diff --git a/nix/module.nix b/nix/module.nix index 3ebf62c..09c6ed1 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -51,6 +51,17 @@ let golangci-lint delve + gomodifytags # gopher.nvim + gotests + iferr + impl + + bacon + + tinymist # typst LSP and typst-preview.nvim + websocat + typst + vtsls vscode-js-debug @@ -60,6 +71,7 @@ let intelephense # unfree: the host must allow it phpPackages.php-cs-fixer phpstan + jq # json formatter ]; # Kept out of home.packages to avoid colliding with other pythons/nodes.