From 09e9158b85a1a4b41f015f9efa8ff4908f9f9760 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 21 Jun 2024 04:30:18 +0000 Subject: [PATCH 1/2] [chore] flake.lock: update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also fix neovim errors Flake lock file updates: • Updated input 'home-manager': 'github:nix-community/home-manager/845a5c4c073f74105022533907703441e0464bc3?narHash=sha256-vWSkg6AMok1UUQiSYVdGMOXKD2cDFnajITiSi0Zjd1A%3D' (2024-06-04) → 'github:nix-community/home-manager/a1fddf0967c33754271761d91a3d921772b30d0e?narHash=sha256-BmO8d0r%2BBVlwWtMLQEYnwmngqdXIuyFzMwvmTcLMee8%3D' (2024-06-16) • Updated input 'lix': 'https://git.lix.systems/api/v1/repos/lix-project/lix/archive/068576042b3b58f8180b24a36c07199a1a3fd380.tar.gz?narHash=sha256-/hsqsiw3p5qMpazedgFFZF2sQghbCJIoef7XCpegTXw%3D' (2024-06-13) → 'https://git.lix.systems/api/v1/repos/lix-project/lix/archive/e44dcd63c4d96807536cdcf2afb688a537cce9be.tar.gz?narHash=sha256-cAkgZoiP2eHB%2BV2cPJMcXACzdaWZIMgI5sg4vpH%2BDYo%3D' (2024-06-20) • Updated input 'lix-module': 'https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/4e25f1ab68f2270f9cff59216056c21073db0164.tar.gz?narHash=sha256-m8XYt8NU2T4gvkien7H7LFGXHhSA5z4tHOeuXQ3DJi4%3D' (2024-06-06) → 'https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/909e593ae9f5fe338ab19b4ed9d52bb0ea09bad8.tar.gz?narHash=sha256-DdcMvX9r29uHMlz7P1Shgs5xZw9WkZ4ObMGYzwROAiw%3D' (2024-06-19) • Updated input 'nixos-hardware': 'github:NixOS/nixos-hardware/ae5c8dcc4d0182d07d75df2dc97112de822cb9d6?narHash=sha256-SuPne4BMqh9/IkKIAG47Cu5qfmntAaqlHdX1yuFoDO0%3D' (2024-06-14) → 'github:NixOS/nixos-hardware/083823b7904e43a4fc1c7229781417e875359a42?narHash=sha256-hxQBUtDbFOCCW1CsFZTS9Q5Ov1ZKdJgbBZHSez1M6iA%3D' (2024-06-20) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/cc54fb41d13736e92229c21627ea4f22199fee6b?narHash=sha256-US1tAChvPxT52RV8GksWZS415tTS7PV42KTc2PNDBmc%3D' (2024-06-12) → 'github:NixOS/nixpkgs/dd457de7e08c6d06789b1f5b88fc9327f4d96309?narHash=sha256-wM9v2yIxClRYsGHut5vHICZTK7xdrUGfrLkXvSuv6s4%3D' (2024-06-19) • Updated input 'nixvim': 'github:nix-community/nixvim/7a2a25af02be25987aa43cd681312f4b5ba12317?narHash=sha256-NIJZxmY2CWsqJK/9BQCRSHfcCY9K6thjq/1XtJobxmU%3D' (2024-06-14) → 'github:nix-community/nixvim/744dfea48bdd331e66b9e874822559fa6fae98af?narHash=sha256-artyEBzWUsNXtYj7jBr816wRJj2Y3DYDHw6ECrQotX0%3D' (2024-06-20) • Updated input 'nixvim/treefmt-nix': 'github:numtide/treefmt-nix/1cb529bffa880746a1d0ec4e0f5076876af931f1?narHash=sha256-1TZQcdETNdJMcfwwoshVeCjwWfrPtkSQ8y8wFX3it7k%3D' (2024-06-11) → 'github:numtide/treefmt-nix/68eb1dc333ce82d0ab0c0357363ea17c31ea1f81?narHash=sha256-ULzoKzEaBOiLRtjeY3YoGFJMwWSKRYOic6VNw2UyTls%3D' (2024-06-16) • Updated input 'unstable': 'github:NixOS/nixpkgs/e9ee548d90ff586a6471b4ae80ae9cfcbceb3420?narHash=sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY%3D' (2024-06-13) → 'github:NixOS/nixpkgs/c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e?narHash=sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak%3D' (2024-06-18) --- flake.lock | 54 +++--- flake.nix | 3 +- nvim/augroups.nix | 150 +++++++-------- nvim/mappings.nix | 304 +++++++++++++++--------------- nvim/nixvim.nix | 7 +- nvim/plugins.nix | 461 ++++++++++++++++++++++++---------------------- 6 files changed, 501 insertions(+), 478 deletions(-) diff --git a/flake.lock b/flake.lock index 124c48f..4c2cb42 100644 --- a/flake.lock +++ b/flake.lock @@ -334,11 +334,11 @@ ] }, "locked": { - "lastModified": 1717527182, - "narHash": "sha256-vWSkg6AMok1UUQiSYVdGMOXKD2cDFnajITiSi0Zjd1A=", + "lastModified": 1718530513, + "narHash": "sha256-BmO8d0r+BVlwWtMLQEYnwmngqdXIuyFzMwvmTcLMee8=", "owner": "nix-community", "repo": "home-manager", - "rev": "845a5c4c073f74105022533907703441e0464bc3", + "rev": "a1fddf0967c33754271761d91a3d921772b30d0e", "type": "github" }, "original": { @@ -371,11 +371,11 @@ "lix": { "flake": false, "locked": { - "lastModified": 1718316862, - "narHash": "sha256-/hsqsiw3p5qMpazedgFFZF2sQghbCJIoef7XCpegTXw=", - "rev": "068576042b3b58f8180b24a36c07199a1a3fd380", + "lastModified": 1718902806, + "narHash": "sha256-cAkgZoiP2eHB+V2cPJMcXACzdaWZIMgI5sg4vpH+DYo=", + "rev": "e44dcd63c4d96807536cdcf2afb688a537cce9be", "type": "tarball", - "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/068576042b3b58f8180b24a36c07199a1a3fd380.tar.gz" + "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/e44dcd63c4d96807536cdcf2afb688a537cce9be.tar.gz" }, "original": { "type": "tarball", @@ -396,11 +396,11 @@ ] }, "locked": { - "lastModified": 1717647344, - "narHash": "sha256-m8XYt8NU2T4gvkien7H7LFGXHhSA5z4tHOeuXQ3DJi4=", - "rev": "4e25f1ab68f2270f9cff59216056c21073db0164", + "lastModified": 1718778751, + "narHash": "sha256-DdcMvX9r29uHMlz7P1Shgs5xZw9WkZ4ObMGYzwROAiw=", + "rev": "909e593ae9f5fe338ab19b4ed9d52bb0ea09bad8", "type": "tarball", - "url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/4e25f1ab68f2270f9cff59216056c21073db0164.tar.gz" + "url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/909e593ae9f5fe338ab19b4ed9d52bb0ea09bad8.tar.gz" }, "original": { "type": "tarball", @@ -409,11 +409,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1718349360, - "narHash": "sha256-SuPne4BMqh9/IkKIAG47Cu5qfmntAaqlHdX1yuFoDO0=", + "lastModified": 1718894893, + "narHash": "sha256-hxQBUtDbFOCCW1CsFZTS9Q5Ov1ZKdJgbBZHSez1M6iA=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "ae5c8dcc4d0182d07d75df2dc97112de822cb9d6", + "rev": "083823b7904e43a4fc1c7229781417e875359a42", "type": "github" }, "original": { @@ -424,11 +424,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1718208800, - "narHash": "sha256-US1tAChvPxT52RV8GksWZS415tTS7PV42KTc2PNDBmc=", + "lastModified": 1718835956, + "narHash": "sha256-wM9v2yIxClRYsGHut5vHICZTK7xdrUGfrLkXvSuv6s4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cc54fb41d13736e92229c21627ea4f22199fee6b", + "rev": "dd457de7e08c6d06789b1f5b88fc9327f4d96309", "type": "github" }, "original": { @@ -453,16 +453,16 @@ ], "nix-darwin": [], "nixpkgs": [ - "nixpkgs" + "unstable" ], "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1718376125, - "narHash": "sha256-NIJZxmY2CWsqJK/9BQCRSHfcCY9K6thjq/1XtJobxmU=", + "lastModified": 1718869672, + "narHash": "sha256-artyEBzWUsNXtYj7jBr816wRJj2Y3DYDHw6ECrQotX0=", "owner": "nix-community", "repo": "nixvim", - "rev": "7a2a25af02be25987aa43cd681312f4b5ba12317", + "rev": "744dfea48bdd331e66b9e874822559fa6fae98af", "type": "github" }, "original": { @@ -544,11 +544,11 @@ ] }, "locked": { - "lastModified": 1718139168, - "narHash": "sha256-1TZQcdETNdJMcfwwoshVeCjwWfrPtkSQ8y8wFX3it7k=", + "lastModified": 1718522839, + "narHash": "sha256-ULzoKzEaBOiLRtjeY3YoGFJMwWSKRYOic6VNw2UyTls=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "1cb529bffa880746a1d0ec4e0f5076876af931f1", + "rev": "68eb1dc333ce82d0ab0c0357363ea17c31ea1f81", "type": "github" }, "original": { @@ -559,11 +559,11 @@ }, "unstable": { "locked": { - "lastModified": 1718318537, - "narHash": "sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY=", + "lastModified": 1718714799, + "narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e9ee548d90ff586a6471b4ae80ae9cfcbceb3420", + "rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 96a26cc..a0f8e30 100644 --- a/flake.nix +++ b/flake.nix @@ -46,8 +46,7 @@ url = "github:nix-community/nixvim"; inputs = { # Disable until fixed upstream: https://github.com/nix-community/nixvim/issues/1699 - # nixpkgs.follows = "unstable"; - nixpkgs.follows = "nixpkgs"; + nixpkgs.follows = "unstable"; devshell.follows = "devshell"; nix-darwin.follows = ""; # disable MacOS stuff home-manager.follows = "home-manager"; diff --git a/nvim/augroups.nix b/nvim/augroups.nix index 868fb20..9c7a73f 100644 --- a/nvim/augroups.nix +++ b/nvim/augroups.nix @@ -1,16 +1,24 @@ { - autoGroups = { - "highlightOnYank" = {}; - "lspConfig" = {}; - "restoreCursorPosition" = {}; - }; - autoCmd = [ - { - group = "highlightOnYank"; - event = "TextYankPost"; - pattern = "*"; - callback = { - __raw = '' + lib, + config, + helpers, + ... +}: let + inherit (helpers) mkRaw; + cfg = config.jhome.nvim; +in + lib.mkIf cfg.enable { + autoGroups = { + "highlightOnYank" = {}; + "lspConfig" = {}; + "restoreCursorPosition" = {}; + }; + autoCmd = [ + { + group = "highlightOnYank"; + event = "TextYankPost"; + pattern = "*"; + callback = mkRaw '' function() vim.highlight.on_yank { higroup = ( @@ -20,71 +28,67 @@ } end ''; - }; - } - { - group = "restoreCursorPosition"; - event = "BufReadPost"; - pattern = "*"; - callback = { - __raw = '' + } + { + group = "restoreCursorPosition"; + event = "BufReadPost"; + pattern = "*"; + callback = mkRaw '' function() if vim.fn.line '\'"' > 0 and vim.fn.line '\'"' <= vim.fn.line '$' then vim.cmd [[execute "normal! g'\""]] end end ''; - }; - } - { - group = "lspConfig"; - event = "LspAttach"; - pattern = "*"; - callback = let - opts = "noremap = true, buffer = bufnr"; - in { - __raw = '' - function(opts) - local bufnr = opts.buf - local client = vim.lsp.get_client_by_id(opts.data.client_id) - local capabilities = client.server_capabilities - -- Set Omnifunc if supported - if capabilities.completionProvider then - vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc" + } + { + group = "lspConfig"; + event = "LspAttach"; + pattern = "*"; + callback = let + opts = "noremap = true, buffer = bufnr"; + in + mkRaw '' + function(opts) + local bufnr = opts.buf + local client = vim.lsp.get_client_by_id(opts.data.client_id) + local capabilities = client.server_capabilities + -- Set Omnifunc if supported + if capabilities.completionProvider then + vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc" + end + -- Enable inlay hints if supported + if capabilities.inlayHintProvider then + vim.lsp.inlay_hint.enable(true, { bufnr = bufnr }) + end + -- Some Lsp servers do not advertise inlay hints properly so enable this keybinding regardless + vim.keymap.set('n', 'ht', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({bufnr = 0}), { bufnr = 0 }) + end, + { desc = '[H]ints [T]oggle', ${opts} } + ) + -- Enable hover if supported + if capabilities.hoverProvider then + vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = 'Hover Documentation', ${opts} }) + end + -- Enable rename if supported + if capabilities.renameProvider then + vim.keymap.set('n', 'r', vim.lsp.buf.rename, { desc = '[R]ename', ${opts} }) + end + -- Enable code actions if supported + if capabilities.codeActionProvider then + vim.keymap.set({ 'n', 'v' }, 'fa', vim.lsp.buf.code_action, { desc = '[F]ind Code [A]ctions', ${opts} }) + end + -- Enable formatting if supported + if capabilities.documentFormattingProvider then + vim.keymap.set('n', 'w', function() require("conform").format({ lsp_fallback = true }) end, { desc = 'Format Buffer', ${opts} }) + end + -- Other keybinds + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { desc = '[G]o to [D]efinition', ${opts} }) + vim.keymap.set('n', 'gt', vim.lsp.buf.type_definition, { desc = '[G]o to [T]ype Definition', ${opts} }) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = '[G]o to [I]mplementation', ${opts} }) end - -- Enable inlay hints if supported - if capabilities.inlayHintProvider then - vim.lsp.inlay_hint.enable(true, { bufnr = bufnr }) - end - -- Some Lsp servers do not advertise inlay hints properly so enable this keybinding regardless - vim.keymap.set('n', 'ht', function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({bufnr = 0}), { bufnr = 0 }) - end, - { desc = '[H]ints [T]oggle', ${opts} } - ) - -- Enable hover if supported - if capabilities.hoverProvider then - vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = 'Hover Documentation', ${opts} }) - end - -- Enable rename if supported - if capabilities.renameProvider then - vim.keymap.set('n', 'r', vim.lsp.buf.rename, { desc = '[R]ename', ${opts} }) - end - -- Enable code actions if supported - if capabilities.codeActionProvider then - vim.keymap.set({ 'n', 'v' }, 'fa', vim.lsp.buf.code_action, { desc = '[F]ind Code [A]ctions', ${opts} }) - end - -- Enable formatting if supported - if capabilities.documentFormattingProvider then - vim.keymap.set('n', 'w', function() require("conform").format({ lsp_fallback = true }) end, { desc = 'Format Buffer', ${opts} }) - end - -- Other keybinds - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { desc = '[G]o to [D]efinition', ${opts} }) - vim.keymap.set('n', 'gt', vim.lsp.buf.type_definition, { desc = '[G]o to [T]ype Definition', ${opts} }) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = '[G]o to [I]mplementation', ${opts} }) - end - ''; - }; - } - ]; -} + ''; + } + ]; + } diff --git a/nvim/mappings.nix b/nvim/mappings.nix index 49933ef..84000c0 100644 --- a/nvim/mappings.nix +++ b/nvim/mappings.nix @@ -1,148 +1,158 @@ -let - mkRaw = data: {__raw = data;}; -in [ - # Quickfix - { - mode = "n"; - key = "qo"; - action = "Copen"; - options.desc = "Quickfix Open"; +{ + lib, + config, + helpers, + ... +}: let + inherit (helpers) mkRaw; + + cfg = config.jhome.nvim; +in + lib.mkIf cfg.enable { + keymaps = [ + # Quickfix + { + mode = "n"; + key = "qo"; + action = "Copen"; + options.desc = "Quickfix Open"; + } + { + mode = "n"; + key = "qq"; + action = "cclose"; + options.desc = "Quickfix Quit"; + } + { + mode = "n"; + key = "qj"; + action = "cnext"; + options.desc = "Quickfix next [J]"; + } + { + mode = "n"; + key = "qk"; + action = "cprev"; + options.desc = "Quickfix previous [K]"; + } + # Open or create file + { + mode = "n"; + key = "gf"; + action = "e "; + options.desc = "Go to File"; + } + # Keep Selection when indenting + { + mode = "x"; + key = ">"; + action = ">gv"; + options.desc = "Indent Selection"; + } + { + mode = "x"; + key = "<"; + action = ""] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif require("luasnip").expand_or_jumpable() then - require("luasnip").expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, - [""] = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif require("luasnip").jumpable(-1) then - require("luasnip").jump(-1) - else - fallback() - end - end, - [""] = cmp.mapping(function(fallback) - if require("luasnip").choice_active() then - require("luasnip").next_choice() - else - fallback() - end - end), - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete { }, - [""] = cmp.mapping.close(), - [""] = cmp.mapping.confirm { select = true }, - }) - ''; - }; - }; - # FIXME: doesn't include formatters - conform-nvim = { - enable = true; - formattersByFt = { - "_" = ["trim_whitespace"]; - c = ["clang_format"]; - cpp = ["clang_format"]; - lua = ["stylua"]; - nix = ["alejandra"]; - rust = ["rustfmt"]; - sh = ["shfmt"]; - toml = ["taplo"]; - yaml = ["yamlfmt"]; - zig = ["zigfmt"]; - }; - }; - gitsigns.enable = true; - lsp = { - enable = true; - servers = { - bashls.enable = true; - # clangd.enable = true; # Adds ~2GiB - html.enable = true; - jsonls.enable = true; - nil-ls = { +{ + lib, + pkgs, + helpers, + config, + ... +}: let + inherit (helpers) mkRaw; + cfg = config.jhome.nvim; +in + lib.mkIf cfg.enable { + plugins = { + bacon = { enable = true; - settings.nix.flake = { - autoArchive = true; - autoEvalInputs = true; + settings.quickfix.enabled = true; + }; + cmp = { + enable = true; + cmdline = { + "/" = { + mapping = mkRaw "cmp.mapping.preset.cmdline()"; + sources = [ + {name = "rg";} + {name = "buffer";} + ]; + }; + ":" = { + mapping = mkRaw "cmp.mapping.preset.cmdline()"; + sources = [ + {name = "path";} + {name = "cmdline";} + ]; + }; + }; + settings = { + # Snippets + snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; + # Completion Sources + sources = [ + { + name = "buffer"; + groupIndex = 3; + } + { + name = "calc"; + groupIndex = 2; + } + { + name = "conventionalcommits"; + groupIndex = 1; + } + { + name = "crates"; + groupIndex = 1; + } + { + name = "luasnip"; + groupIndex = 1; + } + { + name = "nvim_lsp"; + groupIndex = 1; + } + { + name = "nvim_lsp_document_symbol"; + groupIndex = 1; + } + { + name = "nvim_lsp_signature_help"; + groupIndex = 1; + } + { + name = "path"; + groupIndex = 2; + } + { + name = "spell"; + groupIndex = 2; + } + { + name = "treesitter"; + groupIndex = 2; + } + { + name = "zsh"; + groupIndex = 1; + } + ]; + mapping = mkRaw '' + cmp.mapping.preset.insert({ + [""] = function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif require("luasnip").expand_or_jumpable() then + require("luasnip").expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, + [""] = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif require("luasnip").jumpable(-1) then + require("luasnip").jump(-1) + else + fallback() + end + end, + [""] = cmp.mapping(function(fallback) + if require("luasnip").choice_active() then + require("luasnip").next_choice() + else + fallback() + end + end), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete { }, + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm { select = true }, + }) + ''; + }; + }; + # FIXME: doesn't include formatters + conform-nvim = { + enable = true; + formattersByFt = { + "_" = ["trim_whitespace"]; + c = ["clang_format"]; + cpp = ["clang_format"]; + lua = ["stylua"]; + nix = ["alejandra"]; + rust = ["rustfmt"]; + sh = ["shfmt"]; + toml = ["taplo"]; + yaml = ["yamlfmt"]; + zig = ["zigfmt"]; + }; + }; + gitsigns.enable = true; + lsp = { + enable = true; + servers = { + bashls.enable = true; + bashls.package = pkgs.unstable.bash-language-server; + # clangd.enable = true; # Adds ~2GiB + html.enable = true; + jsonls.enable = true; + nil-ls = { + enable = true; + settings.nix.flake = { + autoArchive = true; + autoEvalInputs = true; + }; + }; + ruff-lsp.enable = true; + taplo.enable = true; + # texlab.enable = true; # Not writing TeX rn + typos-lsp.enable = true; + typst-lsp.enable = true; + }; + }; + lspkind = { + enable = true; + mode = "symbol"; + extraOptions.maxwidth = 50; + }; + lualine = { + enable = true; + theme = lib.mkForce "gruvbox"; + }; + luasnip = { + enable = true; + extraConfig = { + update_events = "TextChanged,TextChangedI"; + }; + }; + noice = { + enable = true; + lsp.override = { + "vim.lsp.util.convert_input_to_markdown_lines" = true; + "vim.lsp.util.stylize_markdown" = true; + "cmp.entry.get_documentation" = true; + }; + presets = { + # use a classic bottom cmdline for search + bottom_search = true; + # position the cmdline and popupmenu together + command_palette = false; + # long messages will be sent to a split + long_message_to_split = true; + # enables an input dialog for inc-rename.nvim + inc_rename = false; + # add a border to hover docs and signature help + lsp_doc_border = true; + }; + }; + notify = { + enable = true; + backgroundColour = "#000000"; + }; + nvim-colorizer = { + enable = true; + userDefaultOptions = { + names = false; # disable named colors (i.e. red) + mode = "virtualtext"; + }; + }; + rustaceanvim.enable = true; + telescope = { + enable = true; + extensions = { + ui-select.enable = true; + fzy-native.enable = true; + }; + }; + treesitter = { + enable = true; + indent = true; + incrementalSelection.enable = true; + }; + trouble = { + enable = true; + settings.auto_close = true; + }; + lint = { + enable = true; + lintersByFt = { + rust = ["typos"]; + latex = ["chktex" "typos"]; + markdown = ["typos"]; + nix = ["statix"]; + sh = ["dash"]; + zsh = ["zsh"]; }; }; - ruff-lsp.enable = true; - taplo.enable = true; - # texlab.enable = true; # Not writing TeX rn - typos-lsp.enable = true; - typst-lsp.enable = true; }; - }; - lspkind = { - enable = true; - mode = "symbol"; - extraOptions.maxwidth = 50; - }; - lualine = { - enable = true; - theme = lib.mkForce "gruvbox"; - }; - luasnip = { - enable = true; - extraConfig = { - update_events = "TextChanged,TextChangedI"; - }; - }; - noice = { - enable = true; - lsp.override = { - "vim.lsp.util.convert_input_to_markdown_lines" = true; - "vim.lsp.util.stylize_markdown" = true; - "cmp.entry.get_documentation" = true; - }; - presets = { - # use a classic bottom cmdline for search - bottom_search = true; - # position the cmdline and popupmenu together - command_palette = false; - # long messages will be sent to a split - long_message_to_split = true; - # enables an input dialog for inc-rename.nvim - inc_rename = false; - # add a border to hover docs and signature help - lsp_doc_border = true; - }; - }; - notify = { - enable = true; - backgroundColour = "#000000"; - }; - nvim-colorizer = { - enable = true; - userDefaultOptions = { - names = false; # disable named colors (i.e. red) - mode = "virtualtext"; - }; - }; - rustaceanvim.enable = true; - telescope = { - enable = true; - extensions = { - ui-select.enable = true; - fzy-native.enable = true; - }; - }; - treesitter = { - enable = true; - indent = true; - incrementalSelection.enable = true; - }; - trouble = { - enable = true; - settings.auto_close = true; - }; - lint = { - enable = true; - lintersByFt = { - rust = ["typos"]; - latex = ["chktex" "typos"]; - markdown = ["typos"]; - nix = ["statix"]; - sh = ["dash"]; - zsh = ["zsh"]; - }; - }; -} + } -- 2.47.0 From ac5e62a37ce51b1efaf4f2e323bf24a88188cc62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Sat, 22 Jun 2024 19:06:45 +0200 Subject: [PATCH 2/2] [feat] nvim: enable more lsps Also, don't install rust-analyzer, install it externally (e.g. rustup) --- nvim/plugins.nix | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/nvim/plugins.nix b/nvim/plugins.nix index c55020d..a0a0cfc 100644 --- a/nvim/plugins.nix +++ b/nvim/plugins.nix @@ -141,6 +141,17 @@ in }; }; gitsigns.enable = true; + lint = { + enable = true; + lintersByFt = { + rust = ["typos"]; + latex = ["chktex" "typos"]; + markdown = ["typos"]; + nix = ["statix"]; + sh = ["dash"]; + zsh = ["zsh"]; + }; + }; lsp = { enable = true; servers = { @@ -149,6 +160,8 @@ in # clangd.enable = true; # Adds ~2GiB html.enable = true; jsonls.enable = true; + marksman.enable = true; + nixd.enable = true; nil-ls = { enable = true; settings.nix.flake = { @@ -209,7 +222,11 @@ in mode = "virtualtext"; }; }; - rustaceanvim.enable = true; + rustaceanvim = { + enable = true; + # Install through rustup + rustAnalyzerPackage = null; + }; telescope = { enable = true; extensions = { @@ -226,16 +243,5 @@ in enable = true; settings.auto_close = true; }; - lint = { - enable = true; - lintersByFt = { - rust = ["typos"]; - latex = ["chktex" "typos"]; - markdown = ["typos"]; - nix = ["statix"]; - sh = ["dash"]; - zsh = ["zsh"]; - }; - }; }; } -- 2.47.0