_inputs: { pkgs, ... }: # TODO: neodev # TODO: pandoc { programs.nixvim = { # TODO: see below # highlight = { # "@org.keyword.done".link = "Comment"; # "@org.keyword.todo".link = "Todo"; # }; extraPlugins = with pkgs.unstable.vimPlugins; [ org-roam-nvim ]; plugins = { clangd-extensions.enable = true; crates = { enable = true; settings.null_ls.enabled = true; }; lsp = { enable = true; keymaps = { diagnostic = { "se" = { action = "open_float"; desc = "LSP diagnostic"; }; "sl" = { action = "setloclist"; desc = "LSP set loclist"; }; "sq" = { action = "setqflist"; desc = "LSP set quickfixlist"; }; }; extra = [ { key = "grr"; action = "Trouble lsp_references focus=true"; options.desc = "LSP references"; } { key = "gri"; action = "Trouble lsp_implementations focus=true"; options.desc = "LSP implementations"; } { key = "gO"; action = "Trouble lsp_document_symbols focus=true"; options.desc = "LSP document symbols"; } { key = "gd"; action = "Trouble lsp_definitions focus=true"; options.desc = "LSP definitions"; } { key = "sE"; action = "require('telescope.builtin').diagnostics"; lua = true; options.desc = "LSP all diagnostics"; } { key = "ss"; action = "require('telescope.builtin').lsp_document_symbols"; lua = true; options.desc = "LSP document symbols"; } { key = "sS"; action = "require('telescope.builtin').lsp_workspace_symbols"; lua = true; options.desc = "LSP workspace symbols"; } ]; lspBuf = { "sf" = { action = "format"; desc = "LSP format"; }; "st" = { action = "type_definition"; desc = "LSP type definition"; }; }; }; onAttach = '' require("clangd_extensions.inlay_hints").setup_autocmd() require("clangd_extensions.inlay_hints").set_inlay_hints() ''; inlayHints = true; servers = { bashls.enable = true; clangd = { enable = true; extraOptions.cmd = [ "clangd" "--background-index" "--clang-tidy" "--fallback-style=WebKit" "--header-insertion-decorators" "--header-insertion=iwyu" ]; }; elixirls.enable = true; lua_ls.enable = true; # completion.callSnippet = "Replace";? marksman.enable = true; nil_ls = { enable = true; settings.formatting.command = [ "nixfmt" ]; }; pylsp.enable = true; pyright.enable = true; ruff = { enable = true; settings = { configurationPreference = "filesystemFirst"; lineLength = 100; lint = { preview = true; extendSelect = [ # Error "E" # Pyflakes "F" # Warning "W" # ISort "I" # PEP8 Naming "N" # Ruff-specific rules "RUF" ]; }; }; }; superhtml = { enable = true; package = pkgs.unstable.superhtml; }; taplo.enable = true; tinymist.enable = true; typos_lsp.enable = true; }; }; orgmode = { enable = true; settings = { org_agenda_files = "~/Documents/orgmode/**/*"; org_default_notes_file = "~/Documents/orgmode/refile.org"; org_todo_keywords = [ "TODO" "WAITING" "|" "DONE(d)" "DELEGATED" "CANCELLED" ]; }; }; rustaceanvim = { enable = true; settings.server = { on_attach = '' function(client, bufnr) _M.lspOnAttach(client, bufnr) vim.keymap.set( -- {"n", "v"}, "n", "J", function() vim.cmd.RustLsp('joinLines') end, { silent = true, buffer = bufnr, desc = "rust-analyzer join lines", } ) vim.keymap.set( "n", "", function() vim.cmd.RustLsp({ "moveItem", "up" }) end, { silent = true, buffer = bufnr, desc = "rust-analyzer move item up", } ) vim.keymap.set( "n", "", function() vim.cmd.RustLsp({ "moveItem", "down" }) end, { silent = true, buffer = bufnr, desc = "rust-analyzer move item down", } ) vim.keymap.set( "n", "sR", function() vim.cmd.RustLsp('runnables') end, { silent = true, buffer = bufnr, desc = "rust-analyzer runnables", } ) vim.keymap.set( "n", "sx", function() vim.cmd.RustLsp('explainError') end, { silent = true, buffer = bufnr, desc = "rust-analyzer explain error", } ) end ''; # TODO? # settings.rust-analyzer = { # checkOnSave.command = "clippy"; # experimental.procAttrMacros = true; # }; }; }; todo-comments.enable = true; }; extraConfigLuaPost = '' vim.api.nvim_create_autocmd('LspAttach', { callback = function(ev) local client = vim.lsp.get_client_by_id(ev.data.client_id) if client:supports_method('textDocument/completion') then vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true }) end end, }) -- TODO: this should be configurable -- TODO: this doesn't work when switching dark/light mode vim.api.nvim_set_hl(0, "@org.keyword.done", { link = "Comment" }) vim.api.nvim_set_hl(0, "@org.keyword.todo", { link = "Todo" }) -- TODO: make a nixvim module require("org-roam").setup({ directory = "~/Documents/orgmode/", extensions = { dailies = { directory = "journal", } } }) ''; }; }