From 9f931b563f01f2a8d04c050fe13c0f8fe2672779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 19 Jul 2024 16:58:38 +0200 Subject: [PATCH 1/9] refactor: small clean up --- modules/programs/nvim/plugins/ui.nix | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/modules/programs/nvim/plugins/ui.nix b/modules/programs/nvim/plugins/ui.nix index 96e28c2..a8614b6 100644 --- a/modules/programs/nvim/plugins/ui.nix +++ b/modules/programs/nvim/plugins/ui.nix @@ -1,36 +1,38 @@ { pkgs, lib, inputs, ... }: -with builtins; +let + inherit (lib) readFile; +in { - config.home-manager.users.moritz.programs.neovim.lazy.plugins = with pkgs.vimPlugins; [ + config.home-manager.users.moritz.programs.neovim.lazy.plugins = [ { - plugin = which-key-nvim; + plugin = pkgs.vimPlugins.which-key-nvim; lazy = false; conf = readFile ./lua/which-key-nvim.lua; } { - plugin = catppuccin-nvim; + plugin = pkgs.vimPlugins.catppuccin-nvim; conf = readFile ./lua/catppuccin-nvim.lua; lazy = false; priority = 99; } { - plugin = todo-comments-nvim; - dependencies = [{ plugin = plenary-nvim; }]; + plugin = pkgs.vimPlugins.todo-comments-nvim; + dependencies = [{ plugin = pkgs.vimPlugins.plenary-nvim; }]; opts = { }; } { - plugin = dressing-nvim; + plugin = pkgs.vimPlugins.dressing-nvim; event = [ "VeryLazy" ]; } { - plugin = gitsigns-nvim; + plugin = pkgs.vimPlugins.gitsigns-nvim; event = [ "BufReadPost" "BufNewFile" ]; conf = readFile ./lua/gitsigns-nvim.lua; - dependencies = [{ plugin = which-key-nvim; }]; + dependencies = [{ plugin = pkgs.vimPlugins.which-key-nvim; }]; } { - plugin = pkgs.vimUtils.buildVimPlugin { + plugin = pkgs.vimPlugins.pkgs.vimUtils.buildVimPlugin { pname = "hawtkeys-nvim"; version = lib.my.mkVersionInput inputs.hawtkeys-nvim; src = inputs.hawtkeys-nvim; @@ -38,8 +40,8 @@ with builtins; cmd = [ "Hawtkeys" "HawtkeysAll" "HawtkeysDupes" ]; opts = { }; dependencies = [ - { plugin = plenary-nvim; } - { plugin = nvim-treesitter; } + { plugin = pkgs.vimPlugins.plenary-nvim; } + { plugin = pkgs.vimPlugins.nvim-treesitter; } ]; } ]; From 667b7a9db30df1b60d79648ad8021acf97dde2b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 18 Aug 2024 12:28:52 +0200 Subject: [PATCH 2/9] feat: add elixir stuff --- modules/programs/nvim/plugins/lua/conform.lua | 1 + .../nvim/plugins/lua/nvim-lspconfig.lua | 4 + .../programs/nvim/plugins/snippets/elixir.lua | 46 ++++++ .../programs/nvim/plugins/snippets/heex.lua | 138 ++++++++++++++++++ 4 files changed, 189 insertions(+) create mode 100644 modules/programs/nvim/plugins/snippets/elixir.lua create mode 100644 modules/programs/nvim/plugins/snippets/heex.lua diff --git a/modules/programs/nvim/plugins/lua/conform.lua b/modules/programs/nvim/plugins/lua/conform.lua index e6a1a62..7dc5244 100644 --- a/modules/programs/nvim/plugins/lua/conform.lua +++ b/modules/programs/nvim/plugins/lua/conform.lua @@ -2,6 +2,7 @@ local conform = require("conform") local formatters_by_ft = { ["*"] = { "codespell", "trim_whitespace" }, + elixir = { "mix" }, gleam = { "gleam" }, go = { "gofmt" }, json = { "jq" }, diff --git a/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua b/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua index 898b190..574a699 100644 --- a/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua +++ b/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua @@ -133,6 +133,10 @@ for _, lsp in ipairs(servers) do lspconfig_setup(lsp, {}) end +lspconfig_setup("elixirls", { + cmd = { "elixir-ls" }, +}) + lspconfig_setup("nixd", { settings = { nixd = { diff --git a/modules/programs/nvim/plugins/snippets/elixir.lua b/modules/programs/nvim/plugins/snippets/elixir.lua new file mode 100644 index 0000000..e393f11 --- /dev/null +++ b/modules/programs/nvim/plugins/snippets/elixir.lua @@ -0,0 +1,46 @@ +local ls = require("luasnip") +local s = ls.snippet +local sn = ls.snippet_node +local isn = ls.indent_snippet_node +local t = ls.text_node +local i = ls.insert_node +local f = ls.function_node +local c = ls.choice_node +local d = ls.dynamic_node +local r = ls.restore_node +local events = require("luasnip.util.events") +local ai = require("luasnip.nodes.absolute_indexer") +local extras = require("luasnip.extras") +local l = extras.lambda +local rep = extras.rep +local p = extras.partial +local m = extras.match +local n = extras.nonempty +local dl = extras.dynamic_lambda +local fmt = require("luasnip.extras.fmt").fmt +local fmta = require("luasnip.extras.fmt").fmta +local conds = require("luasnip.extras.expand_conditions") +local postfix = require("luasnip.extras.postfix").postfix +local types = require("luasnip.util.types") +local parse = require("luasnip.util.parser").parse_snippet +local ms = ls.multi_snippet +local k = require("luasnip.nodes.key_indexer").new_key + +local def_template = [[ +def {fname}({args}) do + {final} +end +]] + +local def = s( + "def", + fmt(def_template, { + fname = i(1, "fname"), + args = i(2), + final = i(3), + }, { priority = 1001 }) +) + +return { + def, +} diff --git a/modules/programs/nvim/plugins/snippets/heex.lua b/modules/programs/nvim/plugins/snippets/heex.lua new file mode 100644 index 0000000..3a8a50d --- /dev/null +++ b/modules/programs/nvim/plugins/snippets/heex.lua @@ -0,0 +1,138 @@ +local ls = require("luasnip") +local s = ls.snippet +local sn = ls.snippet_node +local isn = ls.indent_snippet_node +local t = ls.text_node +local i = ls.insert_node +local f = ls.function_node +local c = ls.choice_node +local d = ls.dynamic_node +local r = ls.restore_node +local events = require("luasnip.util.events") +local ai = require("luasnip.nodes.absolute_indexer") +local extras = require("luasnip.extras") +local l = extras.lambda +local rep = extras.rep +local p = extras.partial +local m = extras.match +local n = extras.nonempty +local dl = extras.dynamic_lambda +local fmt = require("luasnip.extras.fmt").fmt +local fmta = require("luasnip.extras.fmt").fmta +local conds = require("luasnip.extras.expand_conditions") +local postfix = require("luasnip.extras.postfix").postfix +local types = require("luasnip.util.types") +local parse = require("luasnip.util.parser").parse_snippet +local ms = ls.multi_snippet +local k = require("luasnip.nodes.key_indexer").new_key + +local pe = s( + "pe", + fmt("<%= {final} %>", { + final = i(1), + }, { priority = 1001 }) +) + +local ln = s( + "ln", + fmt( + [[ +<.link navigate={{~p"{path}"}}">{final} +]], + { path = i(1, "/"), final = i(2) }, + { priority = 1001 } + ) +) + +local lp = s( + "lp", + fmt( + [[ +<.link patch={{~p"{path}"}}">{final} +]], + { path = i(1, "/"), final = i(2) }, + { priority = 1001 } + ) +) + +local if_ = s( + "if", + fmt("<%= if {condition} do %>{final}<% end %>", { condition = i(1, "condition"), final = i(2) }, { priority = 1001 }) +) + +local ife = s( + "ife", + fmt( + [[ +<%= if {condition} do %> + {when} +<% else %> + {final} +<% end %>" + ]], + { condition = i(1, "condition"), when = i(2), final = i(3) }, + { priority = 1001 } + ) +) + +local for_ = s( + "for", + fmt( + [[ +<%= for {item} <- {list} do %> + {final} +<% end %> + ]], + { item = i(1, "item"), list = i(2, "items"), final = i(3) }, + { priority = 1001 } + ) +) + +local lc = + s("lc", fmt("<.live_component module={{{module}}} id={{{id}}} />", { module = i(1), id = i(2) }, { priority = 1001 })) + +local slot = s( + "slot", + fmt("<:slot>{final}", { + final = i(1), + }, { priority = 1001 }) +) + +local socketp = s( + "socketp", + fmt( + [[ +socket = + socket + |> {final} +]], + { final = i(1) }, + { priority = 1001 } + ) +) + +local fl = s( + "fl", + fmt( + [[ +<{elem} :for={{{item} <- {list}}} class="{class}"> + {final} + +]], + { elem = i(1, "div"), item = i(2, "item"), list = i(3, "items"), class = i(4), final = i(5) }, + { priority = 1001, repeat_duplicates = true } + ) +) + +return { + pe, + ln, + lp, + if_, + ife, + for_, + lc, + slot, + socketp, + fl, +} From 9e2c4205d9f52e83d3651c8b51e58862a0d230a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 18 Aug 2024 12:31:09 +0200 Subject: [PATCH 3/9] feat: improve snippet completion --- modules/programs/nvim/plugins/lua/nvim-cmp.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/programs/nvim/plugins/lua/nvim-cmp.lua b/modules/programs/nvim/plugins/lua/nvim-cmp.lua index 69cf040..544381b 100644 --- a/modules/programs/nvim/plugins/lua/nvim-cmp.lua +++ b/modules/programs/nvim/plugins/lua/nvim-cmp.lua @@ -13,9 +13,6 @@ cmp.setup({ }, }), }, - enabled = function() - return not luasnip.jumpable(1) - end, snippet = { -- REQUIRED - you must specify a snippet engine expand = function(args) @@ -49,6 +46,8 @@ cmp.setup({ [""] = cmp.mapping(function(fallback) if luasnip.choice_active() then luasnip.change_choice(1) + elseif luasnip.locally_jumpable(1) then + luasnip.jump(1) else fallback() end @@ -56,6 +55,8 @@ cmp.setup({ [""] = cmp.mapping(function(fallback) if luasnip.choice_active() then luasnip.change_choice(-1) + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) else fallback() end From 6bcccc1ff9a611578da0df182ab06ba45d23a4e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 18 Aug 2024 13:03:18 +0200 Subject: [PATCH 4/9] chore: update inputs --- flake.lock | 422 +++++++++--------- modules/programs/nvim/default.nix | 1 - .../nvim/plugins/lua/gitsigns-nvim.lua | 24 +- .../nvim/plugins/lua/nvim-lspconfig.lua | 136 +++--- .../nvim/plugins/lua/which-key-nvim.lua | 74 ++- modules/programs/nvim/plugins/treesitter.nix | 17 +- modules/programs/nvim/plugins/ui.nix | 2 +- 7 files changed, 334 insertions(+), 342 deletions(-) diff --git a/flake.lock b/flake.lock index 8783f04..c65f9c3 100644 --- a/flake.lock +++ b/flake.lock @@ -26,11 +26,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1718371084, - "narHash": "sha256-abpBi61mg0g+lFFU0zY4C6oP6fBwPzbHPKBGw676xsA=", + "lastModified": 1723293904, + "narHash": "sha256-b+uqzj+Wa6xgMS9aNbX4I+sXeb5biPDi39VgvSFqFvU=", "owner": "ryantm", "repo": "agenix", - "rev": "3a56735779db467538fb2e577eda28a9daacaca6", + "rev": "f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41", "type": "github" }, "original": { @@ -39,14 +39,47 @@ "type": "github" } }, + "aquamarine": { + "inputs": { + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "hyprwayland-scanner": [ + "hyprland", + "hyprwayland-scanner" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1723920171, + "narHash": "sha256-dVCMrAe+D/5S91erhwQj2DSzHOVzAanWqoy+vPWB9DY=", + "owner": "hyprwm", + "repo": "aquamarine", + "rev": "71d49670fe246cdaff4860b0effba0ab9f163b72", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "aquamarine", + "type": "github" + } + }, "arkenfox-userjs": { "flake": false, "locked": { - "lastModified": 1719071094, - "narHash": "sha256-8mzY85wkUokd1Oau9D95Gp1myCJdGU0Dd47bmCygxnE=", + "lastModified": 1722919020, + "narHash": "sha256-tTKGJXg/yicwpCI9WwFmbKYL6cyQ0OOetbvT9i/psUk=", "owner": "arkenfox", "repo": "user.js", - "rev": "23caf6961483e0e55544cd4f3594734d0aa35cf0", + "rev": "11582f905a21971eb5869b48ef8c3f2d4eac4d89", "type": "github" }, "original": { @@ -75,11 +108,11 @@ "cmp-vimtex": { "flake": false, "locked": { - "lastModified": 1716040164, - "narHash": "sha256-CO70M+l/9c4vqNm0XloOTzGQTmogHbSwvUFKQxYGsuw=", + "lastModified": 1722941837, + "narHash": "sha256-pD2dPdpyn5A/uwonDdAxCX138yBeDqbXDdlG/IKjVTU=", "owner": "micangl", "repo": "cmp-vimtex", - "rev": "a64b1b5eec0460144c91c4f20a45c74b8ded48ae", + "rev": "5283bf9108ef33d41e704027b9ef22437ce7a15b", "type": "github" }, "original": { @@ -112,15 +145,14 @@ }, "devshell": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1717408969, - "narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=", + "lastModified": 1722113426, + "narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=", "owner": "numtide", "repo": "devshell", - "rev": "1ebbe68d57457c8cae98145410b164b5477761f4", + "rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae", "type": "github" }, "original": { @@ -134,11 +166,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1719733833, - "narHash": "sha256-6h2EqZU9bL9rHlXE+2LCBgnDImejzbS+4dYsNDDFlkY=", + "lastModified": 1723685519, + "narHash": "sha256-GkXQIoZmW2zCPp1YFtAYGg/xHNyFH/Mgm79lcs81rq0=", "owner": "nix-community", "repo": "disko", - "rev": "d185770ea261fb5cf81aa5ad1791b93a7834d12c", + "rev": "276a0d055a720691912c6a34abb724e395c8e38a", "type": "github" }, "original": { @@ -182,11 +214,11 @@ "flake-compat_3": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -216,11 +248,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1719745305, - "narHash": "sha256-xwgjVUpqSviudEkpQnioeez1Uo2wzrsMaJKJClh+Bls=", + "lastModified": 1722555600, + "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "c3c5ecc05edc7dafba779c6c1a61cd08ac6583e9", + "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", "type": "github" }, "original": { @@ -237,11 +269,11 @@ ] }, "locked": { - "lastModified": 1717285511, - "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "lastModified": 1722555600, + "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", "type": "github" }, "original": { @@ -279,11 +311,11 @@ ] }, "locked": { - "lastModified": 1712014858, - "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "lastModified": 1719994518, + "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", "type": "github" }, "original": { @@ -296,24 +328,6 @@ "inputs": { "systems": "systems_2" }, - "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { - "inputs": { - "systems": "systems_3" - }, "locked": { "lastModified": 1710146030, "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", @@ -328,29 +342,14 @@ "type": "github" } }, - "flake-utils_3": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "gen-nvim": { "flake": false, "locked": { - "lastModified": 1717706134, - "narHash": "sha256-z03a2au40RIcpDUTRSWlWAbo1E+MgEgVaobFWV8hIaI=", + "lastModified": 1723301200, + "narHash": "sha256-Yp7HrDMOyR929AfM7IjEz4dP3RhIx9kXZ1Z3zRr5yJg=", "owner": "David-Kunz", "repo": "gen.nvim", - "rev": "b1230ce2993b2be38a1e22606750d05a94307380", + "rev": "c9a73d8c0d462333da6d2191806ff98f2884d706", "type": "github" }, "original": { @@ -373,11 +372,42 @@ ] }, "locked": { - "lastModified": 1719259945, - "narHash": "sha256-F1h+XIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4=", + "lastModified": 1723803910, + "narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07", + "rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "git-hooks-nix": { + "inputs": { + "flake-compat": [ + "nix-super" + ], + "gitignore": [ + "nix-super" + ], + "nixpkgs": [ + "nix-super", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nix-super", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1721042469, + "narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "f451c19376071a90d8c58ab1a953c6e9840527fd", "type": "github" }, "original": { @@ -495,11 +525,11 @@ ] }, "locked": { - "lastModified": 1719677234, - "narHash": "sha256-qO9WZsj/0E6zcK4Ht1y/iJ8XfwbBzq7xdqhBh44OP/M=", + "lastModified": 1723399884, + "narHash": "sha256-97wn0ihhGqfMb8WcUgzzkM/TuAxce2Gd20A8oiruju4=", "owner": "nix-community", "repo": "home-manager", - "rev": "36317d4d38887f7629876b0e43c8d9593c5cc48d", + "rev": "086f619dd991a4d355c07837448244029fc2d9ab", "type": "github" }, "original": { @@ -513,11 +543,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1718476555, - "narHash": "sha256-fuWpgh8KasByIJWE+xVd37Al0LV5YAn6s871T50qVY0=", + "lastModified": 1722636442, + "narHash": "sha256-+7IS0n3/F0I5j6ZbrVlLcIIPHY3o+/vLAqg/G48sG+w=", "owner": "hyprwm", "repo": "contrib", - "rev": "29a8374f4b9206d5c4af84aceb7fb5dff441ea60", + "rev": "9d67858b437d4a1299be496d371b66fc0d3e01f6", "type": "github" }, "original": { @@ -542,11 +572,11 @@ ] }, "locked": { - "lastModified": 1718450675, - "narHash": "sha256-jpsns6buS4bK+1sF8sL8AaixAiCRjA+nldTKvcwmvUs=", + "lastModified": 1722623071, + "narHash": "sha256-sLADpVgebpCBFXkA1FlCXtvEPu1tdEsTfqK1hfeHySE=", "owner": "hyprwm", "repo": "hyprcursor", - "rev": "66d5b46ff94efbfa6fa3d1d1b66735f1779c34a6", + "rev": "912d56025f03d41b1ad29510c423757b4379eb1c", "type": "github" }, "original": { @@ -557,20 +587,21 @@ }, "hyprland": { "inputs": { + "aquamarine": "aquamarine", "hyprcursor": "hyprcursor", "hyprlang": "hyprlang", "hyprutils": "hyprutils", "hyprwayland-scanner": "hyprwayland-scanner", "nixpkgs": "nixpkgs_4", - "systems": "systems_4", + "systems": "systems_3", "xdph": "xdph" }, "locked": { - "lastModified": 1719746201, - "narHash": "sha256-8Jp7iSoIupyhD2dLi+obRKyoq6YeKYOXMARm0WSIeO4=", + "lastModified": 1723969407, + "narHash": "sha256-COChiv/1EsfN0aVQcDBPXqNR/T5sUXtalsuO1RGvwcY=", "ref": "refs/heads/main", - "rev": "4d6f96f74f9fa6e7b69790fa569ffe60267f8017", - "revCount": 4899, + "rev": "1006663b6eaa55149e9a21aa8a34e41c85eb08ca", + "revCount": 5103, "submodules": true, "type": "git", "url": "https://github.com/hyprwm/Hyprland" @@ -595,11 +626,11 @@ ] }, "locked": { - "lastModified": 1714869498, - "narHash": "sha256-vbLVOWvQqo4n1yvkg/Q70VTlPbMmTiCQfNTgcWDCfJM=", + "lastModified": 1721326555, + "narHash": "sha256-zCu4R0CSHEactW9JqYki26gy8h9f6rHmSwj4XJmlHgg=", "owner": "hyprwm", "repo": "hyprland-protocols", - "rev": "e06482e0e611130cd1929f75e8c1cf679e57d161", + "rev": "5a11232266bf1a1f5952d5b179c3f4b2facaaa84", "type": "github" }, "original": { @@ -624,11 +655,11 @@ ] }, "locked": { - "lastModified": 1717881852, - "narHash": "sha256-XeeVoKHQgfKuXoP6q90sUqKyl7EYy3ol2dVZGM+Jj94=", + "lastModified": 1721324361, + "narHash": "sha256-BiJKO0IIdnSwHQBSrEJlKlFr753urkLE48wtt0UhNG4=", "owner": "hyprwm", "repo": "hyprlang", - "rev": "ec6938c66253429192274d612912649a0cfe4d28", + "rev": "adbefbf49664a6c2c8bf36b6487fd31e3eb68086", "type": "github" }, "original": { @@ -649,11 +680,11 @@ ] }, "locked": { - "lastModified": 1719316102, - "narHash": "sha256-dmRz128j/lJmMuTYeCYPfSBRHHQO3VeH4PbmoyAhHzw=", + "lastModified": 1722869141, + "narHash": "sha256-0KU4qhyMp441qfwbirNg3+wbm489KnEjXOz2I/RbeFs=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "1f6bbec5954f623ff8d68e567bddcce97cd2f085", + "rev": "0252fd13e78e60fb0da512a212e56007515a49f7", "type": "github" }, "original": { @@ -674,11 +705,11 @@ ] }, "locked": { - "lastModified": 1719067853, - "narHash": "sha256-mAnZG/eQy72Fp1ImGtqCgUrDumnR1rMZv2E/zgP4U74=", + "lastModified": 1721324119, + "narHash": "sha256-SOOqIT27/X792+vsLSeFdrNTF+OSRp5qXv6Te+fb2Qg=", "owner": "hyprwm", "repo": "hyprwayland-scanner", - "rev": "914f083741e694092ee60a39d31f693d0a6dc734", + "rev": "a048a6cb015340bd82f97c1f40a4b595ca85cc30", "type": "github" }, "original": { @@ -705,26 +736,27 @@ "libgit2": { "flake": false, "locked": { - "lastModified": 1697646580, - "narHash": "sha256-oX4Z3S9WtJlwvj0uH9HlYcWv+x1hqp8mhXl7HsLu2f0=", + "lastModified": 1715853528, + "narHash": "sha256-J2rCxTecyLbbDdsyBWn9w7r3pbKRMkI9E7RvRgAqBdY=", "owner": "libgit2", "repo": "libgit2", - "rev": "45fd9ed7ae1a9b74b957ef4f337bc3c8b3df01b5", + "rev": "36f7e21ad757a3dacc58cf7944329da6bc1d6e96", "type": "github" }, "original": { "owner": "libgit2", + "ref": "v1.8.1", "repo": "libgit2", "type": "github" } }, "master": { "locked": { - "lastModified": 1719764577, - "narHash": "sha256-304HNA/XvmyfD7JZfpqF4dEBnbUYci/gMZvDThXmYkE=", + "lastModified": 1723976400, + "narHash": "sha256-WpKvJffFrcvNMGMR3hNtQIRa/CTAvrWYohPMAFElLJE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "19581e2ce8bc43f898ef724f8072ebf62bebb325", + "rev": "7c87c474f1b4f020b1ab9d2b962fde094c2599cf", "type": "github" }, "original": { @@ -782,11 +814,11 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1719764240, - "narHash": "sha256-bsZDPD08s8FKCGyy1OMMuM+cOjO1M8vPREkhgyqkRQM=", + "lastModified": 1723969597, + "narHash": "sha256-nNSmyoR8k2gEw9LZ+nFcBQm+bquflzw2R44BeJ4gmKk=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "643ec69ac0cfcc1cd26523c3816fb111e5bb3a41", + "rev": "ec3ee3674c80882ac54d93b5575426c66e3f430d", "type": "github" }, "original": { @@ -798,11 +830,11 @@ "neovim-src": { "flake": false, "locked": { - "lastModified": 1719700831, - "narHash": "sha256-d89hDFBBtuQ7rwS/Q3lKYyfE0ekVCwubMN9q1qCZ3m0=", + "lastModified": 1723936741, + "narHash": "sha256-x/0wYCshhLSA9zW4fvPK+W6g3gTqE8fMJQZrIucDyXg=", "owner": "neovim", "repo": "neovim", - "rev": "e7020306a19a5211c834966ec067fff3b981bdb9", + "rev": "d1bdeacb00186ba72fa61f3c7f2951fd018ae21d", "type": "github" }, "original": { @@ -818,11 +850,11 @@ ] }, "locked": { - "lastModified": 1719726405, - "narHash": "sha256-DqeKlvYQ5Z1rC02we9ufHr8UTfqBRPhiPrGLqdJ91dQ=", + "lastModified": 1723950649, + "narHash": "sha256-dHMkGjwwCGj0c2MKyCjRXVBXq2Sz3TWbbM23AS7/5Hc=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "838a910df0f7e542de2327036b2867fd68ded3a2", + "rev": "392828aafbed62a6ea6ccab13728df2e67481805", "type": "github" }, "original": { @@ -870,17 +902,18 @@ "inputs": { "flake-compat": "flake-compat_3", "flake-parts": "flake-parts_4", + "git-hooks-nix": "git-hooks-nix", "libgit2": "libgit2", "nixpkgs": "nixpkgs_6", - "nixpkgs-regression": "nixpkgs-regression", - "pre-commit-hooks": "pre-commit-hooks" + "nixpkgs-23-11": "nixpkgs-23-11", + "nixpkgs-regression": "nixpkgs-regression" }, "locked": { - "lastModified": 1713821351, - "narHash": "sha256-JctHGT1oa4pet4PgUKRM7pf0w+qGe0a/ahVij8bee3o=", + "lastModified": 1723852416, + "narHash": "sha256-iEwS5PbPBk433xZ5/Ll5hzOU9K2MAE6iqYh8EYoaIgk=", "owner": "privatevoid-net", "repo": "nix-super", - "rev": "5ecd820c18b1aaa3c8ee257a7a9a2624c4107031", + "rev": "7bf3b90d4d67b18d4cbfe28fd5d786aab17d009b", "type": "github" }, "original": { @@ -891,11 +924,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1704161960, - "narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=", + "lastModified": 1722073938, + "narHash": "sha256-OpX0StkL8vpXyWOGUD6G+MA26wAXK6SpT94kLJXo6B4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "63143ac2c9186be6d9da6035fa22620018c85932", + "rev": "e36e9f57337d0ff0cf77aceb58af4c805472bfae", "type": "github" }, "original": { @@ -905,16 +938,32 @@ "type": "github" } }, + "nixpkgs-23-11": { + "locked": { + "lastModified": 1717159533, + "narHash": "sha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", + "type": "github" + } + }, "nixpkgs-lib": { "locked": { - "lastModified": 1717284937, - "narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=", + "lastModified": 1722555339, + "narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" } }, "nixpkgs-regression": { @@ -935,27 +984,27 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1718811006, - "narHash": "sha256-0Y8IrGhRmBmT7HHXlxxepg2t8j1X90++qRN3lukGaIk=", + "lastModified": 1720386169, + "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "03d771e513ce90147b65fe922d87d3a0356fc125", + "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.11", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { "locked": { - "lastModified": 1719379843, - "narHash": "sha256-u+D+IOAMMl70+CJ9NKB+RMrASjInuIWMHzjLWQjPZ6c=", + "lastModified": 1723603349, + "narHash": "sha256-VMg6N7MryOuvSJ8Sj6YydarnUCkL7cvMdrMcnsJnJCE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b3f3c1b13fb08f3828442ee86630362e81136bbc", + "rev": "daf7bb95821b789db24fc1ac21f613db0c1bf2cb", "type": "github" }, "original": { @@ -983,11 +1032,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1719075281, - "narHash": "sha256-CyyxvOwFf12I91PBWz43iGT1kjsf5oi6ax7CrvaMyAo=", + "lastModified": 1723637854, + "narHash": "sha256-med8+5DSWa2UnOqtdICndjDAEjxr5D7zaIiK4pn0Q7c=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a71e967ef3694799d0c418c98332f7ff4cc5f6af", + "rev": "c3aa7b8938b17aebd2deecf7be0636000d62a2b9", "type": "github" }, "original": { @@ -999,11 +1048,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1719468428, - "narHash": "sha256-vN5xJAZ4UGREEglh3lfbbkIj+MPEYMuqewMn4atZFaQ=", + "lastModified": 1723856861, + "narHash": "sha256-OTDg91+Zzs2SpU3csK4xVdSQFoG8cK1lNUwKmTqERyE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1e3deb3d8a86a870d925760db1a5adecc64d329d", + "rev": "cd7b95ee3725af7113bacbce91dd6549cee58ca5", "type": "github" }, "original": { @@ -1015,27 +1064,27 @@ }, "nixpkgs_6": { "locked": { - "lastModified": 1709083642, - "narHash": "sha256-7kkJQd4rZ+vFrzWu8sTRtta5D1kBG0LSRYAfhtmMlSo=", + "lastModified": 1723688146, + "narHash": "sha256-sqLwJcHYeWLOeP/XoLwAtYjr01TISlkOfz+NG82pbdg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b550fe4b4776908ac2a861124307045f8e717c8e", + "rev": "c3d4ac725177c030b1e289015989da2ad9d56af0", "type": "github" }, "original": { "owner": "NixOS", - "ref": "release-23.11", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_7": { "locked": { - "lastModified": 1719468428, - "narHash": "sha256-vN5xJAZ4UGREEglh3lfbbkIj+MPEYMuqewMn4atZFaQ=", + "lastModified": 1723891200, + "narHash": "sha256-uljX21+D/DZgb9uEFFG2dkkQbPZN+ig4Z6+UCLWFVAk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "1e3deb3d8a86a870d925760db1a5adecc64d329d", + "rev": "a0d6390cb3e82062a35d0288979c45756e481f60", "type": "github" }, "original": { @@ -1095,11 +1144,11 @@ }, "nur": { "locked": { - "lastModified": 1719762299, - "narHash": "sha256-hD+5hNGqPBipDTuZZImSCU36RqacSJadHjQtK/gbaxU=", + "lastModified": 1723976478, + "narHash": "sha256-eF815/buOMQlX2XbtNgN3GtA9bwv4psLbckU9iTBsxs=", "owner": "nix-community", "repo": "NUR", - "rev": "80b917d886c6554264f71e1fc68e6b17cd5fdfa1", + "rev": "575ee4dc4dc7c031663bdcfe2e8779abacc80d0a", "type": "github" }, "original": { @@ -1111,11 +1160,11 @@ "nvim-lspconfig": { "flake": false, "locked": { - "lastModified": 1719643735, - "narHash": "sha256-ZFewYwOXG3RtH8plm8Y870WL+BiqvVuzTgdz5H66d/8=", + "lastModified": 1723788573, + "narHash": "sha256-y64E6q6bB0kzJzxHnOYWjCZW5tpBTzhAVs/lvpmOpU0=", "owner": "neovim", "repo": "nvim-lspconfig", - "rev": "7edfd6692ba17f8d4fe08d84142781898ab0a672", + "rev": "a89de2e049b5f89a0ee55029d5a31213bd4de6f8", "type": "github" }, "original": { @@ -1125,38 +1174,6 @@ } }, "pre-commit-hooks": { - "inputs": { - "flake-compat": [ - "nix-super" - ], - "flake-utils": "flake-utils_3", - "gitignore": [ - "nix-super" - ], - "nixpkgs": [ - "nix-super", - "nixpkgs" - ], - "nixpkgs-stable": [ - "nix-super", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1712897695, - "narHash": "sha256-nMirxrGteNAl9sWiOhoN5tIHyjBbVi5e2tgZUgZlK3Y=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "40e6053ecb65fcbf12863338a6dcefb3f55f1bf8", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, - "pre-commit-hooks_2": { "inputs": { "flake-compat": "flake-compat_4", "gitignore": "gitignore_2", @@ -1164,11 +1181,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1719259945, - "narHash": "sha256-F1h+XIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4=", + "lastModified": 1723803910, + "narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07", + "rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba", "type": "github" }, "original": { @@ -1180,11 +1197,11 @@ "river": { "flake": false, "locked": { - "lastModified": 1719742320, - "narHash": "sha256-KA7bOP66JIbBPBDQiOfNe2M8vgErVMmw/zdr/NHJsZc=", + "lastModified": 1723715391, + "narHash": "sha256-Tc0FYZJsQ/YDFl7czKfsDxTEUr1a0d41MyRrdyhdcjw=", "ref": "refs/heads/master", - "rev": "0997fde28e1aad90a983d28061deed9fdcb972f3", - "revCount": 1278, + "rev": "f82b2f58163eb092941d7d2e05e1d0eeaa9f50fe", + "revCount": 1293, "submodules": true, "type": "git", "url": "https://github.com/riverwm/river" @@ -1205,7 +1222,7 @@ "devshell": "devshell", "disko": "disko", "flake-parts": "flake-parts", - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils", "gen-nvim": "gen-nvim", "hawtkeys-nvim": "hawtkeys-nvim", "home-manager": "home-manager_2", @@ -1223,7 +1240,7 @@ "none-ls-shellcheck-nvim": "none-ls-shellcheck-nvim", "nur": "nur", "nvim-lspconfig": "nvim-lspconfig", - "pre-commit-hooks": "pre-commit-hooks_2", + "pre-commit-hooks": "pre-commit-hooks", "river": "river", "smartcolumn-nvim": "smartcolumn-nvim", "stable": "stable", @@ -1249,11 +1266,11 @@ }, "stable": { "locked": { - "lastModified": 1719426051, - "narHash": "sha256-yJL9VYQhaRM7xs0M867ZFxwaONB9T2Q4LnGo1WovuR4=", + "lastModified": 1723688146, + "narHash": "sha256-sqLwJcHYeWLOeP/XoLwAtYjr01TISlkOfz+NG82pbdg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "89c49874fb15f4124bf71ca5f42a04f2ee5825fd", + "rev": "c3d4ac725177c030b1e289015989da2ad9d56af0", "type": "github" }, "original": { @@ -1294,21 +1311,6 @@ } }, "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_4": { "locked": { "lastModified": 1689347949, "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", @@ -1323,7 +1325,7 @@ "type": "github" } }, - "systems_5": { + "systems_4": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -1376,7 +1378,7 @@ }, "utils": { "inputs": { - "systems": "systems_5" + "systems": "systems_4" }, "locked": { "lastModified": 1692799911, @@ -1409,11 +1411,11 @@ ] }, "locked": { - "lastModified": 1718619174, - "narHash": "sha256-FWW68AVYmB91ZDQnhLMBNCUUTCjb1ZpO2k2KIytHtkA=", + "lastModified": 1722365976, + "narHash": "sha256-Khdm+mDzYA//XaU0M+hftod+rKr5q9SSHSEuiQ0/9ow=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "c7894aa54f9a7dbd16df5cd24d420c8af22d5623", + "rev": "7f2a77ddf60390248e2a3de2261d7102a13e5341", "type": "github" }, "original": { diff --git a/modules/programs/nvim/default.nix b/modules/programs/nvim/default.nix index e407c48..8efae0a 100644 --- a/modules/programs/nvim/default.nix +++ b/modules/programs/nvim/default.nix @@ -42,7 +42,6 @@ in nixpkgs-fmt nodePackages.bash-language-server python3Packages.python-lsp-server - python3Packages.ruff-lsp shellcheck shfmt stable.yamlfix diff --git a/modules/programs/nvim/plugins/lua/gitsigns-nvim.lua b/modules/programs/nvim/plugins/lua/gitsigns-nvim.lua index 1a17a9b..a3473c6 100644 --- a/modules/programs/nvim/plugins/lua/gitsigns-nvim.lua +++ b/modules/programs/nvim/plugins/lua/gitsigns-nvim.lua @@ -1,15 +1,13 @@ require("gitsigns").setup() -require("which-key").register({ - ["[h"] = { "Gitsigns prev_hunk", "Previous hunk" }, - ["]h"] = { "Gitsigns next_hunk", "Next hunk" }, - ["g"] = { - s = { "Gitsigns stage_hunk", "Stage hunk", mode = { "n", "v" } }, - r = { "Gitsigns reset_hunk", "Reset hunk", mode = { "n", "v" } }, - S = { "Gitsigns stage_buffer", "Stage buffer" }, - R = { "Gitsigns reset_buffer", "Reset buffer" }, - u = { "Gitsigns undo_stage_hunk", "Undo stage hunk" }, - p = { "Gitsigns preview_hunk_inline", "Preview hunk (inline)" }, - P = { "Gitsigns preview_hunk", "Preview hunk (float)" }, - }, - ["ih"] = { ":Gitsigns select_hunk", "gitsigns hunk", mode = { "o", "x" } }, +require("which-key").add({ + { "gP", "Gitsigns preview_hunk", desc = "Preview hunk (float)" }, + { "gR", "Gitsigns reset_buffer", desc = "Reset buffer" }, + { "gS", "Gitsigns stage_buffer", desc = "Stage buffer" }, + { "gp", "Gitsigns preview_hunk_inline", desc = "Preview hunk (inline)" }, + { "gu", "Gitsigns undo_stage_hunk", desc = "Undo stage hunk" }, + { "[h", "Gitsigns prev_hunk", desc = "Previous hunk" }, + { "]h", "Gitsigns next_hunk", desc = "Next hunk" }, + { "gr", "Gitsigns reset_hunk", desc = "Reset hunk", mode = { "n", "v" } }, + { "gs", "Gitsigns stage_hunk", desc = "Stage hunk", mode = { "n", "v" } }, + { "ih", ":Gitsigns select_hunk", desc = "gitsigns hunk", mode = { "o", "x" } }, }) diff --git a/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua b/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua index 574a699..3a822ec 100644 --- a/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua +++ b/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua @@ -21,76 +21,80 @@ capabilities.didChangeWatchedFiles = { local lspconfig = require("lspconfig") local on_attach_def = function(client, bufnr) - require("which-key").register({ - K = { - vim.lsp.buf.hover, - "Hover", + require("which-key").add({ + { "c", buffer = bufnr, group = "code" }, + { + "cr", + function() + return ":IncRename " .. vim.fn.expand("") + end, + buffer = bufnr, + desc = "Rename", + expr = true, + replace_keycodes = false, }, - [""] = { - c = { - name = "code", - c = { require("actions-preview").code_actions, "Code action", mode = { "v", "n" } }, - r = { - function() - return ":IncRename " .. vim.fn.expand("") - end, - "Rename", - expr = true, - }, - f = { - function() - vim.lsp.buf.format({ async = true }) - end, - "Format (lsp)", - mode = { "n", "v" }, - }, - }, - t = { - l = { - function() - lsp_lines.toggle() - if vim.diagnostic.is_disabled() then - vim.diagnostic.enable() - else - vim.diagnostic.disable() - end - end, - "LSP lines", - }, - i = { - function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) - end, - "LSP inlay hints", - }, - }, + { + "ti", + function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) + end, + buffer = bufnr, + desc = "LSP inlay hints", }, - g = { - d = { - function() - require("telescope.builtin").lsp_definitions({ reuse_win = true }) - end, - "Goto definition", - }, - t = { - function() - require("telescope.builtin").lsp_type_definitions({ reuse_win = true }) - end, - "Goto type definition", - }, - r = { "Telescope lsp_references", "Goto references" }, - D = { vim.lsp.buf.declaration, "Goto declaration" }, - I = { "Telescope lsp_implementations", "Goto implementation" }, - K = { vim.lsp.buf.signature_help, "Signature help" }, + { + "tl", + function() + lsp_lines.toggle() + if vim.diagnostic.is_disabled() then + vim.diagnostic.enable() + else + vim.diagnostic.disable() + end + end, + buffer = bufnr, + desc = "LSP lines", }, - ["["] = { - d = { vim.diagnostic.goto_prev, "Previous diagnostic" }, + { "K", vim.lsp.buf.hover, buffer = bufnr, desc = "Hover" }, + { "[d", vim.diagnostic.goto_prev, buffer = bufnr, desc = "Previous diagnostic" }, + { "]d", vim.diagnostic.goto_next, buffer = bufnr, desc = "Next diagnostic" }, + { "gD", vim.lsp.buf.declaration, buffer = bufnr, desc = "Goto declaration" }, + { "gI", "Telescope lsp_implementations", buffer = bufnr, desc = "Goto implementation" }, + { "gK", vim.lsp.buf.signature_help, buffer = bufnr, desc = "Signature help" }, + { + "gd", + function() + require("telescope.builtin").lsp_definitions({ reuse_win = true }) + end, + buffer = bufnr, + desc = "Goto definition", }, - ["]"] = { - d = { vim.diagnostic.goto_next, "Next diagnostic" }, - }, - }, { buffer = bufnr, silent = true }) + { "gr", "Telescope lsp_references", buffer = bufnr, desc = "Goto references" }, + { + "gt", + function() + require("telescope.builtin").lsp_type_definitions({ reuse_win = true }) + end, + buffer = bufnr, + desc = "Goto type definition", + }, + { + "cc", + require("actions-preview").code_actions, + buffer = bufnr, + desc = "Code action", + mode = { "n", "v" }, + }, + { + "cf", + function() + vim.lsp.buf.format({ async = true }) + end, + buffer = bufnr, + desc = "Format (lsp)", + mode = { "n", "v" }, + }, + }) if client.server_capabilities.inlayHintProvider then local slow_lsp_servers = { "rust_analyzer", @@ -125,7 +129,7 @@ local servers = { "gopls", "nil_ls", "pylsp", - "ruff_lsp", + "ruff", "templ", "typst_lsp", } diff --git a/modules/programs/nvim/plugins/lua/which-key-nvim.lua b/modules/programs/nvim/plugins/lua/which-key-nvim.lua index a6e6a8b..d49e9f3 100644 --- a/modules/programs/nvim/plugins/lua/which-key-nvim.lua +++ b/modules/programs/nvim/plugins/lua/which-key-nvim.lua @@ -2,60 +2,50 @@ vim.o.timeout = true vim.o.timeoutlen = 500 -- Delete -require("which-key").register({ - d = { - name = "delete", - b = { "bd", "Delete buffer" }, - w = { "c", "Delete window" }, - }, -}, { prefix = "" }) +require("which-key").add({ + { "d", group = "delete" }, + { "db", "bd", desc = "Delete buffer" }, + { "dw", "c", desc = "Delete window" }, +}) -- buffer -require("which-key").register({ - ["["] = { - b = { "bprevious", "Previous buffer" }, - }, - ["]"] = { - b = { "bnext", "Next buffer" }, - }, +require("which-key").add({ + { "[b", "bprevious", desc = "Previous buffer" }, + { "]b", "bnext", desc = "Next buffer" }, }) -- window -require("which-key").register({ - w = { - name = "window", - ["|"] = { "v", "Split window horizontally" }, - ["-"] = { "s", "Split window vertically" }, - w = { "w", "Switch window" }, - }, -}, { prefix = "" }) +require("which-key").add({ + { "w", group = "window" }, + { "w-", "s", desc = "Split window vertically" }, + { "ww", "w", desc = "Switch window" }, + { "w|", "v", desc = "Split window horizontally" }, +}) -- better descriptions for navigation -require("which-key").register({ - [""] = { - f = { name = "file/find" }, - g = { name = "git" }, - c = { name = "code" }, - s = { name = "search" }, - t = { name = "toggle" }, - }, - ["["] = { name = "prev" }, - ["]"] = { name = "next" }, - g = { name = "goto" }, +require("which-key").add({ + { "c", group = "code" }, + { "f", group = "file/find" }, + { "g", group = "git" }, + { "s", group = "search" }, + { "t", group = "toggle" }, + { "[", group = "prev" }, + { "]", group = "next" }, + { "g", group = "goto" }, }) -- Clear search with -require("which-key").register({ - [""] = { "noh", "Escape and clear hlsearch", mode = { "n", "i" } }, +require("which-key").add({ + { "", "noh", desc = "Escape and clear hlsearch", mode = { "i", "n" } }, }) -- better indenting -require("which-key").register({ - ["<"] = { ""] = { ">gv", "Shift right" }, -}, { mode = "v" }) +require("which-key").add({ + { "<", "", ">gv", desc = "Shift right", mode = "v" }, +}) -- better yank in visual mode -require("which-key").register({ - y = { "ygv", "Yank" }, -}, { mode = "v" }) +require("which-key").add({ + { "y", "ygv", desc = "Yank", mode = "v" }, +}) diff --git a/modules/programs/nvim/plugins/treesitter.nix b/modules/programs/nvim/plugins/treesitter.nix index a7d473b..374c460 100644 --- a/modules/programs/nvim/plugins/treesitter.nix +++ b/modules/programs/nvim/plugins/treesitter.nix @@ -1,16 +1,17 @@ -{ pkgs, ... }: +{ pkgs, inputs, lib, ... }: { config.home-manager.users.moritz.programs.neovim.lazy.plugins = [ ( let + nvim-treesitter = pkgs.vimPlugins.nvim-treesitter; parserDir = pkgs.symlinkJoin { name = "tresitter-grammars-all"; - paths = pkgs.vimPlugins.nvim-treesitter.withAllGrammars.dependencies; + paths = nvim-treesitter.withAllGrammars.dependencies; }; in { - plugin = pkgs.vimPlugins.nvim-treesitter; + plugin = nvim-treesitter; event = [ "BufReadPost" "BufNewFile" ]; opts = { sync_install = false; @@ -51,12 +52,10 @@ }; }; conf = - '' - local final_opts = vim.tbl_deep_extend("keep", opts, { parser_install_dir = "${parserDir}" }) - require('nvim-treesitter.configs').setup(final_opts) - ''; - init = '' - vim.opt.runtimepath:prepend("${parserDir}") + /* lua */ '' + vim.opt.runtimepath:append("${parserDir}") + local final_opts = vim.tbl_deep_extend("keep", opts, { parser_install_dir = "${parserDir}" }) + require('nvim-treesitter.configs').setup(final_opts) ''; priority = 100; dependencies = [ diff --git a/modules/programs/nvim/plugins/ui.nix b/modules/programs/nvim/plugins/ui.nix index a8614b6..bdac6dd 100644 --- a/modules/programs/nvim/plugins/ui.nix +++ b/modules/programs/nvim/plugins/ui.nix @@ -32,7 +32,7 @@ in dependencies = [{ plugin = pkgs.vimPlugins.which-key-nvim; }]; } { - plugin = pkgs.vimPlugins.pkgs.vimUtils.buildVimPlugin { + plugin = pkgs.vimUtils.buildVimPlugin { pname = "hawtkeys-nvim"; version = lib.my.mkVersionInput inputs.hawtkeys-nvim; src = inputs.hawtkeys-nvim; From 928f8b77fa3200a6ae4a05411ece5612e9fedab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 18 Aug 2024 13:05:32 +0200 Subject: [PATCH 5/9] feat: use nom for rebuild only --- modules/programs/nix.nix | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/modules/programs/nix.nix b/modules/programs/nix.nix index 9435552..bc4eba8 100644 --- a/modules/programs/nix.nix +++ b/modules/programs/nix.nix @@ -6,26 +6,16 @@ , ... }: -with lib; let + inherit (lib) mkEnableOption mkOption types; + cfg = config.my.programs.nix; - - mkSuper = system: nix: - if cfg.useSuper - then inputs.nix-super.packages.${system}.default - else nix; - mkNom = system: nix: - if cfg.useNom - then - inputs.nix-monitored.packages.${system}.default.override - { - withNotify = false; - nix = nix; - } - else nix; - - mkNix = system: nix: mkNom system (mkSuper system nix); + inputs.nix-monitored.packages.${system}.default.override + { + withNotify = false; + nix = nix; + }; in { options.my.programs.nix = { @@ -38,8 +28,6 @@ in }; }; optimise.enable = mkEnableOption "nix-optimise"; - useSuper = mkEnableOption "use nix super"; - useNom = mkEnableOption "use nix output monitor" // { default = true; }; }; config = { @@ -59,7 +47,7 @@ in nix = { nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; - package = mkNix pkgs.system pkgs.nix; + package = pkgs.nix; extraOptions = "experimental-features = nix-command flakes"; From 82e64e198f4ae4ff13c78074cf80e2e0bda21187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 18 Aug 2024 13:06:12 +0200 Subject: [PATCH 6/9] feat: remove cmp-spell and copilot nvim plugins --- modules/programs/nvim/plugins/coding.nix | 35 +++++++++---------- .../programs/nvim/plugins/lua/nvim-cmp.lua | 4 +-- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/modules/programs/nvim/plugins/coding.nix b/modules/programs/nvim/plugins/coding.nix index 3dd89b3..0772fe2 100644 --- a/modules/programs/nvim/plugins/coding.nix +++ b/modules/programs/nvim/plugins/coding.nix @@ -38,7 +38,6 @@ in { plugin = pkgs.vimPlugins.cmp-cmdline; } { plugin = pkgs.vimPlugins.cmp-nvim-lsp-signature-help; } { plugin = pkgs.vimPlugins.cmp-nvim-lsp; } - { plugin = pkgs.vimPlugins.cmp-spell; } { plugin = pkgs.vimUtils.buildVimPlugin { pname = "cmp-vimtex"; @@ -47,23 +46,23 @@ in }; } { plugin = pkgs.vimPlugins.cmp_luasnip; } - { - plugin = pkgs.vimPlugins.copilot-cmp; - opts = { }; - dependencies = [ - { - plugin = pkgs.vimPlugins.copilot-lua; - opts = { - suggestion = { enabled = false; }; - panel = { enabled = false; }; - }; - conf = /* lua */ '' - require("copilot").setup(opts) - vim.cmd("Copilot disable") - ''; - } - ]; - } + # { + # plugin = pkgs.vimPlugins.copilot-cmp; + # opts = { }; + # dependencies = [ + # { + # plugin = pkgs.vimPlugins.copilot-lua; + # opts = { + # suggestion = { enabled = false; }; + # panel = { enabled = false; }; + # }; + # conf = /* lua */ '' + # require("copilot").setup(opts) + # vim.cmd("Copilot disable") + # ''; + # } + # ]; + # } { plugin = pkgs.vimPlugins.friendly-snippets; } { plugin = pkgs.vimPlugins.lspkind-nvim; } { diff --git a/modules/programs/nvim/plugins/lua/nvim-cmp.lua b/modules/programs/nvim/plugins/lua/nvim-cmp.lua index 544381b..ee505ec 100644 --- a/modules/programs/nvim/plugins/lua/nvim-cmp.lua +++ b/modules/programs/nvim/plugins/lua/nvim-cmp.lua @@ -9,7 +9,7 @@ cmp.setup({ maxwidth = 50, -- prevent the popup from showing more than provided characters ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead symbol_map = { - Copilot = "", + -- Copilot = "", }, }), }, @@ -67,7 +67,7 @@ cmp.setup({ { priority = 1, name = "buffer" }, { priority = 1, name = "spell" }, { priority = 2, name = "nvim_lsp" }, - { priority = 3, name = "copilot" }, + -- { priority = 3, name = "copilot" }, { priority = 3, name = "nvim_lsp_signature_help" }, { priority = 4, name = "luasnip" }, { priority = 4, name = "vimtex" }, From f19d50407e344f00f071b477a5f132ea8b930fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 18 Aug 2024 13:20:03 +0200 Subject: [PATCH 7/9] feat: configure desktop monitors --- hosts/nixos-desktop/default.nix | 1 + modules/programs/hyprland/default.nix | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/hosts/nixos-desktop/default.nix b/hosts/nixos-desktop/default.nix index 98ab4c9..bed3eca 100644 --- a/hosts/nixos-desktop/default.nix +++ b/hosts/nixos-desktop/default.nix @@ -24,6 +24,7 @@ programs.hyprland.enable = true; programs.hyprland.nvidiaSupport = true; programs.hyprland.keyboardLayouts = [ "us" "de" ]; + programs.hyprland.monitors."HDMI-A-2" = { scale = 1.2; }; programs.exercism.enable = true; services.wallpaper.enable = true; }; diff --git a/modules/programs/hyprland/default.nix b/modules/programs/hyprland/default.nix index 76caa5c..a8c75da 100644 --- a/modules/programs/hyprland/default.nix +++ b/modules/programs/hyprland/default.nix @@ -60,9 +60,6 @@ in sub ); description = "monitor setting"; - default = { - "" = { }; - }; }; extraConfig = mkOption { type = types.str; @@ -81,6 +78,7 @@ in kitty.enable = true; rofi.enable = true; hyprland.monitors."" = lib.mkDefault { }; + hyprland.monitors."Unknown-1" = { disabled = true; }; }; wallpapers.enable = true; services = { From fc4dcbeeec1d95ec2b30dc77c46d380d92f0fea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 18 Aug 2024 13:48:41 +0200 Subject: [PATCH 8/9] fix: issues from input bump --- modules/programs/hyprland/_config.nix | 2 +- modules/programs/hyprland/default.nix | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/programs/hyprland/_config.nix b/modules/programs/hyprland/_config.nix index 18a6c5b..c9bcd75 100644 --- a/modules/programs/hyprland/_config.nix +++ b/modules/programs/hyprland/_config.nix @@ -139,7 +139,7 @@ in windowrulev2 = opaque, class:^(emacs)$ # Fullscreen Applications - ${mkRules ["opaque" "noblur" "noborder" "noshadow" "forceinput"] ["fullscreen:1"]} + ${mkRules ["opaque" "noblur" "noborder" "noshadow" "allowsinput"] ["fullscreen:1"]} ${mkRules ["tile" "opaque"] ["class:^(neovide)$"]} diff --git a/modules/programs/hyprland/default.nix b/modules/programs/hyprland/default.nix index a8c75da..b436b58 100644 --- a/modules/programs/hyprland/default.nix +++ b/modules/programs/hyprland/default.nix @@ -113,6 +113,15 @@ in # add waybar as a status bar programs.waybar = { enable = true; + package = pkgs.waybar.overrideAttrs (old: { + patches = old.patches or [ ] ++ [ + (pkgs.fetchpatch { + url = "https://gitlab.archlinux.org/archlinux/packaging/packages/waybar/-/raw/0306af03fcb6de6aee1e288f42b0bf1b223513bd/a544f4b2cdcf632f1a4424b89f6e3d85ef5aaa85.patch"; + sha256 = "sha256-S/1oUj9Aj6BElNTsDY8CTcKtS1j7Gl54JFgCywH05pg="; + }) + ]; + + }); # start using systemd service systemd = { @@ -125,7 +134,7 @@ in start_hidden = true; layer = "top"; position = "top"; - height = 20; + height = 24; modules-left = [ "hyprland/workspaces" ]; modules-center = [ "hyprland/window" ]; modules-right = [ "hyprland/language" "network" "memory" "cpu" "battery" "clock" ]; From f08c343ddf39de25df29a66b917080815ffce4e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 18 Aug 2024 15:17:43 +0200 Subject: [PATCH 9/9] feat: make luasnip handle injected languages --- modules/programs/nvim/plugins/lua/luasnip.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/programs/nvim/plugins/lua/luasnip.lua b/modules/programs/nvim/plugins/lua/luasnip.lua index c391b09..149ff76 100644 --- a/modules/programs/nvim/plugins/lua/luasnip.lua +++ b/modules/programs/nvim/plugins/lua/luasnip.lua @@ -19,6 +19,7 @@ ls.setup({ }, }, }, + ft_func = require("luasnip.extras.filetype_functions").from_pos_or_filetype, }) require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" })