diff --git a/nix/home-manager/flake.lock b/nix/home-manager/flake.lock index fc53d7b..8ba49f4 100644 --- a/nix/home-manager/flake.lock +++ b/nix/home-manager/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "awesome-neovim-plugins": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1722878812, + "narHash": "sha256-dJ6WcOz4mg9jzuJnUdcRr1pUY4Bo0fuu5Bc13thUS5A=", + "owner": "m15a", + "repo": "flake-awesome-neovim-plugins", + "rev": "1406e96871c7ac4c3bb663ad6ede12d3986101e8", + "type": "github" + }, + "original": { + "owner": "m15a", + "repo": "flake-awesome-neovim-plugins", + "type": "github" + } + }, "crane": { "inputs": { "nixpkgs": [ @@ -21,6 +41,27 @@ "type": "github" } }, + "devshell": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722113426, + "narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=", + "owner": "numtide", + "repo": "devshell", + "rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, "fenix": { "inputs": { "nixpkgs": [ @@ -42,6 +83,57 @@ "type": "github" } }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722555600, + "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -60,22 +152,91 @@ "type": "github" } }, - "haumea": { + "flake-utils_2": { "inputs": { - "nixpkgs": "nixpkgs" + "systems": "systems_2" }, "locked": { - "lastModified": 1685133229, - "narHash": "sha256-FePm/Gi9PBSNwiDFq3N+DWdfxFq0UKsVVTJS3cQPn94=", - "owner": "nix-community", - "repo": "haumea", - "rev": "34dd58385092a23018748b50f9b23de6266dffc2", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { - "owner": "nix-community", - "ref": "v0.2.2", - "repo": "haumea", + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "nixvim", + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1721042469, + "narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "f451c19376071a90d8c58ab1a953c6e9840527fd", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixvim", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", "type": "github" } }, @@ -99,40 +260,24 @@ "type": "github" } }, - "nix-flake-tests": { - "locked": { - "lastModified": 1677844186, - "narHash": "sha256-ErJZ/Gs1rxh561CJeWP5bohA2IcTq1rDneu1WT6CVII=", - "owner": "antifuchs", - "repo": "nix-flake-tests", - "rev": "bbd9216bd0f6495bb961a8eb8392b7ef55c67afb", - "type": "github" - }, - "original": { - "owner": "antifuchs", - "repo": "nix-flake-tests", - "type": "github" - } - }, - "nix-github-actions": { + "nix-darwin": { "inputs": { "nixpkgs": [ - "nixneovimplugins", - "poetry2nix", + "nixvim", "nixpkgs" ] }, "locked": { - "lastModified": 1688870561, - "narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=", - "owner": "nix-community", - "repo": "nix-github-actions", - "rev": "165b1650b753316aa7f1787f3005a8d2da0f5301", + "lastModified": 1722609272, + "narHash": "sha256-Kkb+ULEHVmk07AX+OhwyofFxBDpw+2WvsXguUS2m6e4=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "f7142b8024d6b70c66fd646e1d099d3aa5bfec49", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "nix-github-actions", + "owner": "lnl7", + "repo": "nix-darwin", "type": "github" } }, @@ -156,86 +301,29 @@ "type": "github" } }, - "nixneovim": { - "inputs": { - "flake-utils": [ - "flake-utils" - ], - "haumea": "haumea", - "home-manager": [ - "home-manager" - ], - "nix-flake-tests": "nix-flake-tests", - "nixneovimplugins": [ - "nixneovimplugins" - ], - "nixpkgs": [ - "nixpkgs" - ], - "nmd": "nmd", - "nmt": "nmt" - }, - "locked": { - "lastModified": 1718612773, - "narHash": "sha256-Uzw1jJhriSwctKZvEc9vwUfKHSvnX7YGKJxYv8JPG14=", - "owner": "nixneovim", - "repo": "nixneovim", - "rev": "2ae81f2ed61ebf4ca4d4b36ea9e8eb5163380d44", - "type": "github" - }, - "original": { - "owner": "nixneovim", - "repo": "nixneovim", - "rev": "2ae81f2ed61ebf4ca4d4b36ea9e8eb5163380d44", - "type": "github" - } - }, - "nixneovimplugins": { - "inputs": { - "flake-utils": [ - "flake-utils" - ], - "nixpkgs": [ - "nixpkgs" - ], - "poetry2nix": "poetry2nix" - }, - "locked": { - "lastModified": 1722781338, - "narHash": "sha256-uVK3J4g1JfQvDG9O0p7hGmfBNLBlD1arrK0KLGHYZTg=", - "owner": "NixNeovim", - "repo": "NixNeovimPlugins", - "rev": "303f0ea30708f3bc647e1ebe7a398aceaf31c33d", - "type": "github" - }, - "original": { - "owner": "NixNeovim", - "repo": "NixNeovimPlugins", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1681001314, - "narHash": "sha256-5sDnCLdrKZqxLPK4KA8+f4A3YKO/u6ElpMILvX0g72c=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "367c0e1086a4eb4502b24d872cea2c7acdd557f4", + "lastModified": 1722415718, + "narHash": "sha256-5US0/pgxbMksF92k1+eOa8arJTJiPvsdZj9Dl+vJkM4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c3392ad349a5227f4a3464dce87bcc5046692fce", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { "locked": { - "lastModified": 1722862185, - "narHash": "sha256-bDt4jvQK9pgKzkL/EJ+fAb6dW+QM1O4RHgjgqZCeYx8=", + "lastModified": 1722882581, + "narHash": "sha256-4Bc5mKOYXAhosswBQzsjm5YKp4MKT738sr4ge0id8cg=", "owner": "nixOS", "repo": "nixpkgs", - "rev": "dd34fb5e692a611eee3f984da0d3271f261109b8", + "rev": "76218e9e60cfbd221f91e41784ecb861be1f7013", "type": "github" }, "original": { @@ -244,74 +332,67 @@ "type": "github" } }, - "nmd": { - "flake": false, - "locked": { - "lastModified": 1672949361, - "narHash": "sha256-WWg1kbilAb3sA+RoJtSYfAZvyYu1Nk79ocHaerwbQxQ=", - "owner": "~rycee", - "repo": "nmd", - "rev": "fb9cf8e991487c6923f3c654b8ae51b6f0f205ce", - "type": "sourcehut" - }, - "original": { - "owner": "~rycee", - "repo": "nmd", - "rev": "fb9cf8e991487c6923f3c654b8ae51b6f0f205ce", - "type": "sourcehut" - } - }, - "nmt": { - "flake": false, - "locked": { - "lastModified": 1709382952, - "narHash": "sha256-n/BvuWVcQxaXCU30feNRqWWqabhIIO2+tRFnhLIhjiQ=", - "owner": "jooooscha", - "repo": "nmt", - "rev": "86a09994d1007c39a1f4d386e3caea9b4681d9d6", - "type": "github" - }, - "original": { - "owner": "jooooscha", - "repo": "nmt", - "type": "github" - } - }, - "poetry2nix": { + "nixvim": { "inputs": { - "flake-utils": [ - "nixneovimplugins", - "flake-utils" + "devshell": "devshell", + "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts", + "git-hooks": "git-hooks", + "home-manager": [ + "home-manager" ], - "nix-github-actions": "nix-github-actions", + "nix-darwin": "nix-darwin", "nixpkgs": [ - "nixneovimplugins", + "nixpkgs" + ], + "nuschtosSearch": "nuschtosSearch", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1722857280, + "narHash": "sha256-b5Bal3cElLrS9UtDN81ljQpOsbqBe/7CdWlTKhlswus=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "5922a48008e5759acb63a12b2de8348ec512760f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "nuschtosSearch": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "nixvim", "nixpkgs" ] }, "locked": { - "lastModified": 1689849924, - "narHash": "sha256-d259Z2S7CS7Na04qQNQ6LYQILuI7cf4Rpe76qc4mz40=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "1d7eda9336f336392d24e9602be5cb9be7ae405c", + "lastModified": 1722493084, + "narHash": "sha256-ktjl908zZKWcGdMyz6kX1kHSg7LFFGPYBvTi9FgQleM=", + "owner": "NuschtOS", + "repo": "search", + "rev": "3f5abffa5f28b4ac3c9212c81c5e8d2d22876071", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "poetry2nix", + "owner": "NuschtOS", + "repo": "search", "type": "github" } }, "root": { "inputs": { + "awesome-neovim-plugins": "awesome-neovim-plugins", "fenix": "fenix", - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "home-manager": "home-manager", "nix-index-database": "nix-index-database", - "nixneovim": "nixneovim", - "nixneovimplugins": "nixneovimplugins", "nixpkgs": "nixpkgs_2", + "nixvim": "nixvim", "zjstatus": "zjstatus" } }, @@ -368,6 +449,57 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "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" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722330636, + "narHash": "sha256-uru7JzOa33YlSRwf9sfXpJG+UAV+bnBEYMjrzKrQZFw=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "768acdb06968e53aa1ee8de207fd955335c754b7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "zjstatus": { "inputs": { "crane": "crane", diff --git a/nix/home-manager/flake.nix b/nix/home-manager/flake.nix index e2428b2..972cb5d 100644 --- a/nix/home-manager/flake.nix +++ b/nix/home-manager/flake.nix @@ -18,21 +18,37 @@ url = "github:Mic92/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs"; }; - nixneovim = { - url = "github:nixneovim/nixneovim/2ae81f2ed61ebf4ca4d4b36ea9e8eb5163380d44"; + # nixneovim = { + # url = "github:nixneovim/nixneovim/2ae81f2ed61ebf4ca4d4b36ea9e8eb5163380d44"; + # inputs = { + # nixpkgs.follows = "nixpkgs"; + # home-manager.follows = "home-manager"; + # flake-utils.follows = "flake-utils"; + # nixneovimplugins.follows = "nixneovimplugins"; + # }; + # }; + # nixneovimplugins = { + # url = "github:NixNeovim/NixNeovimPlugins"; + # inputs = { + # nixpkgs.follows = "nixpkgs"; + # flake-utils.follows = "flake-utils"; + # }; + # }; + nixvim = { + url = "github:nix-community/nixvim"; inputs = { nixpkgs.follows = "nixpkgs"; home-manager.follows = "home-manager"; flake-utils.follows = "flake-utils"; - nixneovimplugins.follows = "nixneovimplugins"; }; }; - nixneovimplugins = { - url = "github:NixNeovim/NixNeovimPlugins"; - inputs = { - nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "flake-utils"; - }; + awesome-neovim-plugins = { + url = "github:m15a/flake-awesome-neovim-plugins"; + # inputs = { + # nixpkgs.follows = "nixpkgs"; + # home-manager.follows = "home-manager"; + # flake-utils.follows = "flake-utils"; + # }; }; zjstatus = { url = "github:dj95/zjstatus"; @@ -54,8 +70,8 @@ nixpkgs, home-manager, nix-index-database, - nixneovim, - nixneovimplugins, + nixvim, + awesome-neovim-plugins, zjstatus, fenix, ... @@ -72,8 +88,8 @@ (_final: prev: { zjstatus = zjstatus.packages.${prev.system}.default; }) - nixneovimplugins.overlays.default fenix.overlays.default + awesome-neovim-plugins.overlays.default ]; } ); @@ -84,7 +100,7 @@ modules = [ { imports = [ - nixneovim.nixosModules.${system}.homeManager + nixvim.homeManagerModules.nixvim ]; } nix-index-database.hmModules.nix-index diff --git a/nix/home-manager/modules/packages/neovim.nix b/nix/home-manager/modules/packages/neovim.nix index 110a49f..c0c53ef 100644 --- a/nix/home-manager/modules/packages/neovim.nix +++ b/nix/home-manager/modules/packages/neovim.nix @@ -1,12 +1,11 @@ {pkgs, ...}: { - programs.nixneovim = { + programs.nixvim = { enable = true; defaultEditor = true; viAlias = true; vimAlias = true; - extraLuaPreConfig = builtins.readFile ./neovim/pre.lua; - extraConfigLua = builtins.readFile ./neovim/core.lua; - colorscheme = "onedark"; + extraConfigLuaPre = builtins.readFile ./neovim/pre.lua; + extraConfigLuaPost = builtins.readFile ./neovim/core.lua; colorschemes = { onedark.enable = true; }; @@ -29,21 +28,40 @@ right = ""; }; sections = { - lualine_a = ["mode" {separator = {left = "";};} {right_padding = 2;}]; + lualine_a = [ + { + name = "mode"; + separator = { + left = ""; + }; + padding = { + right = 2; + left = 0; + }; + } + ]; lualine_b = ["filename" "branch"]; lualine_c = ["%="]; lualine_x = []; lualine_y = ["filetype" "progress"]; - lualine_z = ["location" {separator = {right = "";};} {left_padding = 2;}]; + lualine_z = [ + { + name = "location"; + separator = { + right = ""; + }; + padding = { + right = 0; + left = 2; + }; + } + ]; }; }; - # luasnip = { - # enable = true; - # }; lsp-lines = { enable = true; }; - lspconfig = { + lsp = { enable = true; preConfig = '' ''; @@ -52,225 +70,302 @@ gopls.enable = true; jsonls.enable = true; pyright.enable = true; # In preference to attempting to use pylyzer - nil.enable = true; - rust-analyzer.enable = true; + nil-ls.enable = true; + rust-analyzer.enable = true; #TODO taplo.enable = true; - terraform-ls.enable = true; + terraformls.enable = true; }; }; lspkind = { enable = true; mode = "symbol"; + cmp.enable = true; + symbolMap = { + # TODO + "Text" = ""; + }; }; mini = { enable = true; - ai.enable = true; - align.enable = true; - animate.enable = true; - comment.enable = true; - completion.enable = true; - indentscope.enable = true; - jump.enable = true; - jump2d = { - enable = true; - extraConfig = { + modules = { + ai.enable = true; + align.enable = true; + animate.enable = true; + comment.enable = true; + completion.enable = true; + indentscope.enable = true; + jump.enable = true; + jump2d = { + enable = true; mappings.start_jumping = "a"; }; + splitjoin.enable = true; + surround.enable = true; + tabline.enable = true; }; - splitjoin.enable = true; - surround.enable = true; - tabline.enable = true; }; - nvim-cmp = { + cmp = { enable = true; - formatting = { - format = '' - function(entry, vim_item) - vim_item.kind = string.format("%s %s", kind_icons[vim_item.kind], vim_item.kind) - vim_item.menu = ({ - buffer = "[Buffer]", - nvim_lsp = "[LSP]", - luasnip = "[LuaSnip]", - nvim_lua = "[Lua]", - latex_symbols = "[LaTeX]", - })[entry.source.name] - return vim_item - end - ''; - }; - mappingPresets = ["insert"]; - mapping = { - "" = "cmp.mapping.confirm({ select = true})"; - "" = "cmp.mapping.complete()"; - "" = { - modes = ["i" "s" "c"]; - action = '' - function(fallback) + settings = { + # formatting = { + # format = '' + # function(entry, vim_item) + # vim_item.kind = string.format("%s %s", kind_icons[vim_item.kind], vim_item.kind) + # vim_item.menu = ({ + # buffer = "[Buffer]", + # nvim_lsp = "[LSP]", + # luasnip = "[LuaSnip]", + # nvim_lua = "[Lua]", + # latex_symbols = "[LaTeX]", + # })[entry.source.name] + # return vim_item + # end + # ''; + # }; + mapping = { + "" = "cmp.mapping.confirm({ select = true})"; + "" = "cmp.mapping.complete()"; + "" = '' + cmp.mapping(function(fallback) + if cmp.visible() then local entry = cmp.get_selected_entry() if not entry then - cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) - cmp.confirm() - elseif entry then - cmp.confirm() - elseif luasnip.expandable() then - luasnip.expand() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif check_backspace() then - fallback() - else - fallback() + cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) end - end - ''; - }; - "" = { - modes = ["i" "s" "c"]; - action = '' - function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) + cmp.confirm() else fallback() end - end + end, {"i", "s", "c"}) + ''; + "" = '' + cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, {"i", "s", "c"}) ''; }; - }; - - snippet = { - luasnip.enable = false; - }; - sources = { - cmdline = { - enable = true; + # sources = { + # cmdline = { + # enable = true; + # }; + # emoji.enable = true; + # fuzzy_path.enable = true; + # # luasnip.enable = true; + # nvim_lsp.enable = true; + # nvim_lsp_document_symbol.enable = true; + # nvim_lsp_signature_help.enable = true; + # treesitter.enable = true; + # }; + view = { + entries.name = "custom"; }; - emoji.enable = true; - fuzzy_path.enable = true; - # luasnip.enable = true; - nvim_lsp.enable = true; - nvim_lsp_document_symbol.enable = true; - nvim_lsp_signature_help.enable = true; - treesitter.enable = true; - }; - view = { - entries = "custom"; }; }; project-nvim = { enable = true; + enableTelescope = true; + detectionMethods = ["lsp" "pattern"]; }; telescope = { enable = true; - extraLua = { - post = builtins.readFile ./neovim/telescope.lua; + enabledExtensions = [ + "zf-native" #TODO + "projects" #TODO + "egrepify" #TODO + ]; + # extraLua = { + # post = builtins.readFile ./neovim/telescope.lua; + # }; + keymaps = { + "ff" = { + mode = "n"; + action = "find_files"; + options.desc = "Find Files"; + }; + "fg" = { + mode = "n"; + action = "require(\"telescope\").extensions.egrepify.egrepify"; + options.desc = "Live Grep"; + }; + "fb" = { + mode = "n"; + action = "buffers"; + options.desc = "Find Buffers"; + }; + "r" = { + mode = "n"; + action = "registers"; + options.desc = "View Registers"; + }; + "pr" = { + mode = "n"; + action = "lsp_references"; + options.desc = "(LSP) References"; + }; + "pi" = { + mode = "n"; + action = "lsp_implementations"; + options.desc = "(LSP) Implementations"; + }; + "pd" = { + mode = "n"; + action = "lsp_definitions"; + options.desc = "(LSP) Definitions"; + }; + "ps" = { + mode = "n"; + action = "lsp_document_symbols"; + options.desc = "(LSP) Document Symbols"; + }; + "pws" = { + mode = "n"; + action = "lsp_workspace_symbols"; + options.desc = "(LSP) Workspace Symbols"; + }; + "pwd" = { + mode = "n"; + action = "lsp_dynamic_workspace_symbols"; + options.desc = "(LSP) Dynamic Workspace Symbols"; + }; }; }; treesitter = { enable = true; - indent = true; - folding = true; - incrementalSelection = { - enable = true; + settings = { + indent = { + enable = true; + }; + incremental_selection = { + enable = true; + }; }; + folding = true; }; trouble = { enable = true; }; - ufo = { + ts-context-commentstring = { enable = true; - extraLua.pre = '' - require('ufo').setup({ provider_selector = function(bufnr, filetype, buftype) - return {'treesitter', 'indent' } - end - }) - ''; }; + # ufo = { # TODO + # enable = true; + # extraLua.pre = '' + # require('ufo').setup({ provider_selector = function(bufnr, filetype, buftype) + # return {'treesitter', 'indent' } + # end + # }) + # ''; + # }; undotree = { enable = true; }; + vim-bbye = { + enable = true; + }; which-key = { enable = true; - groups = { - normal = { - "f" = "Telescope - Find"; - "r" = "View registers"; - "p" = "Telescope - LSP"; - }; - }; + settings.spec = [ + { + __unkeyed-1 = "f"; + group = "Telescope - Find"; + } + { + __unkeyed-1 = "p"; + group = "Telescope - LSP"; + } + ]; }; }; extraPlugins = ( with pkgs.vimPlugins; [ - fuzzy-nvim - nvim-ts-context-commentstring + rainbow-delimiters-nvim + telescope-symbols-nvim + overseer-nvim + nvim-web-devicons telescope-zf-native-nvim vim-ReplaceWithRegister - vim-bbye vim-dispatch-neovim vim-expand-region + nvim-ufo ] ) - ++ (with pkgs.vimExtraPlugins; [ - rainbow-delimiters-nvim - gitlinker-linrongbin16 - telescope-symbols-nvim - overseer-nvim + ++ (with pkgs.awesomeNeovimPlugins; [ + linrongbin16-gitlinker-nvim officer-nvim - nvim-web-devicons lsp-signature-nvim - nvim-rg nvim-biscuits telescope-egrepify-nvim ]); - mappings = { - normal = { - "u" = { - action = "vim.cmd.UndotreeToggle"; - desc = "Toggle undotree"; - }; - "h" = { - action = "function() vim.api.nvim_command('wincmd h') end"; - desc = "Cursor - Window left"; - }; - "j" = { - action = "function() vim.api.nvim_command('wincmd j') end"; - desc = "Cursor - Window down"; - }; - "k" = { - action = "function() vim.api.nvim_command('wincmd k') end"; - desc = "Cursor - Window up"; - }; - "l" = { - action = "function() vim.api.nvim_command('wincmd l') end"; - desc = "Cursor - Window right"; - }; - "" = { - action = "''"; - }; - "" = { - action = "''"; - }; - "n" = { - action = "function() vim.api.nvim_command('nohl') end"; - desc = "nohl"; - }; - "t" = { - action = "'Telescope'"; - desc = "Open Telescope"; - }; - }; - visual = { - "" = { - action = "''"; - }; - "" = { - action = "''"; - }; - }; - }; + keymaps = [ + { + action = "vim.cmd.UndotreeToggle"; + key = "u"; + options.desc = "Toggle undotree"; + mode = "n"; + } + { + action = "function() vim.api.nvim_command('wincmd h') end"; + key = "h"; + options.desc = "Cursor - Window left"; + mode = "n"; + } + { + action = "function() vim.api.nvim_command('wincmd j') end"; + key = "j"; + options.desc = "Cursor - Window down"; + mode = "n"; + } + { + action = "function() vim.api.nvim_command('wincmd k') end"; + key = "k"; + options.desc = "Cursor - Window up"; + mode = "n"; + } + { + action = "function() vim.api.nvim_command('wincmd l') end"; + key = "l"; + options.desc = "Cursor - Window right"; + mode = "n"; + } + { + key = ""; + action = "''"; + mode = "n"; + } + { + key = ""; + action = "''"; + mode = "n"; + } + { + key = "n"; + action = "function() vim.api.nvim_command('nohl') end"; + options.desc = "nohl"; + mode = "n"; + } + { + action = "'Telescope'"; + key = "t"; + options.desc = "Open Telescope"; + mode = "n"; + } + { + action = "''"; + key = ""; + mode = "v"; + } + { + key = ""; + action = "''"; + mode = "v"; + } + ]; }; } diff --git a/nix/home-manager/modules/packages/neovim/core.lua b/nix/home-manager/modules/packages/neovim/core.lua index f544636..d05b5b6 100644 --- a/nix/home-manager/modules/packages/neovim/core.lua +++ b/nix/home-manager/modules/packages/neovim/core.lua @@ -68,3 +68,25 @@ cmp.setup.cmdline(":", { }), matching = { disallow_symbol_nonprefix_matching = false }, }) + +do + function setup() + require("ufo").setup({ + provider_selector = function(bufnr, filetype, buftype) + return { "treesitter", "indent" } + end, + }) + + require("ufo").setup({}) + vim.o.foldcolumn = "1" -- '0' is not bad + vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value + vim.o.foldlevelstart = 99 + vim.o.foldenable = true + end + + success, output = pcall(setup) -- execute 'setup()' and catch any errors + if not success then + print("Error on setup for plugin: ufo") + print(output) + end +end diff --git a/nix/home-manager/modules/packages/neovim/pre.lua b/nix/home-manager/modules/packages/neovim/pre.lua index b146f2f..54b65a4 100644 --- a/nix/home-manager/modules/packages/neovim/pre.lua +++ b/nix/home-manager/modules/packages/neovim/pre.lua @@ -1,33 +1,33 @@ vim.g.mapleader = " " vim.g.maplocalleader = "," -local kind_icons = { - Text = "", - Method = "", - Function = "⨐", - Constructor = "", - Field = "", - Variable = "μ", - Class = "", - Interface = "", - Module = "", - Property = "", - Unit = "", - Value = "", - Enum = "", - Keyword = "", - Snippet = "", - Color = "፨", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = "", - Operator = "", - TypeParameter = "", -} +-- local kind_icons = { +-- Text = "", +-- Method = "", +-- Function = "⨐", +-- Constructor = "", +-- Field = "", +-- Variable = "μ", +-- Class = "", +-- Interface = "", +-- Module = "", +-- Property = "", +-- Unit = "", +-- Value = "", +-- Enum = "", +-- Keyword = "", +-- Snippet = "", +-- Color = "፨", +-- File = "", +-- Reference = "", +-- Folder = "", +-- EnumMember = "", +-- Constant = "", +-- Struct = "", +-- Event = "", +-- Operator = "", +-- TypeParameter = "", +-- } local colors = { blue = "#80a0ff", @@ -56,3 +56,25 @@ local bubbles_theme = { c = { fg = colors.white }, }, } + +do + function setup() + require("ufo").setup({ + provider_selector = function(bufnr, filetype, buftype) + return { "treesitter", "indent" } + end, + }) + + require("ufo").setup({}) + vim.o.foldcolumn = "1" -- '0' is not bad + vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value + vim.o.foldlevelstart = 99 + vim.o.foldenable = true + end + + success, output = pcall(setup) -- execute 'setup()' and catch any errors + if not success then + print("Error on setup for plugin: ufo") + print(output) + end +end