From e4b18b3ae394c1b2fb3f7ceca11d71a82e8defea Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sat, 15 Apr 2023 10:46:27 +0300 Subject: [PATCH 01/33] feat: bump flake inputs --- flake.lock | 258 ++++++++++++++++++++++++++++------------------------- 1 file changed, 138 insertions(+), 120 deletions(-) diff --git a/flake.lock b/flake.lock index baa79ca..d354bc4 100644 --- a/flake.lock +++ b/flake.lock @@ -35,11 +35,11 @@ "catppuccin": { "flake": false, "locked": { - "lastModified": 1679888068, - "narHash": "sha256-UrHoESRYwALPo6LFFocEIM0CZa740tjxjvmYES7O5Rw=", + "lastModified": 1681530540, + "narHash": "sha256-RPwRyuGTbVMAApdRsVUyHlcHYWRQ9bHlumJTov81Z0c=", "owner": "catppuccin", "repo": "nvim", - "rev": "73587f9c454da81679202f1668c30fea6cdafd5e", + "rev": "fa9a4465672fa81c06b23634c0f04f6a5d622211", "type": "github" }, "original": { @@ -147,11 +147,11 @@ "cmp-treesitter": { "flake": false, "locked": { - "lastModified": 1679830722, - "narHash": "sha256-t1xEQn6NXcNG215ldm0ivKZdgaoGFwDiZUb8ROBeZHU=", + "lastModified": 1680745848, + "narHash": "sha256-WOcg6w4M20gpMCZjZ3DpPIA55SGLjV75fhckefiVfU0=", "owner": "ray-x", "repo": "cmp-treesitter", - "rev": "c8e3a74b51597d69d240085a258636972ce98e15", + "rev": "389eadd48c27aa6dc0e6b992644704f026802a2e", "type": "github" }, "original": { @@ -179,11 +179,11 @@ "codewindow-nvim": { "flake": false, "locked": { - "lastModified": 1676695329, - "narHash": "sha256-q9mLpMLp3pLn+7D+JSod0ST3ke7EodRh3SoHfPzVic0=", + "lastModified": 1681491118, + "narHash": "sha256-AwGNTrfa/oro22yBKkzJNlVavnboFdEpMM4qXOZhQ/4=", "owner": "gorbit99", "repo": "codewindow.nvim", - "rev": "46b005fc5c40d512a2ec8e55e21b64afa6aaed00", + "rev": "985046dfb2b35cd3b214b70a9a056ec89b0c5498", "type": "github" }, "original": { @@ -195,11 +195,11 @@ "colorizer": { "flake": false, "locked": { - "lastModified": 1680271664, - "narHash": "sha256-UQwIf96eG79iEBDhQvfjByrAc+LXyKiT4EVrPe1+YmY=", + "lastModified": 1681357415, + "narHash": "sha256-nMvzrghsKy2W7OeXYJKclLi3CMvYRprTp1BgEgtK7uY=", "owner": "uga-rosa", "repo": "ccc.nvim", - "rev": "3e07b8ffc9dab162cd2940e75601da75ed0cebbe", + "rev": "82f5113a9b12993deabe610958dcf23933a8f4a7", "type": "github" }, "original": { @@ -211,11 +211,11 @@ "comment-nvim": { "flake": false, "locked": { - "lastModified": 1678452935, - "narHash": "sha256-mVJJJ9fUJYgVyGZnW8e6P5QWB0K8nuhTwSWzlBvxv2M=", + "lastModified": 1681289112, + "narHash": "sha256-Zrxf50YlAaCERZFAbg4Ece+wI4buHl+K2IIw0qpASGA=", "owner": "numToStr", "repo": "Comment.nvim", - "rev": "8d3aa5c22c2d45e788c7a5fe13ad77368b783c20", + "rev": "a89339ffbee677ab0521a483b6dac7e2e67c907e", "type": "github" }, "original": { @@ -227,11 +227,11 @@ "copilot-lua": { "flake": false, "locked": { - "lastModified": 1680027228, - "narHash": "sha256-3u+2azMRm24mp5iOrxwYg9QrM2xJHnSjGsldIDRS6HQ=", + "lastModified": 1681223911, + "narHash": "sha256-ttF9LW6PNKk/BBWET2BUqtq5f7OIZ7ohtQevAaP8srg=", "owner": "zbirenbaum", "repo": "copilot.lua", - "rev": "f0b41fb89ef2ed7ab4e8cd5208a30755aa638fc4", + "rev": "a4a37dda9e48986e5d2a90d6a3cbc88fca241dbb", "type": "github" }, "original": { @@ -243,11 +243,11 @@ "crates-nvim": { "flake": false, "locked": { - "lastModified": 1680384424, - "narHash": "sha256-0fgC3wEMc2fmxHPLHyt0UTdpvuAOkdhdfEDWJ6qA9Q0=", + "lastModified": 1680387248, + "narHash": "sha256-Qt3x9I1RzFtknxy3qJaaZczSLvO10OQ6N1+RLhfuQ7I=", "owner": "Saecki", "repo": "crates.nvim", - "rev": "097da7b79246247b8e660815c12908706031e09a", + "rev": "1d4bb1e7a0fe8bae3f97061be5fbf6f9081a27e2", "type": "github" }, "original": { @@ -259,11 +259,11 @@ "dashboard-nvim": { "flake": false, "locked": { - "lastModified": 1680074354, - "narHash": "sha256-V16XxNlFBGFtKsquqPy44+IFWiBZcs3OY/6SF+7bdrA=", + "lastModified": 1681310977, + "narHash": "sha256-P9JSr5r91joT+dPbjkwLCEN60zt5lDL2bcX7JCRrr+g=", "owner": "glepnir", "repo": "dashboard-nvim", - "rev": "4c2b038c5cfa70f90506f1551e5fd2d040174e08", + "rev": "d5b0fff69546a3d4d742b47ca0452a41323f2f8f", "type": "github" }, "original": { @@ -275,11 +275,11 @@ "diffview-nvim": { "flake": false, "locked": { - "lastModified": 1680290718, - "narHash": "sha256-t4YC8xAjRA+6p7IPM71lL5wWY0pAwTqL7vom3cDSV44=", + "lastModified": 1681231146, + "narHash": "sha256-rtJafQUurQP4sVoKZlC8nrl8OwfY7jKI/RyfNfY8Fik=", "owner": "sindrets", "repo": "diffview.nvim", - "rev": "932d10de327bccdedee439d9d55f4d857caa334e", + "rev": "63720aa5a70ce4aa386be407d0e612cd9e63861a", "type": "github" }, "original": { @@ -308,11 +308,11 @@ "dressing-nvim": { "flake": false, "locked": { - "lastModified": 1677218794, - "narHash": "sha256-89HwP+zxMN5CPPN3dd3yMfCB07mtBhv6lcWuEWnedfw=", + "lastModified": 1681303966, + "narHash": "sha256-8HSxDkHxrjNCT9OpI3Fxt4bwLM49UmdH2TtQWGzyzXo=", "owner": "stevearc", "repo": "dressing.nvim", - "rev": "5f44f829481640be0f96759c965ae22a3bcaf7ce", + "rev": "0e3e1eba147fee6e638ac1ac28f0495bcde17319", "type": "github" }, "original": { @@ -374,11 +374,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1679737941, - "narHash": "sha256-srSD9CwsVPnUMsIZ7Kt/UegkKUEBcTyU1Rev7mO45S0=", + "lastModified": 1680392223, + "narHash": "sha256-n3g7QFr85lDODKt250rkZj2IFS3i4/8HBU2yKHO3tqw=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "3502ee99d6dade045bdeaf7b0cd8ec703484c25c", + "rev": "dcc36e45d054d7bb554c9cdab69093debd91a0b5", "type": "github" }, "original": { @@ -388,12 +388,15 @@ } }, "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -435,11 +438,11 @@ "flutter-tools": { "flake": false, "locked": { - "lastModified": 1680456818, - "narHash": "sha256-VNSrYJZKcQ92+2ko5ZkOOiAM/sXqbJtpkYvxFr1qtWk=", + "lastModified": 1681227071, + "narHash": "sha256-6oMlwOSLXUWX1a0Gu9BL0+AvP7FVKJTr9LNtNKKsjaQ=", "owner": "akinsho", "repo": "flutter-tools.nvim", - "rev": "0a7e6b40aebd874e957ed630420a267e6cac0967", + "rev": "b64892ec95b4454f1080b62fef170338f92fc414", "type": "github" }, "original": { @@ -451,11 +454,11 @@ "gesture-nvim": { "flake": false, "locked": { - "lastModified": 1680321931, - "narHash": "sha256-WXH71e+9MLbylq1StuwWQX61brYtS4Kx10OGWlfi/FY=", + "lastModified": 1680956101, + "narHash": "sha256-oeP8PRBZ8c1iyT1pL95NYgYaWB/6sB0TVxNoS5Jiug4=", "owner": "notomo", "repo": "gesture.nvim", - "rev": "5fa0d76b890717081786c74b4824546052e14671", + "rev": "c302def60859f62deda34b06f00848b49d05b3ac", "type": "github" }, "original": { @@ -467,11 +470,11 @@ "gitsigns-nvim": { "flake": false, "locked": { - "lastModified": 1680209380, - "narHash": "sha256-IoWMURofYoLSy9QVE3m1gAcj2s7iRA30gOts47J3rcU=", + "lastModified": 1680593514, + "narHash": "sha256-nUVVEO06giiJURxT7qNHbX9C1ljZtchUeOdEoCQBk3E=", "owner": "lewis6991", "repo": "gitsigns.nvim", - "rev": "f412f51d0eaf0905a2759c8087090071689bb8fb", + "rev": "372d5cb485f2062ac74abc5b33054abac21d8b58", "type": "github" }, "original": { @@ -563,11 +566,11 @@ "leap-nvim": { "flake": false, "locked": { - "lastModified": 1678823512, - "narHash": "sha256-bzmsib8Qr2Whu1FqHzvrsIfSKf/CFutsaM3Sz8gaTLo=", + "lastModified": 1681071698, + "narHash": "sha256-CDNaQCbEQZQGklIQ8zvX+kL8AgFz4/otuRf9U5qZYP0=", "owner": "ggandor", "repo": "leap.nvim", - "rev": "f74473d23ebf60957e0db3ff8172349a82e5a442", + "rev": "98a72ad93c629c49bd7127d342960cc1b159b620", "type": "github" }, "original": { @@ -579,11 +582,11 @@ "lsp-signature": { "flake": false, "locked": { - "lastModified": 1679524823, - "narHash": "sha256-krQ0ihqbrsG4u8HdYlgaq0fOyIIDX4KDdffMRaJKQ78=", + "lastModified": 1680919643, + "narHash": "sha256-edPNVM4OhN4eBkBbhjkA4kpfxdg8FND23JhGLKjAd6w=", "owner": "ray-x", "repo": "lsp_signature.nvim", - "rev": "1882019270be445a8cad4353f1530574f2b2d02d", + "rev": "775c0cdf5be5adcc08f27c9058edb00b5b517520", "type": "github" }, "original": { @@ -627,11 +630,11 @@ "lualine": { "flake": false, "locked": { - "lastModified": 1680275227, - "narHash": "sha256-bZSt9rBaeO5CjExu9Si3Ch/k0H/mzBE89KeeTCg4AbU=", + "lastModified": 1681033736, + "narHash": "sha256-u79S3wFJ72vcLp7F0f/s21Kvl/pMRI8CkB+8usPQob4=", "owner": "hoob3rt", "repo": "lualine.nvim", - "rev": "9170434aa100f3967b43d5d34bb9adc56fae1986", + "rev": "84ffb80e452d95e2c46fa29a98ea11a240f7843e", "type": "github" }, "original": { @@ -659,11 +662,11 @@ "minimap-vim": { "flake": false, "locked": { - "lastModified": 1680280122, - "narHash": "sha256-xrKkVTVVna9wc38K/CGCnQmWrofUAYJ0f92NR/ycfZ4=", + "lastModified": 1681226039, + "narHash": "sha256-vOFbYUd+manGcJqgk7QuArsDuAukmIS77YCZFtsY98g=", "owner": "wfxr", "repo": "minimap.vim", - "rev": "15dce1b667d4df0eec715798ab94c0850316e8a3", + "rev": "868a809302f9f5d4c408ef8aef7eb9bd5893f801", "type": "github" }, "original": { @@ -719,11 +722,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1680310604, - "narHash": "sha256-2jop/z79HYhmV/hrdGvhjfTMouvzQvNRgFTkPhwWVcg=", + "lastModified": 1681441109, + "narHash": "sha256-18pKVQvULQ8ZGnzoGbfImRO179yShRkRBmV7bK1Hm58=", "owner": "neovim", "repo": "neovim", - "rev": "75e1b1d5c934aa3a12693a7df58795563fb7877e", + "rev": "37bb40701d672d5213ec1be4e21d7808aee968e7", "type": "github" }, "original": { @@ -742,11 +745,11 @@ ] }, "locked": { - "lastModified": 1680336751, - "narHash": "sha256-otSdFRXsNyPYOsbo+49vN4UGwZrVoLDrEp0EkyVJ/rY=", + "lastModified": 1681470660, + "narHash": "sha256-ycmA2VD4YASPCXzC77qMv6eVNznbJN7CVAQlSFUUFPM=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "d56f32281f4d6d74ce925a99946713dc6b5a0e30", + "rev": "b1960aa4e67cf3ea170e243113afe85b1390a9c9", "type": "github" }, "original": { @@ -766,11 +769,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1680185050, - "narHash": "sha256-MtyaP3j1yxwrqPFUsLD0qFyyH7d/h0D/whfErxS2UFM=", + "lastModified": 1681412802, + "narHash": "sha256-IcEala6vFQ7SFNOPCeXBh9Jbl8nL2QOtLmO7RbDsBbo=", "owner": "oxalica", "repo": "nil", - "rev": "0718fca59b82e53aef07699db7e1bbd86ba8dacf", + "rev": "1d5bc81023c21b22cfbea06a8b4b82963c01b941", "type": "github" }, "original": { @@ -781,11 +784,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1680273054, - "narHash": "sha256-Bs6/5LpvYp379qVqGt9mXxxx9GSE789k3oFc+OAL07M=", + "lastModified": 1681510139, + "narHash": "sha256-pmZoMRkTxEp/EIqUPScTUOOhpPOSLJSL4eahsiP2mxI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3364b5b117f65fe1ce65a3cdd5612a078a3b31e3", + "rev": "639d4f17218568afd6494dbd807bebb2beb9d6b3", "type": "github" }, "original": { @@ -798,11 +801,11 @@ "nixpkgs-lib": { "locked": { "dir": "lib", - "lastModified": 1678375444, - "narHash": "sha256-XIgHfGvjFvZQ8hrkfocanCDxMefc/77rXeHvYdzBMc8=", + "lastModified": 1680213900, + "narHash": "sha256-cIDr5WZIj3EkKyCgj/6j3HBH4Jj1W296z7HTcWj1aMA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "130fa0baaa2b93ec45523fdcde942f6844ee9f6e", + "rev": "e3652e0735fbec227f342712f180f4f21f0594f2", "type": "github" }, "original": { @@ -896,11 +899,11 @@ "nui-nvim": { "flake": false, "locked": { - "lastModified": 1680113440, - "narHash": "sha256-pDroyXtkrBGbEZs0mcf+96ba72c0leNMW0AlM50RDJ8=", + "lastModified": 1681244240, + "narHash": "sha256-IlbOt9fCBklx3i8OY2DZwa/8OV+yGOLBm8HUeVLseIw=", "owner": "MunifTanjim", "repo": "nui.nvim", - "rev": "4eaec2ac66af2ca6ddddd3f665ad0909b90ae36a", + "rev": "ecd9def93891b9260b15b5fcef542eaabf4145c9", "type": "github" }, "original": { @@ -912,11 +915,11 @@ "null-ls": { "flake": false, "locked": { - "lastModified": 1680311856, - "narHash": "sha256-JViLNL2LLzm+ZQYnR4HF3e2mBa7AbDK7jWn4ZhjKYbY=", + "lastModified": 1681223720, + "narHash": "sha256-L3inC3YpiNdFdArqHdqR0n7g//moTvLYybQafFgkbDE=", "owner": "jose-elias-alvarez", "repo": "null-ls.nvim", - "rev": "defa0518762abb32279d601443344fb9773f9330", + "rev": "f8ffcd7cb8fb3325c711d459152ef132b5b65aed", "type": "github" }, "original": { @@ -928,11 +931,11 @@ "nvim-autopairs": { "flake": false, "locked": { - "lastModified": 1679861399, - "narHash": "sha256-G5D07KozNj48CxzcMevf1+ZqJEMXQql7VfWUseg6Rzc=", + "lastModified": 1681023386, + "narHash": "sha256-Z9m+6qhxdUNe5zQga2q+GXjWmJQBgCL8PN2LPCP9t4I=", "owner": "windwp", "repo": "nvim-autopairs", - "rev": "0fd6519d44eac3a6736aafdb3fe9da916c3701d4", + "rev": "7470af886ffb3df32800e5ef9c072a6cd825770d", "type": "github" }, "original": { @@ -1041,11 +1044,11 @@ "nvim-lspconfig": { "flake": false, "locked": { - "lastModified": 1680376121, - "narHash": "sha256-iEBGdENh3qXKHpRCqApG2JfJwXOsInivO0dUGton+I4=", + "lastModified": 1681464825, + "narHash": "sha256-ZqCwGpSmLhfnWYNdgrkvGXOv44wmEUVhfuo+i/cUfck=", "owner": "neovim", "repo": "nvim-lspconfig", - "rev": "8cbfc30c4b238cc2465ff256803f7747376f046a", + "rev": "e52efca5d4f5536533d447ec0d97e4d525b37ace", "type": "github" }, "original": { @@ -1105,11 +1108,11 @@ "nvim-tree-lua": { "flake": false, "locked": { - "lastModified": 1679961168, - "narHash": "sha256-9e5kBw9cZX08uQAfFb/YP17a1biDR8PNg617PhkKJhk=", + "lastModified": 1681538020, + "narHash": "sha256-+TqogQLx8IHGxEkkBVBm1g2CZgKzaG5G2GPICTJNA1A=", "owner": "nvim-tree", "repo": "nvim-tree.lua", - "rev": "45400cd7e02027937cd5e49845545e606ecf5a1f", + "rev": "6ad5c26f4d44791699c5538d9773cb141ba033e7", "type": "github" }, "original": { @@ -1137,11 +1140,11 @@ "nvim-ts-autotag": { "flake": false, "locked": { - "lastModified": 1679019585, - "narHash": "sha256-XNR09azYMviWt8aU8XuhS7q+AT5xRBK+FkeejlAAshg=", + "lastModified": 1681387572, + "narHash": "sha256-qi1PF75HeaAkHAvsinyXtfvggE12agUNnx7mrSsBiDo=", "owner": "windwp", "repo": "nvim-ts-autotag", - "rev": "25698e4033cd6cd3745454bfc837dd670eba0480", + "rev": "cac97f3b47bcb927db6d1d784c0c323056506ef3", "type": "github" }, "original": { @@ -1153,11 +1156,11 @@ "nvim-web-devicons": { "flake": false, "locked": { - "lastModified": 1680259444, - "narHash": "sha256-KY0L9j7zKSXgVLUqoda3btiQ6r1h/gckJGpma4CXqUM=", + "lastModified": 1681235235, + "narHash": "sha256-lAjk2Kpyxabe21ut7xCvhE2+we8hsEZWpcJrYLbhWqM=", "owner": "kyazdani42", "repo": "nvim-web-devicons", - "rev": "d92b3f4275f4774c0cb23b8b094a41d1dbb3e78c", + "rev": "4ec26d67d419c12a4abaea02f1b6c57b40c08d7e", "type": "github" }, "original": { @@ -1169,11 +1172,11 @@ "obsidian-nvim": { "flake": false, "locked": { - "lastModified": 1680287173, - "narHash": "sha256-OV3s/0qZi29GH1tWqjQjbBWMHkOJfmTujjMO18/rKg8=", + "lastModified": 1680635774, + "narHash": "sha256-tkOksS2jAz9VjfBq/PtanxuWtKFEQxLbEFuLXUP5cKQ=", "owner": "epwalsh", "repo": "obsidian.nvim", - "rev": "e1c4658cc6530a8d2f393451f68bd9e6366173b9", + "rev": "d2433fba40bb023f4b05ff2f51590f415be1eb71", "type": "github" }, "original": { @@ -1201,11 +1204,11 @@ "orgmode-nvim": { "flake": false, "locked": { - "lastModified": 1680214315, - "narHash": "sha256-jveJ1ffvv4pkfog1t98yPvTiltTv8Li89gEDbBnz8K0=", + "lastModified": 1680848282, + "narHash": "sha256-KPoSv8GbKpFGu69V/q1VtalAQlYt1cF8j5DBLHE1rjM=", "owner": "nvim-orgmode", "repo": "orgmode", - "rev": "070f7588629b956bba17d9892e6fa15bf19a2260", + "rev": "87cf0069949bb9426ef4930efdcaea942438cf92", "type": "github" }, "original": { @@ -1217,11 +1220,11 @@ "plenary-nvim": { "flake": false, "locked": { - "lastModified": 1676797549, - "narHash": "sha256-z5JHuQcF1EvySnRBywl6EOrp8aRO0nd2dnkXJg2ge58=", + "lastModified": 1681122243, + "narHash": "sha256-tG+BrCgE1L7QMbchSzjLfQfpI09uTQXbx7OeFuVEcDQ=", "owner": "nvim-lua", "repo": "plenary.nvim", - "rev": "253d34830709d690f013daf2853a9d21ad7accab", + "rev": "9ac3e9541bbabd9d73663d757e4fe48a675bb054", "type": "github" }, "original": { @@ -1265,11 +1268,11 @@ "registers": { "flake": false, "locked": { - "lastModified": 1678110851, - "narHash": "sha256-JxOtdChh4V/SfBQNVDoHdWvH49nfDhlokS/7vWQWryI=", + "lastModified": 1680595111, + "narHash": "sha256-MeBlcF5LLk6bhIofYuG+0Z2xwc0BVqP85yNCvjH66fw=", "owner": "tversteeg", "repo": "registers.nvim", - "rev": "0a461e635403065b3f9a525bd77eff30759cfba0", + "rev": "2ab8372bb837f05fae6b43091f10a0b725d113ca", "type": "github" }, "original": { @@ -1400,11 +1403,11 @@ ] }, "locked": { - "lastModified": 1678415622, - "narHash": "sha256-tems1jHETCYEen8QrW61yVVX0F4zOGy4ImB43iDc7bY=", + "lastModified": 1680488274, + "narHash": "sha256-0vYMrZDdokVmPQQXtFpnqA2wEgCCUXf5a3dDuDVshn0=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "9f687941160108f89dd8bd2c650d32c15a35c7c7", + "rev": "7ec2ff598a172c6e8584457167575b3a1a5d80d8", "type": "github" }, "original": { @@ -1494,6 +1497,21 @@ "type": "github" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "tabular": { "flake": false, "locked": { @@ -1513,11 +1531,11 @@ "telescope": { "flake": false, "locked": { - "lastModified": 1679492995, - "narHash": "sha256-Kyw9ryb8YgAKFWLac9yl/fD3nNcu7mv7xzuNU6pDMkU=", + "lastModified": 1681122231, + "narHash": "sha256-UMidzUf2nhG577Minzm3QYu0ZNPoK/rXEyUdvZ/5nFw=", "owner": "nvim-telescope", "repo": "telescope.nvim", - "rev": "942fe5faef47b21241e970551eba407bc10d9547", + "rev": "6258d50b09f9ae087317e392efe7c05a7323492d", "type": "github" }, "original": { @@ -1586,11 +1604,11 @@ "toggleterm-nvim": { "flake": false, "locked": { - "lastModified": 1680290314, - "narHash": "sha256-862KtB9oqktx/mPI0wSauF7eJIJogqgG6wTTYlCSo9U=", + "lastModified": 1681296186, + "narHash": "sha256-y8CvzzW4ezqdnSzeon39KVN1JEU+9SSJ78n51A5XHVQ=", "owner": "akinsho", "repo": "toggleterm.nvim", - "rev": "b86982429325112d2b20c6d0cc7a5c4b182ab705", + "rev": "1c5996ee3c30b54751093fe68d40676859e7778f", "type": "github" }, "original": { @@ -1680,11 +1698,11 @@ "vim-markdown": { "flake": false, "locked": { - "lastModified": 1677235033, - "narHash": "sha256-q4OE2tUoA0i6m3CbyzCYfjGsPNaTbU9/deM4DBu36GY=", + "lastModified": 1680951012, + "narHash": "sha256-B00rad/Bbp+kJBN/fYliOaGiUe0AfBng6gs/fVBve9A=", "owner": "preservim", "repo": "vim-markdown", - "rev": "5d3d1b6cbdc4be0b4c6105c1ab1f769d76d3c68f", + "rev": "cc82d88e2a791f54d2b6e2b26e41f743351ac947", "type": "github" }, "original": { @@ -1798,11 +1816,11 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1680308637, - "narHash": "sha256-gas/Oo1hYbYOHzr1TBoHGH1mEzMMlPIdosb3yt573c0=", + "lastModified": 1681518239, + "narHash": "sha256-B4wcDAT9Vo139zX/6Dmt2pNCYBVBMnGgWS5dY6hZrZY=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "0d01cdde8c66b2b49cb30f8b52f11237b1ae5f6f", + "rev": "518db62bd3a6d36a023b202583b71810f3a35eea", "type": "github" }, "original": { From e480be7ac5c9190d04bf3f31c15bde8bc11fd5c1 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sat, 15 Apr 2023 11:29:49 +0300 Subject: [PATCH 02/33] fix: deprecated view.hide-root-folder opt --- extra.nix | 3 +++ modules/filetree/nvimtree-lua/config.nix | 7 ++++++- modules/filetree/nvimtree-lua/nvimtree-lua.nix | 12 ++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/extra.nix b/extra.nix index 55a2f6a..02ee01c 100644 --- a/extra.nix +++ b/extra.nix @@ -88,6 +88,9 @@ inputs: let vim.filetree = { nvimTreeLua = { enable = true; + renderer = { + rootFolderLabel = null; + }; view = { width = 25; }; diff --git a/modules/filetree/nvimtree-lua/config.nix b/modules/filetree/nvimtree-lua/config.nix index 6546232..4267b02 100644 --- a/modules/filetree/nvimtree-lua/config.nix +++ b/modules/filetree/nvimtree-lua/config.nix @@ -80,7 +80,6 @@ in { width = ${toString cfg.view.width}, side = ${"'" + cfg.view.side + "'"}, adaptive_size = ${boolToString cfg.view.adaptiveSize}, - hide_root_folder = ${boolToString cfg.view.hideRootFolder}, }, git = { enable = ${boolToString cfg.git.enable}, @@ -119,6 +118,12 @@ in { -- TODO: those two add_trailing = ${boolToString cfg.renderer.trailingSlash}, group_empty = ${boolToString cfg.renderer.groupEmptyFolders}, + + rootFolderLabel = ${ + if cfg.renderer.rootFolderLabel == null + then "false" + else "''${toString cfg.rootFolderLabel}''" + }, }, system_open = { diff --git a/modules/filetree/nvimtree-lua/nvimtree-lua.nix b/modules/filetree/nvimtree-lua/nvimtree-lua.nix index fbd0fb6..33a5508 100644 --- a/modules/filetree/nvimtree-lua/nvimtree-lua.nix +++ b/modules/filetree/nvimtree-lua/nvimtree-lua.nix @@ -160,12 +160,6 @@ with builtins; { description = "Width of the tree in charecters"; type = types.int; }; - - hideRootFolder = mkOption { - default = true; - description = "Hide the root folder"; - type = types.bool; - }; }; git = { @@ -282,6 +276,12 @@ with builtins; { type = types.bool; }; + rootFolderLabel = mkOption { + default = null; + description = "Root folder label. Set null to disable"; + type = with types; nullOr str; + }; + icons = { show = { file = mkOption { From af0c6ea087be1438bb00161a059bbc9c1286651e Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 17 Apr 2023 18:48:48 +0300 Subject: [PATCH 03/33] fix: invalid nvimtree-lua opt --- modules/filetree/nvimtree-lua/config.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/filetree/nvimtree-lua/config.nix b/modules/filetree/nvimtree-lua/config.nix index 4267b02..042f5c7 100644 --- a/modules/filetree/nvimtree-lua/config.nix +++ b/modules/filetree/nvimtree-lua/config.nix @@ -119,7 +119,7 @@ in { add_trailing = ${boolToString cfg.renderer.trailingSlash}, group_empty = ${boolToString cfg.renderer.groupEmptyFolders}, - rootFolderLabel = ${ + root_folder_label = ${ if cfg.renderer.rootFolderLabel == null then "false" else "''${toString cfg.rootFolderLabel}''" From 2d4f2ed91d52be1ef6961d877053ec7afdb93c1f Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 17 Apr 2023 18:52:35 +0300 Subject: [PATCH 04/33] feat: editorconfig support for 0.9.0 --- modules/basic/module.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/basic/module.nix b/modules/basic/module.nix index 7ac5ad7..3fc62d5 100644 --- a/modules/basic/module.nix +++ b/modules/basic/module.nix @@ -139,5 +139,10 @@ with builtins; { default = true; description = "New splits will open to the right"; }; + enableEditorconfig = mkOption { + type = types.bool; + default = false; + description = "Follow editorconfig rules in current directory" + }; }; } From c13c1e54ecf9c1f14ece5a1d243cc9366bef62be Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 17 Apr 2023 20:12:30 +0300 Subject: [PATCH 05/33] feat: change nvim-cmp source for nvim 0.9.0 --- flake.nix | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index ea6eaac..05e99c4 100644 --- a/flake.nix +++ b/flake.nix @@ -70,12 +70,6 @@ flake-parts.url = "github:hercules-ci/flake-parts"; flake-utils.url = "github:numtide/flake-utils"; - # TODO: neovim nightly - neovim-nightly-overlay = { - url = "github:nix-community/neovim-nightly-overlay"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - # For generating documentation website nmd = { url = "gitlab:rycee/nmd"; @@ -187,7 +181,7 @@ flake = false; }; nvim-cmp = { - url = "github:hrsh7th/nvim-cmp"; + url = "github:ShIRannx/nvim-cmp"; flake = false; }; cmp-buffer = { From a6e24299da0be8326433dda0201e2b7c0f6860b9 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 17 Apr 2023 20:12:56 +0300 Subject: [PATCH 06/33] dev: remove neovim nightly overlay --- flake.lock | 176 +++++++++++---------------------------- flake/legacyPackages.nix | 1 - 2 files changed, 49 insertions(+), 128 deletions(-) diff --git a/flake.lock b/flake.lock index d354bc4..fa55e41 100644 --- a/flake.lock +++ b/flake.lock @@ -195,11 +195,11 @@ "colorizer": { "flake": false, "locked": { - "lastModified": 1681357415, - "narHash": "sha256-nMvzrghsKy2W7OeXYJKclLi3CMvYRprTp1BgEgtK7uY=", + "lastModified": 1681740520, + "narHash": "sha256-OBL10BJrZuOaauRdCjZxUiUSWgTN3VJARQCqWwx0tlg=", "owner": "uga-rosa", "repo": "ccc.nvim", - "rev": "82f5113a9b12993deabe610958dcf23933a8f4a7", + "rev": "1c96900635c23b48ac7993d257e8dc9ec382196a", "type": "github" }, "original": { @@ -259,11 +259,11 @@ "dashboard-nvim": { "flake": false, "locked": { - "lastModified": 1681310977, - "narHash": "sha256-P9JSr5r91joT+dPbjkwLCEN60zt5lDL2bcX7JCRrr+g=", + "lastModified": 1681720765, + "narHash": "sha256-7RBjr3svkEYgmWeB3GwksoHS8Ps74YcqNYBfynUaXvM=", "owner": "glepnir", "repo": "dashboard-nvim", - "rev": "d5b0fff69546a3d4d742b47ca0452a41323f2f8f", + "rev": "275e7c8579858c3ee06f32c16bdc687153ca7204", "type": "github" }, "original": { @@ -353,22 +353,6 @@ "type": "github" } }, - "flake-compat_2": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -406,21 +390,6 @@ } }, "flake-utils_2": { - "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" - } - }, - "flake-utils_3": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -438,11 +407,11 @@ "flutter-tools": { "flake": false, "locked": { - "lastModified": 1681227071, - "narHash": "sha256-6oMlwOSLXUWX1a0Gu9BL0+AvP7FVKJTr9LNtNKKsjaQ=", + "lastModified": 1681573333, + "narHash": "sha256-WKvHoSv8OaVGtrGMq8YUGnnvuuEXLNigT4NQwtx5HC4=", "owner": "akinsho", "repo": "flutter-tools.nvim", - "rev": "b64892ec95b4454f1080b62fef170338f92fc414", + "rev": "dedb571b15e6639792fea528b8c3040558f4ef0d", "type": "github" }, "original": { @@ -582,11 +551,11 @@ "lsp-signature": { "flake": false, "locked": { - "lastModified": 1680919643, - "narHash": "sha256-edPNVM4OhN4eBkBbhjkA4kpfxdg8FND23JhGLKjAd6w=", + "lastModified": 1681633928, + "narHash": "sha256-z/jGs2syMW8dp12bUwYkd+k/AFxyid/lJHGww10XukU=", "owner": "ray-x", "repo": "lsp_signature.nvim", - "rev": "775c0cdf5be5adcc08f27c9058edb00b5b517520", + "rev": "72b0d4ece23338fe2d03fc7b6fd8c8bace6bb441", "type": "github" }, "original": { @@ -712,52 +681,6 @@ "type": "github" } }, - "neovim-flake": { - "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": [ - "neovim-nightly-overlay", - "nixpkgs" - ] - }, - "locked": { - "dir": "contrib", - "lastModified": 1681441109, - "narHash": "sha256-18pKVQvULQ8ZGnzoGbfImRO179yShRkRBmV7bK1Hm58=", - "owner": "neovim", - "repo": "neovim", - "rev": "37bb40701d672d5213ec1be4e21d7808aee968e7", - "type": "github" - }, - "original": { - "dir": "contrib", - "owner": "neovim", - "repo": "neovim", - "type": "github" - } - }, - "neovim-nightly-overlay": { - "inputs": { - "flake-compat": "flake-compat", - "neovim-flake": "neovim-flake", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1681470660, - "narHash": "sha256-ycmA2VD4YASPCXzC77qMv6eVNznbJN7CVAQlSFUUFPM=", - "owner": "nix-community", - "repo": "neovim-nightly-overlay", - "rev": "b1960aa4e67cf3ea170e243113afe85b1390a9c9", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "neovim-nightly-overlay", - "type": "github" - } - }, "nil": { "inputs": { "flake-utils": [ @@ -784,11 +707,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1681510139, - "narHash": "sha256-pmZoMRkTxEp/EIqUPScTUOOhpPOSLJSL4eahsiP2mxI=", + "lastModified": 1681693905, + "narHash": "sha256-XdXMvCt+i2ZcmAIPZvu3RUwcdaC9OX7d1WMAJJokzeA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "639d4f17218568afd6494dbd807bebb2beb9d6b3", + "rev": "db34d7561caa508ece0265a56f382c5d3b7a6c1b", "type": "github" }, "original": { @@ -883,11 +806,11 @@ "noice-nvim": { "flake": false, "locked": { - "lastModified": 1679827108, - "narHash": "sha256-05/yAwaoz7mAAKXP1CsRXUoqsTW/z1wAT0OodiYJw6M=", + "lastModified": 1681713054, + "narHash": "sha256-do/L2UpxyuKlTBBicMJHp0du71MzbuVM+P1dOAURAuY=", "owner": "folke", "repo": "noice.nvim", - "rev": "1da4edfba3e9278e98fc9723d7235d9ab3889744", + "rev": "5c63a32fde4e87631ddd768f5d7674ec5988c1a2", "type": "github" }, "original": { @@ -931,11 +854,11 @@ "nvim-autopairs": { "flake": false, "locked": { - "lastModified": 1681023386, - "narHash": "sha256-Z9m+6qhxdUNe5zQga2q+GXjWmJQBgCL8PN2LPCP9t4I=", + "lastModified": 1681692125, + "narHash": "sha256-QBzyI0Jfo4nj6Nqkm8qzICgyDhg7CiT+2gMTsuZ8rIQ=", "owner": "windwp", "repo": "nvim-autopairs", - "rev": "7470af886ffb3df32800e5ef9c072a6cd825770d", + "rev": "58985de5eeab159462bc262de5cc1b9c9b375595", "type": "github" }, "original": { @@ -964,15 +887,15 @@ "nvim-cmp": { "flake": false, "locked": { - "lastModified": 1679026924, - "narHash": "sha256-CoHGIiZrhRAHZ/Er0JSQMapI7jwllNF5OysLlx2QEik=", - "owner": "hrsh7th", + "lastModified": 1681258533, + "narHash": "sha256-vMQZzbvLGkBNtds8Ak6LgJBPCqXCxnJQ3m/eaTF2k+4=", + "owner": "ShIRannx", "repo": "nvim-cmp", - "rev": "777450fd0ae289463a14481673e26246b5e38bf2", + "rev": "3dbd99fd3eab9974cda7751e43383f7869f70aa1", "type": "github" }, "original": { - "owner": "hrsh7th", + "owner": "ShIRannx", "repo": "nvim-cmp", "type": "github" } @@ -1028,11 +951,11 @@ "nvim-lightbulb": { "flake": false, "locked": { - "lastModified": 1661474119, - "narHash": "sha256-nw6H/dS4dHdrobnrfJVa8urWrMnbTWrA5bQJy9xbKXY=", + "lastModified": 1681594259, + "narHash": "sha256-vMFl6Nzc0ZxTa4lQ5FEnE9GkxbPuu5/skufgsR34BSE=", "owner": "kosayoda", "repo": "nvim-lightbulb", - "rev": "56b9ce31ec9d09d560fe8787c0920f76bc208297", + "rev": "ca5b44a8efffb5fec1963ccd21f25ec04cc778b7", "type": "github" }, "original": { @@ -1044,11 +967,11 @@ "nvim-lspconfig": { "flake": false, "locked": { - "lastModified": 1681464825, - "narHash": "sha256-ZqCwGpSmLhfnWYNdgrkvGXOv44wmEUVhfuo+i/cUfck=", + "lastModified": 1681647398, + "narHash": "sha256-jrVzwC9nO2gLmIKQ9gTRW/fsXc4ad7/rR917Krmv874=", "owner": "neovim", "repo": "nvim-lspconfig", - "rev": "e52efca5d4f5536533d447ec0d97e4d525b37ace", + "rev": "eddaef928c1e1dd79a96f5db45f2fd7f2efe7ea0", "type": "github" }, "original": { @@ -1108,11 +1031,11 @@ "nvim-tree-lua": { "flake": false, "locked": { - "lastModified": 1681538020, - "narHash": "sha256-+TqogQLx8IHGxEkkBVBm1g2CZgKzaG5G2GPICTJNA1A=", + "lastModified": 1681624690, + "narHash": "sha256-kLvRB1w4wHGOOWj4fQ6pyhvKJ4+mqOkhYe04uicfHmA=", "owner": "nvim-tree", "repo": "nvim-tree.lua", - "rev": "6ad5c26f4d44791699c5538d9773cb141ba033e7", + "rev": "8f392fa763b7ee80a48c714b630acaf6d1fe1854", "type": "github" }, "original": { @@ -1204,11 +1127,11 @@ "orgmode-nvim": { "flake": false, "locked": { - "lastModified": 1680848282, - "narHash": "sha256-KPoSv8GbKpFGu69V/q1VtalAQlYt1cF8j5DBLHE1rjM=", + "lastModified": 1681591080, + "narHash": "sha256-1JzE296ARUhsy55qjA3n5XAQLnySf+FM+mwJWa07+CM=", "owner": "nvim-orgmode", "repo": "orgmode", - "rev": "87cf0069949bb9426ef4930efdcaea942438cf92", + "rev": "d8020e95f531369962d74d037f603d038d70de1e", "type": "github" }, "original": { @@ -1341,7 +1264,6 @@ "mind-nvim": "mind-nvim", "minimap-vim": "minimap-vim", "modes-nvim": "modes-nvim", - "neovim-nightly-overlay": "neovim-nightly-overlay", "nil": "nil", "nixpkgs": "nixpkgs", "nmd": "nmd", @@ -1620,11 +1542,11 @@ "tokyonight": { "flake": false, "locked": { - "lastModified": 1679554571, - "narHash": "sha256-M1fX5o8w6MbDX46HiN1Nw9xjG4Z79zraPKi0VUpyyVU=", + "lastModified": 1681713069, + "narHash": "sha256-2+lDMcKZZqt8gf4bzi/I5FitO+DSlxrmtTgrO+tXkvU=", "owner": "folke", "repo": "tokyonight.nvim", - "rev": "1b0c88094548a62641ece1e668fa9a234e1c539e", + "rev": "ef8f5917f1a3972e6dd083c1ea74dafcb54f9917", "type": "github" }, "original": { @@ -1796,11 +1718,11 @@ "which-key": { "flake": false, "locked": { - "lastModified": 1679827118, - "narHash": "sha256-R52U1Aa30KgNyyTxN3ZiWaoh86/Vsj5kmUmCCos5DjE=", + "lastModified": 1681746771, + "narHash": "sha256-YRkwLCcJJE9QXOPhCdWIWfMBEgse0Me66JLGzm8Jz9c=", "owner": "folke", "repo": "which-key.nvim", - "rev": "4b73390eec680b4c061ea175eb32c0ff3412271d", + "rev": "f82ca7fbaf4718303dbaf83dc28303fee16cf4d2", "type": "github" }, "original": { @@ -1811,16 +1733,16 @@ }, "zig": { "inputs": { - "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_3", + "flake-compat": "flake-compat", + "flake-utils": "flake-utils_2", "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1681518239, - "narHash": "sha256-B4wcDAT9Vo139zX/6Dmt2pNCYBVBMnGgWS5dY6hZrZY=", + "lastModified": 1681690952, + "narHash": "sha256-x8KEUCSorKtsWWlJWXi6atcWkcREAV1o081knXZCQfc=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "518db62bd3a6d36a023b202583b71810f3a35eea", + "rev": "0cd7fee7dae8eaaf77ed0d420f69be0a481acc9d", "type": "github" }, "original": { diff --git a/flake/legacyPackages.nix b/flake/legacyPackages.nix index bd284be..c98d626 100644 --- a/flake/legacyPackages.nix +++ b/flake/legacyPackages.nix @@ -9,7 +9,6 @@ overlays = [ inputs.tidalcycles.overlays.default inputs.self.overlays.default - inputs.neovim-nightly-overlay.overlay inputs.zig.overlays.default (_: _: { rnix-lsp = inputs'.rnix-lsp.defaultPackage; From 720f0f1a17b4e3c7e222fb1491b0a80e1027d5d0 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 17 Apr 2023 20:13:18 +0300 Subject: [PATCH 07/33] feat: editorconfig support --- modules/basic/config.nix | 3 +++ modules/basic/module.nix | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/basic/config.nix b/modules/basic/config.nix index a06cae2..1b4512a 100644 --- a/modules/basic/config.nix +++ b/modules/basic/config.nix @@ -103,6 +103,9 @@ in { set termguicolors set t_Co=256 ''} + ${optionalString cfg.enableEditorconfig '' + vim.g.editorconfig = false + ''} ''; }; } diff --git a/modules/basic/module.nix b/modules/basic/module.nix index 3fc62d5..08a3c86 100644 --- a/modules/basic/module.nix +++ b/modules/basic/module.nix @@ -142,7 +142,7 @@ with builtins; { enableEditorconfig = mkOption { type = types.bool; default = false; - description = "Follow editorconfig rules in current directory" + description = "Follow editorconfig rules in current directory"; }; }; } From 222add8edb5fa3fe0143e8989ab44b4c8d3d0b4b Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 17 Apr 2023 20:15:19 +0300 Subject: [PATCH 08/33] dev: inherit hasAttr attrNames from builtins --- modules/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default.nix b/modules/default.nix index d8b4515..34d6212 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -6,7 +6,7 @@ inputs: { extraSpecialArgs ? {}, }: let inherit (pkgs) neovim-unwrapped wrapNeovim vimPlugins; - inherit (builtins) map filter isString toString getAttr; + inherit (builtins) map filter isString toString getAttr hasAttr attrNames; inherit (pkgs.vimUtils) buildVimPluginFrom2Nix; extendedLib = import ../lib/stdlib-extended.nix lib; From 0f18e145ebbceb0eb40c35e0604de6acbec326a9 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 17 Apr 2023 21:56:21 +0300 Subject: [PATCH 09/33] style: formatting --- modules/basic/module.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/basic/module.nix b/modules/basic/module.nix index 08a3c86..82dd802 100644 --- a/modules/basic/module.nix +++ b/modules/basic/module.nix @@ -143,6 +143,6 @@ with builtins; { type = types.bool; default = false; description = "Follow editorconfig rules in current directory"; - }; + }; }; } From 8da2a029049944055cc54e27cf94cf45abdd17ba Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 17 Apr 2023 22:46:03 +0300 Subject: [PATCH 10/33] docs: update release notes --- docs/release-notes/rl-0.3.adoc | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/release-notes/rl-0.3.adoc diff --git a/docs/release-notes/rl-0.3.adoc b/docs/release-notes/rl-0.3.adoc new file mode 100644 index 0000000..e69de29 From 7a71f067637d309dd564c5a369cbb14e18ebea47 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 17 Apr 2023 22:56:05 +0300 Subject: [PATCH 11/33] feat: remove nixos module --- flake.nix | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/flake.nix b/flake.nix index 05e99c4..78f77b6 100644 --- a/flake.nix +++ b/flake.nix @@ -32,18 +32,6 @@ inherit (import ./extra.nix inputs) neovimConfiguration; }; - /* - nixosModules.default = { - home-manager.sharedModules = [ - ./lib/module - ]; - nixpkgs.overlays = [ - inputs.tidalcycles.overlays.default - inputs.self.overlays.default - ]; - }; - */ - homeManagerModules = { neovim-flake = { imports = [ @@ -61,6 +49,7 @@ ... }: { devShells.default = pkgs.mkShell {nativeBuildInputs = [config.packages.nix];}; + }; }; From 6b512f132a674b7c0e0c1f74d066ec5bd6e2dab7 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 17 Apr 2023 23:27:27 +0300 Subject: [PATCH 12/33] feat: refactor and separate LSP/language configurations --- extra.nix | 46 +-- flake.nix | 1 - lib/default.nix | 1 + lib/languages.nix | 25 ++ lib/types/default.nix | 2 + lib/types/languages.nix | 26 ++ modules/completion/nvim-cmp/config.nix | 19 +- modules/completion/nvim-cmp/nvim-cmp.nix | 15 +- modules/languages/clang.nix | 96 +++++ modules/languages/default.nix | 27 ++ modules/languages/go.nix | 71 ++++ modules/languages/nix.nix | 161 ++++++++ modules/languages/python.nix | 108 +++++ modules/languages/rust.nix | 113 ++++++ modules/languages/sql.nix | 160 ++++++++ modules/languages/ts.nix | 153 ++++++++ modules/languages/zig.nix | 68 ++++ modules/lsp/config.nix | 371 ++---------------- modules/lsp/default.nix | 4 + .../lsp/flutter-tools-nvim/flutter-tools.nix | 2 + modules/lsp/lspconfig/config.nix | 25 ++ modules/lsp/lspconfig/default.nix | 6 + modules/lsp/lspconfig/lspconfig.nix | 18 + modules/lsp/module.nix | 68 +--- modules/lsp/null-ls/config.nix | 36 ++ modules/lsp/null-ls/default.nix | 6 + modules/lsp/null-ls/null-ls.nix | 20 + modules/modules.nix | 1 + modules/treesitter/config.nix | 91 ++--- modules/treesitter/treesitter.nix | 48 +-- 30 files changed, 1266 insertions(+), 522 deletions(-) create mode 100644 lib/languages.nix create mode 100644 lib/types/languages.nix create mode 100644 modules/languages/clang.nix create mode 100644 modules/languages/default.nix create mode 100644 modules/languages/go.nix create mode 100644 modules/languages/nix.nix create mode 100644 modules/languages/python.nix create mode 100644 modules/languages/rust.nix create mode 100644 modules/languages/sql.nix create mode 100644 modules/languages/ts.nix create mode 100644 modules/languages/zig.nix create mode 100644 modules/lsp/lspconfig/config.nix create mode 100644 modules/lsp/lspconfig/default.nix create mode 100644 modules/lsp/lspconfig/lspconfig.nix create mode 100644 modules/lsp/null-ls/config.nix create mode 100644 modules/lsp/null-ls/default.nix create mode 100644 modules/lsp/null-ls/null-ls.nix diff --git a/extra.nix b/extra.nix index 02ee01c..5fba36b 100644 --- a/extra.nix +++ b/extra.nix @@ -25,25 +25,23 @@ inputs: let }; }; - vim.lsp = { - enable = true; - formatOnSave = true; - lightbulb.enable = true; - lspsaga.enable = false; - nvimCodeActionMenu.enable = true; - trouble.enable = true; - lspSignature.enable = true; - rust.enable = isMaximal; - python = isMaximal; + vim.languages = { + enableLSP = true; + enableFormat = true; + enableTreesitter = true; + enableExtraDiagnostics = true; + + nix.enable = true; clang.enable = isMaximal; - sql = isMaximal; - ts = isMaximal; - go = isMaximal; - zig.enable = isMaximal; - nix = { - enable = true; - formatter = "alejandra"; + sql.enable = isMaximal; + rust = { + enable = isMaximal; + crates.enable = true; }; + ts.enable = isMaximal; + go.enable = isMaximal; + zig.enable = isMaximal; + python.enable = isMaximal; }; vim.visuals = { @@ -101,24 +99,14 @@ inputs: let nvimBufferline.enable = true; }; - vim.treesitter = { - enable = true; - context.enable = true; - }; + vim.treesitter.context.enable = true; vim.binds = { whichKey.enable = true; cheatsheet.enable = true; }; - vim.telescope = { - enable = true; - }; - - vim.markdown = { - enable = true; - glow.enable = true; - }; + vim.telescope.enable = true; vim.git = { enable = true; diff --git a/flake.nix b/flake.nix index 78f77b6..6e7d363 100644 --- a/flake.nix +++ b/flake.nix @@ -49,7 +49,6 @@ ... }: { devShells.default = pkgs.mkShell {nativeBuildInputs = [config.packages.nix];}; - }; }; diff --git a/lib/default.nix b/lib/default.nix index 873f31b..e7b721b 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -2,4 +2,5 @@ dag = import ./dag.nix {inherit lib;}; booleans = import ./booleans.nix {inherit lib;}; types = import ./types {inherit lib;}; + languages = import ./languages.nix {inherit lib;}; } diff --git a/lib/languages.nix b/lib/languages.nix new file mode 100644 index 0000000..18d678d --- /dev/null +++ b/lib/languages.nix @@ -0,0 +1,25 @@ +# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix +{lib}: { + # Converts a boolean to a yes/no string. This is used in lots of + # configuration formats. + diagnosticsToLua = { + lang, + config, + diagnostics, + }: + lib.listToAttrs + (map (v: let + type = + if builtins.isString v + then v + else builtins.getAttr v.type; + package = + if builtins.isString v + then diagnostics.${type}.package + else v.package; + in { + name = "${lang}-diagnostics-${type}"; + value = diagnostics.${type}.nullConfig package; + }) + config); +} diff --git a/lib/types/default.nix b/lib/types/default.nix index fca45ba..6317160 100644 --- a/lib/types/default.nix +++ b/lib/types/default.nix @@ -1,7 +1,9 @@ {lib}: let typesDag = import ./dag.nix {inherit lib;}; typesPlugin = import ./plugins.nix {inherit lib;}; + typesLanguage = import ./languages.nix {inherit lib;}; in { inherit (typesDag) dagOf; inherit (typesPlugin) pluginsOpt; + inherit (typesLanguage) diagnostics; } diff --git a/lib/types/languages.nix b/lib/types/languages.nix new file mode 100644 index 0000000..7dc57af --- /dev/null +++ b/lib/types/languages.nix @@ -0,0 +1,26 @@ +{lib}: +with lib; let + diagnosticSubmodule = {...}: { + options = { + type = mkOption { + description = "Type of diagnostic to enable"; + type = attrNames diagnostics; + }; + package = mkOption { + description = "Diagnostics package"; + type = types.package; + }; + }; + }; +in { + diagnostics = { + langDesc, + diagnostics, + defaultDiagnostics, + }: + mkOption { + description = "List of ${langDesc} diagnostics to enable"; + type = with types; listOf (either (enum (attrNames diagnostics)) (submodule diagnosticSubmodule)); + default = defaultDiagnostics; + }; +} diff --git a/modules/completion/nvim-cmp/config.nix b/modules/completion/nvim-cmp/config.nix index a502358..4495243 100644 --- a/modules/completion/nvim-cmp/config.nix +++ b/modules/completion/nvim-cmp/config.nix @@ -1,4 +1,5 @@ { + pkgs, lib, config, ... @@ -6,15 +7,22 @@ with lib; with builtins; let cfg = config.vim.autocomplete; + builtSources = + concatMapStringsSep "\n" (x: "{ name = '${x}'},") cfg.sources; in { config = mkIf cfg.enable { vim.startPlugins = [ - "vim-vsnip" "nvim-cmp" "cmp-buffer" "cmp-vsnip" "cmp-path" - "cmp-treesitter" + ]; + + vim.autocomplete.sources = [ + "nvim-cmp" + "vsnip" + "buffer" + "path" ]; vim.luaConfigRC.completion = mkIf (cfg.type == "nvim-cmp") (nvim.dag.entryAnywhere '' @@ -35,12 +43,7 @@ in { end, }, sources = { - ${optionalString (config.vim.lsp.enable) "{ name = 'nvim_lsp' },"} - ${optionalString (config.vim.lsp.rust.enable) "{ name = 'crates' },"} - { name = 'vsnip' }, - { name = 'treesitter' }, - { name = 'path' }, - { name = 'buffer' }, + ${builtSources} }, mapping = { [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), diff --git a/modules/completion/nvim-cmp/nvim-cmp.nix b/modules/completion/nvim-cmp/nvim-cmp.nix index 5938525..6585218 100644 --- a/modules/completion/nvim-cmp/nvim-cmp.nix +++ b/modules/completion/nvim-cmp/nvim-cmp.nix @@ -1,16 +1,21 @@ { + pkgs, lib, config, ... }: with lib; -with builtins; { +with builtins; let + cfg = config.vim.autocomplete; + builtSources = + concatMapStringsSep "\n" (x: "{ name = '${x}'},") cfg.sources; +in { options.vim = { autocomplete = { enable = mkOption { type = types.bool; default = false; - description = "Enable autocomplete via nvim-cmp"; + description = "enable autocomplete"; }; type = mkOption { @@ -18,6 +23,12 @@ with builtins; { default = "nvim-cmp"; description = "Set the autocomplete plugin. Options: [nvim-cmp]"; }; + + sources = mkOption { + description = "List of source names for nvim-cmp"; + type = with types; listOf str; + default = []; + }; }; }; } diff --git a/modules/languages/clang.nix b/modules/languages/clang.nix new file mode 100644 index 0000000..4514329 --- /dev/null +++ b/modules/languages/clang.nix @@ -0,0 +1,96 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.clang; + + defaultServer = "ccls"; + servers = { + ccls = { + package = pkgs.ccls; + lspConfig = '' + lspconfig.ccls.setup{ + capabilities = capabilities; + on_attach=default_on_attach; + cmd = {"${pkgs.ccls}/bin/ccls"}; + ${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.cclsOpts}"} + } + ''; + }; + }; +in { + options.vim.languages.clang = { + enable = mkEnableOption "C/C++ language support"; + + cHeader = mkOption { + description = '' + C syntax for headers. Can fix treesitter errors, see: + https://www.reddit.com/r/neovim/comments/orfpcd/question_does_the_c_parser_from_nvimtreesitter/ + ''; + type = types.bool; + default = false; + }; + + treesitter = { + enable = mkOption { + description = "Enable C/C++ treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + cPackage = mkOption { + description = "C treesitter grammar to use"; + type = types.package; + default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.c; + }; + cppPackage = mkOption { + description = "C++ treesitter grammar to use"; + type = types.package; + default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.cpp; + }; + }; + + lsp = { + enable = mkOption { + description = "Enable clang LSP support"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + server = mkOption { + description = "The clang LSP server to use"; + type = with types; enum (attrNames servers); + default = defaultServer; + }; + package = mkOption { + description = "clang LSP server package"; + type = types.package; + default = servers.${cfg.lsp.server}.package; + }; + opts = mkOption { + description = "Options to pass to clang LSP server"; + type = with types; nullOr str; + default = null; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.cHeader { + vim.configRC.c-header = nvim.dag.entryAnywhere "let g:c_syntax_for_h = 1"; + }) + + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.cPackage cfg.treesitter.cppPackage]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.lspconfig.enable = true; + + vim.lsp.lspconfig.sources.clang-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + ]); +} diff --git a/modules/languages/default.nix b/modules/languages/default.nix new file mode 100644 index 0000000..3b26e35 --- /dev/null +++ b/modules/languages/default.nix @@ -0,0 +1,27 @@ +{lib, ...}: +with lib; let + mkEnable = desc: + mkOption { + description = "Turn on ${desc} for enabled langauges by default"; + type = types.bool; + default = false; + }; +in { + imports = [ + ./clang.nix + ./go.nix + ./nix.nix + ./python.nix + ./rust.nix + ./sql.nix + ./ts.nix + ./zig.nix + ]; + + options.vim.languages = { + enableLSP = mkEnable "LSP"; + enableTreesitter = mkEnable "treesitter"; + enableFormat = mkEnable "formatting"; + enableExtraDiagnostics = mkEnable "extra diagnostics"; + }; +} diff --git a/modules/languages/go.nix b/modules/languages/go.nix new file mode 100644 index 0000000..0ceb111 --- /dev/null +++ b/modules/languages/go.nix @@ -0,0 +1,71 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.go; + + defaultServer = "gopls"; + servers = { + gopls = { + package = pkgs.gopls; + lspConfig = '' + lspconfig.gopls.setup { + capabilities = capabilities; + on_attach = default_on_attach; + cmd = {"${cfg.lsp.package}/bin/gopls", "serve"}, + } + ''; + }; + }; +in { + options.vim.languages.go = { + enable = mkEnableOption "Go language support"; + + treesitter = { + enable = mkOption { + description = "Enable Go treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = mkOption { + description = "Go treesitter grammar to use"; + type = types.package; + default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.go; + }; + }; + + lsp = { + enable = mkOption { + description = "Enable Go LSP support"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + server = mkOption { + description = "Go LSP server to use"; + type = with types; enum (attrNames servers); + default = defaultServer; + }; + package = mkOption { + description = "Go LSP server package"; + type = types.package; + default = servers.${cfg.lsp.server}.package; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.lspconfig.enable = true; + vim.lsp.lspconfig.sources.go-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + ]); +} diff --git a/modules/languages/nix.nix b/modules/languages/nix.nix new file mode 100644 index 0000000..5063f6b --- /dev/null +++ b/modules/languages/nix.nix @@ -0,0 +1,161 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.nix; + + useFormat = "on_attach = default_on_attatch"; + noFormat = "on_attach = attach_keymaps"; + + defaultServer = "nil"; + servers = { + rnix = { + package = pkgs.rnix-lsp; + internalFormatter = true; + lspConfig = '' + lspconfig.rnix.setup{ + capabilities = capabilities, + ${ + if (cfg.format.enable && cfg.format.type == "nixpkgs-fmt") + then useFormat + else noFormat + }, + cmd = {"${cfg.lsp.package}/bin/rnix-lsp"}, + } + ''; + }; + + nil = { + package = pkgs.nil; + internalFormatter = cfg.format.type != "nixpkgs-fmt"; + lspConfig = '' + lspconfig.nil_ls.setup{ + capabilities = capabilities, + ${ + if cfg.format.enable + then useFormat + else noFormat + }, + cmd = {"${cfg.lsp.package}/bin/nil"}, + ${optionalString cfg.format.enable '' + settings = { + ["nil"] = { + ${optionalString (cfg.format.type == "alejandra") + '' + formatting = { + command = {"${cfg.format.package}/bin/alejandra", "--quiet"}, + }, + ''} + ${optionalString (cfg.format.type == "nixpkgs-fmt") + '' + formatting = { + command = {"${cfg.format.package}/bin/nixpkgs-fmt"}, + }, + ''} + ''} + }, + }; + } + ''; + }; + }; + + defaultFormat = "alejandra"; + formats = { + alejandra = { + package = pkgs.alejandra; + nullConfig = '' + table.insert( + ls_sources, + null_ls.builtins.formatting.alejandra.with({ + command = "${cfg.format.package}/bin/alejandra" + }) + ) + ''; + }; + nixpkgs-fmt = { + package = pkgs.nixpkgs-fmt; + # Never need to use null-ls for nixpkgs-fmt + }; + }; +in { + options.vim.languages.nix = { + enable = mkEnableOption "Nix language support"; + + treesitter = { + enable = mkOption { + description = "Enable Nix treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = mkOption { + description = "Nix treesitter grammar to use"; + type = types.package; + default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.nix; + }; + }; + + lsp = { + enable = mkOption { + description = "Enable Nix LSP support"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + server = mkOption { + description = "Nix LSP server to use"; + type = types.str; + default = defaultServer; + }; + package = mkOption { + description = "Nix LSP server package"; + type = types.package; + default = servers.${cfg.lsp.server}.package; + }; + }; + + format = { + enable = mkOption { + description = "Enable Nix formatting"; + type = types.bool; + default = config.vim.languages.enableFormat; + }; + type = mkOption { + description = "Nix formatter to use"; + type = with types; enum (attrNames formats); + default = defaultFormat; + }; + package = mkOption { + description = "Nix formatter package"; + type = types.package; + default = formats.${cfg.format.type}.package; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + { + vim.configRC.nix = nvim.dag.entryAnywhere '' + autocmd filetype nix setlocal tabstop=2 shiftwidth=2 softtabstop=2 + ''; + } + + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.lspconfig.enable = true; + vim.lsp.lspconfig.sources.nix-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + + (mkIf (cfg.format.enable && !servers.${cfg.lsp.server}.internalFormatter) { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources.nix-format = formats.${cfg.format.type}.nullConfig; + }) + ]); +} diff --git a/modules/languages/python.nix b/modules/languages/python.nix new file mode 100644 index 0000000..c2cabda --- /dev/null +++ b/modules/languages/python.nix @@ -0,0 +1,108 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.python; + + defaultServer = "pyright"; + servers = { + pyright = { + package = pkgs.nodePackages.pyright; + lspConfig = '' + lspconfig.pyright.setup{ + capabilities = capabilities; + on_attach = default_on_attach; + cmd = {"${cfg.lsp.package}/bin/pyright-langserver", "--stdio"} + } + ''; + }; + }; + + defaultFormat = "black"; + formats = { + black = { + package = pkgs.black; + nullConfig = '' + table.insert( + ls_sources, + null_ls.builtins.formatting.black.with({ + command = "${cfg.format.package}/bin/black", + }) + ) + ''; + }; + }; +in { + options.vim.languages.python = { + enable = mkEnableOption "Python language support"; + + treesitter = { + enable = mkOption { + description = "Enable Python treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = mkOption { + description = "Python treesitter grammar to use"; + type = types.package; + default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.python; + }; + }; + + lsp = { + enable = mkOption { + description = "Enable Python LSP support"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + server = mkOption { + description = "Python LSP server to use"; + type = with types; enum (attrNames servers); + default = defaultServer; + }; + package = mkOption { + description = "Python LSP server package"; + type = types.package; + default = servers.${cfg.lsp.server}.package; + }; + }; + + format = { + enable = mkOption { + description = "Enable Python formatting"; + type = types.bool; + default = config.vim.languages.enableFormat; + }; + type = mkOption { + description = "Python formatter to use"; + type = with types; enum (attrNames formats); + default = defaultFormat; + }; + package = mkOption { + description = "Python formatter package"; + type = types.package; + default = formats.${cfg.format.type}.package; + }; + }; + }; + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.lspconfig.enable = true; + vim.lsp.lspconfig.sources.python-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + + (mkIf cfg.format.enable { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources.python-format = formats.${cfg.format.type}.nullConfig; + }) + ]); +} diff --git a/modules/languages/rust.nix b/modules/languages/rust.nix new file mode 100644 index 0000000..b58d885 --- /dev/null +++ b/modules/languages/rust.nix @@ -0,0 +1,113 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.rust; +in { + options.vim.languages.rust = { + enable = mkEnableOption "Rust language support"; + + treesitter = { + enable = mkOption { + description = "Enable Rust treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = mkOption { + description = "Rust treesitter grammar to use"; + type = types.package; + default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.rust; + }; + }; + + crates = { + enable = mkEnableOption "crates-nvim, tools for managing dependencies"; + codeActions = mkOption { + description = "Enable code actions through null-ls"; + type = types.bool; + default = true; + }; + }; + + lsp = { + enable = mkOption { + description = "Rust LSP support (rust-analyzer with extra tools)"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + package = mkOption { + description = "rust-analyzer package"; + type = types.package; + default = pkgs.rust-analyzer; + }; + opts = mkOption { + description = "Options to pass to rust analyzer"; + type = types.str; + default = ""; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.crates.enable { + vim.lsp.null-ls.enable = mkIf cfg.crates.codeActions true; + + vim.startPlugins = ["crates-nvim"]; + + vim.autocomplete.sources = ["crates"]; + vim.luaConfigRC.rust-crates = nvim.dag.entryAnywhere '' + require('crates').setup { + null_ls = { + enabled = ${boolToString cfg.crates.codeActions}, + name = "crates.nvim", + } + } + ''; + }) + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + (mkIf cfg.lsp.enable { + vim.startPlugins = ["rust-tools"]; + + vim.lsp.lspconfig.enable = true; + vim.lsp.lspconfig.sources.rust-lsp = '' + local rt = require('rust-tools') + rust_on_attach = function(client, bufnr) + default_on_attach(client, bufnr) + local opts = { noremap=true, silent=true, buffer = bufnr } + vim.keymap.set("n", "ris", rt.inlay_hints.set, opts) + vim.keymap.set("n", "riu", rt.inlay_hints.unset, opts) + vim.keymap.set("n", "rr", rt.runnables.runnables, opts) + vim.keymap.set("n", "rp", rt.parent_module.parent_module, opts) + vim.keymap.set("n", "rm", rt.expand_macro.expand_macro, opts) + vim.keymap.set("n", "rc", rt.open_cargo_toml.open_cargo_toml, opts) + vim.keymap.set("n", "rg", function() rt.crate_graph.view_crate_graph("x11", nil) end, opts) + end + local rustopts = { + tools = { + autoSetHints = true, + hover_with_actions = false, + inlay_hints = { + only_current_line = false, + } + }, + server = { + capabilities = capabilities, + on_attach = rust_on_attach, + cmd = {"${cfg.lsp.package}/bin/rust-analyzer"}, + settings = { + ${cfg.lsp.opts} + } + } + } + rt.setup(rustopts) + ''; + }) + ]); +} diff --git a/modules/languages/sql.nix b/modules/languages/sql.nix new file mode 100644 index 0000000..0b03cbc --- /dev/null +++ b/modules/languages/sql.nix @@ -0,0 +1,160 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.sql; + sqlfluffDefault = pkgs.sqlfluff; + + defaultServer = "sqls"; + servers = { + sqls = { + package = pkgs.sqls; + lspConfig = '' + lspconfig.sqls.setup { + on_attach = function(client) + client.server_capabilities.execute_command = true + on_attach_keymaps(client, bufnr) + require'sqls'.setup{} + end, + cmd = { "${cfg.lsp.package}/bin/sqls", "-config", string.format("%s/config.yml", vim.fn.getcwd()) } + } + ''; + }; + }; + + defaultFormat = "sqlfluff"; + formats = { + sqlfluff = { + package = sqlfluffDefault; + nullConfig = '' + table.insert( + ls_sources, + null_ls.builtins.formatting.sqlfluff.with({ + command = "${cfg.format.package}/bin/sqlfluff", + extra_args = {"--dialect", "${cfg.dialect}"} + }) + ) + ''; + }; + }; + + defaultDiagnostics = ["sqlfluff"]; + diagnostics = { + sqlfluff = { + package = sqlfluffDefault; + nullConfig = pkg: '' + table.insert( + ls_sources, + null_ls.builtins.diagnostics.sqlfluff.with({ + command = "${pkg}/bin/sqlfluff", + extra_args = {"--dialect", "${cfg.dialect}"} + }) + ) + ''; + }; + }; +in { + options.vim.languages.sql = { + enable = mkEnableOption "SQL language support"; + + dialect = mkOption { + description = "SQL dialect for sqlfluff (if used)"; + type = types.str; + default = "ansi"; + }; + + treesitter = { + enable = mkOption { + description = "Enable SQL treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = mkOption { + description = "SQL treesitter grammar to use"; + type = types.package; + default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.sql; + }; + }; + + lsp = { + enable = mkOption { + description = "Enable SQL LSP support"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + server = mkOption { + description = "SQL LSP server to use"; + type = with types; enum (attrNames servers); + default = defaultServer; + }; + package = mkOption { + description = "SQL LSP server package"; + type = types.package; + default = servers.${cfg.lsp.server}.package; + }; + }; + + format = { + enable = mkOption { + description = "Enable SQL formatting"; + type = types.bool; + default = config.vim.languages.enableFormat; + }; + type = mkOption { + description = "SQL formatter to use"; + type = with types; enum (attrNames formats); + default = defaultFormat; + }; + package = mkOption { + description = "SQL formatter package"; + type = types.package; + default = formats.${cfg.format.type}.package; + }; + }; + + extraDiagnostics = { + enable = mkOption { + description = "Enable extra SQL diagnostics"; + type = types.bool; + default = config.vim.languages.enableExtraDiagnostics; + }; + types = lib.nvim.types.diagnostics { + langDesc = "SQL"; + inherit diagnostics; + inherit defaultDiagnostics; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + + (mkIf cfg.lsp.enable { + vim.startPlugins = ["sqls-nvim"]; + + vim.lsp.lspconfig.enable = true; + vim.lsp.lspconfig.sources.sql-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + + (mkIf cfg.format.enable { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources."sql-format" = formats.${cfg.format.type}.nullConfig; + }) + + (mkIf cfg.extraDiagnostics.enable { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources = lib.nvim.languages.diagnosticsToLua { + lang = "sql"; + config = cfg.extraDiagnostics.types; + inherit diagnostics; + }; + }) + ]); +} diff --git a/modules/languages/ts.nix b/modules/languages/ts.nix new file mode 100644 index 0000000..318b623 --- /dev/null +++ b/modules/languages/ts.nix @@ -0,0 +1,153 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.ts; + + defaultServer = "tsserver"; + servers = { + tsserver = { + package = pkgs.nodePackages.typescript-language-server; + lspConfig = '' + lspconfig.tsserver.setup { + capabilities = capabilities; + on_attach = attach_keymaps, + cmd = { "${cfg.lsp.package}/bin/typescript-language-server", "--stdio" } + } + ''; + }; + }; + + # TODO: specify packages + defaultFormat = "prettier"; + formats = { + prettier = { + package = pkgs.nodePackages.prettier; + nullConfig = '' + table.insert( + ls_sources, + null_ls.builtins.formatting.prettier.with({ + command = "${cfg.format.package}/bin/prettier", + }) + ) + ''; + }; + }; + + # TODO: specify packages + defaultDiagnostics = ["eslint"]; + diagnostics = { + eslint = { + package = pkgs.nodePackages.eslint; + nullConfig = pkg: '' + table.insert( + ls_sources, + null_ls.builtins.diagnostics.eslint.with({ + command = "${pkg}/bin/eslint", + }) + ) + ''; + }; + }; +in { + options.vim.languages.ts = { + enable = mkEnableOption "SQL language support"; + + treesitter = { + enable = mkOption { + description = "Enable Typescript/Javascript treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + tsPackage = mkOption { + description = "Typescript treesitter grammar to use"; + type = types.package; + default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.tsx; + }; + jsPackage = mkOption { + description = "Javascript treesitter grammar to use"; + type = types.package; + default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.javascript; + }; + }; + + lsp = { + enable = mkOption { + description = "Enable Typescript/Javascript LSP support"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + server = mkOption { + description = "Typescript/Javascript LSP server to use"; + type = with types; enum (attrNames servers); + default = defaultServer; + }; + package = mkOption { + description = "Typescript/Javascript LSP server package"; + type = types.package; + default = servers.${cfg.lsp.server}.package; + }; + }; + + format = { + enable = mkOption { + description = "Enable Typescript/Javascript formatting"; + type = types.bool; + default = config.vim.languages.enableFormat; + }; + type = mkOption { + description = "Typescript/Javascript formatter to use"; + type = with types; enum (attrNames formats); + default = defaultFormat; + }; + package = mkOption { + description = "Typescript/Javascript formatter package"; + type = types.package; + default = formats.${cfg.format.type}.package; + }; + }; + + extraDiagnostics = { + enable = mkOption { + description = "Enable extra Typescript/Javascript diagnostics"; + type = types.bool; + default = config.vim.languages.enableExtraDiagnostics; + }; + types = lib.nvim.types.diagnostics { + langDesc = "Typescript/Javascript"; + inherit diagnostics; + inherit defaultDiagnostics; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.tsPackage cfg.treesitter.jsPackage]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.lspconfig.enable = true; + vim.lsp.lspconfig.sources.ts-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + + (mkIf cfg.format.enable { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources.ts-format = formats.${cfg.format.type}.nullConfig; + }) + + (mkIf cfg.extraDiagnostics.enable { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources = lib.nvim.languages.diagnosticsToLua { + lang = "ts"; + config = cfg.extraDiagnostics.types; + inherit diagnostics; + }; + }) + ]); +} diff --git a/modules/languages/zig.nix b/modules/languages/zig.nix new file mode 100644 index 0000000..8dbcb7f --- /dev/null +++ b/modules/languages/zig.nix @@ -0,0 +1,68 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.zig; +in { + options.vim.languages.zig = { + enable = mkEnableOption "SQL language support"; + + treesitter = { + enable = mkOption { + description = "Enable Zig treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = mkOption { + description = "Zig treesitter grammar to use"; + type = types.package; + default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.zig; + }; + }; + lsp = { + enable = mkOption { + description = "Zig LSP support (zls)"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + package = mkOption { + description = "ZLS package"; + type = types.package; + default = pkgs.nodePackages.pyright; + }; + zigPackage = mkOption { + description = "Zig package used by ZLS"; + type = types.package; + default = pkgs.zig; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.lspconfig.enable = true; + vim.lsp.lspconfig.sources.zig-lsp = '' + lspconfig.zls.setup { + capabilities = capabilities, + on_attach=default_on_attach, + cmd = {"${cfg.lsp.package}/bin/zls"}, + settings = { + ["zls"] = { + zig_exe_path = "${cfg.lsp.zigPackage}/bin/zig", + zig_lib_path = "${cfg.lsp.zigPackage}/lib/zig", + } + } + } + ''; + }) + ]); +} diff --git a/modules/lsp/config.nix b/modules/lsp/config.nix index 581556e..a90bd02 100644 --- a/modules/lsp/config.nix +++ b/modules/lsp/config.nix @@ -1,352 +1,63 @@ { - pkgs, config, lib, + pkgs, ... }: with lib; with builtins; let cfg = config.vim.lsp; + usingNvimCmp = config.vim.autocomplete.enable && config.vim.autocomplete.type == "nvim-cmp"; in { - config = mkIf cfg.enable ( - let - writeIf = cond: msg: - if cond - then msg - else ""; - in { - vim.startPlugins = - [ - "nvim-lspconfig" - "null-ls" - ( - if (config.vim.autocomplete.enable && (config.vim.autocomplete.type == "nvim-cmp")) - then "cmp-nvim-lsp" - else null - ) - ( - if cfg.sql - then "sqls-nvim" - else null - ) - ] - ++ ( - if cfg.rust.enable - then [ - "crates-nvim" - "rust-tools" - ] - else [] - ); + config = mkIf cfg.enable { + vim.startPlugins = optional usingNvimCmp "cmp-nvim-lsp"; - vim.configRC.lsp = nvim.dag.entryAnywhere '' - ${ - if cfg.nix.enable - then '' - autocmd filetype nix setlocal tabstop=2 shiftwidth=2 softtabstop=2 - '' - else "" - } + vim.autocomplete.sources = ["nvim_lsp"]; - ${ - if cfg.clang.c_header - then '' - " c syntax for header (otherwise breaks treesitter highlighting) - " https://www.reddit.com/r/neovim/comments/orfpcd/question_does_the_c_parser_from_nvimtreesitter/ - let g:c_syntax_for_h = 1 - '' - else "" - } - ''; - vim.luaConfigRC.lsp = nvim.dag.entryAnywhere '' + vim.luaConfigRC.lsp-setup = '' + vim.g.formatsave = ${boolToString cfg.formatOnSave}; - local attach_keymaps = function(client, bufnr) - local opts = { noremap=true, silent=true } + local attach_keymaps = function(client, bufnr) + local opts = { noremap=true, silent=true } - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgD', 'lua vim.lsp.buf.declaration()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgd', 'lua vim.lsp.buf.definition()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgt', 'lua vim.lsp.buf.type_definition()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgn', 'lua vim.diagnostic.goto_next()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgp', 'lua vim.diagnostic.goto_prev()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgD', 'lua vim.lsp.buf.declaration()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgd', 'lua vim.lsp.buf.definition()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgt', 'lua vim.lsp.buf.type_definition()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgn', 'lua vim.diagnostic.goto_next()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lgp', 'lua vim.diagnostic.goto_prev()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lwa', 'lua vim.lsp.buf.add_workspace_folder()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lwr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lwl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lwa', 'lua vim.lsp.buf.add_workspace_folder()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lwr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lwl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lh', 'lua vim.lsp.buf.hover()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ls', 'lua vim.lsp.buf.signature_help()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ln', 'lua vim.lsp.buf.rename()', opts) - end + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lh', 'lua vim.lsp.buf.hover()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ls', 'lua vim.lsp.buf.signature_help()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ln', 'lua vim.lsp.buf.rename()', opts) + end - local null_ls = require("null-ls") - local null_helpers = require("null-ls.helpers") - local null_methods = require("null-ls.methods") - - local ls_sources = { - ${writeIf cfg.python - '' - null_ls.builtins.formatting.black.with({ - command = "${pkgs.black}/bin/black", - }), - ''} - - -- Commented out for now - --${writeIf (config.vim.git.enable && config.vim.git.gitsigns.enable) '' - -- null_ls.builtins.code_actions.gitsigns, - --''} - - ${writeIf cfg.sql - '' - null_helpers.make_builtin({ - method = null_methods.internal.FORMATTING, - filetypes = { "sql" }, - generator_opts = { - to_stdin = true, - ignore_stderr = true, - suppress_errors = true, - command = "${pkgs.sqlfluff}/bin/sqlfluff", - args = { - "fix", - "-", - }, - }, - factory = null_helpers.formatter_factory, - }), - - null_ls.builtins.diagnostics.sqlfluff.with({ - command = "${pkgs.sqlfluff}/bin/sqlfluff", - extra_args = {"--dialect", "postgres"} - }), - ''} - - ${writeIf - (cfg.nix.enable - && cfg.nix.server == "rnix" - && cfg.nix.formatter == "alejandra") - '' - null_ls.builtins.formatting.alejandra.with({ - command = "${pkgs.alejandra}/bin/alejandra" - }), - ''} - - ${writeIf cfg.ts - '' - null_ls.builtins.diagnostics.eslint, - null_ls.builtins.formatting.prettier, - ''} - } - - vim.g.formatsave = ${ - if cfg.formatOnSave - then "true" - else "false" - }; - - -- Enable formatting - format_callback = function(client, bufnr) - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = function() - if vim.g.formatsave then - if client.supports_method("textDocument/formatting") then - local params = require'vim.lsp.util'.make_formatting_params({}) - client.request('textDocument/formatting', params, nil, bufnr) - end + -- Enable formatting + format_callback = function(client, bufnr) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + if vim.g.formatsave then + if client.supports_method("textDocument/formatting") then + local params = require'vim.lsp.util'.make_formatting_params({}) + client.request('textDocument/formatting', params, nil, bufnr) end end - }) - end - - default_on_attach = function(client, bufnr) - attach_keymaps(client, bufnr) - format_callback(client, bufnr) - end - - -- Enable null-ls - require('null-ls').setup({ - diagnostics_format = "[#{m}] #{s} (#{c})", - debounce = 250, - default_timeout = 5000, - sources = ls_sources, - on_attach=default_on_attach - }) - - -- Enable lspconfig - local lspconfig = require('lspconfig') - - local capabilities = vim.lsp.protocol.make_client_capabilities() - ${ - let - cfg = config.vim.autocomplete; - in - writeIf cfg.enable ( - if cfg.type == "nvim-cmp" - then '' - capabilities = require('cmp_nvim_lsp').default_capabilities() - '' - else "" - ) - } - - ${writeIf cfg.rust.enable '' - -- Rust config - local rt = require('rust-tools') - - rust_on_attach = function(client, bufnr) - default_on_attach(client, bufnr) - local opts = { noremap=true, silent=true, buffer = bufnr } - vim.keymap.set("n", "ris", rt.inlay_hints.set, opts) - vim.keymap.set("n", "riu", rt.inlay_hints.unset, opts) - vim.keymap.set("n", "rr", rt.runnables.runnables, opts) - vim.keymap.set("n", "rp", rt.parent_module.parent_module, opts) - vim.keymap.set("n", "rm", rt.expand_macro.expand_macro, opts) - vim.keymap.set("n", "rc", rt.open_cargo_toml.open_cargo_toml, opts) - vim.keymap.set("n", "rg", function() rt.crate_graph.view_crate_graph("x11", nil) end, opts) end + }) + end - local rustopts = { - tools = { - autoSetHints = true, - hover_with_actions = false, - inlay_hints = { - only_current_line = false, - } - }, - server = { - capabilities = capabilities, - on_attach = rust_on_attach, - cmd = {"${pkgs.rust-analyzer}/bin/rust-analyzer"}, - settings = { - ${cfg.rust.rustAnalyzerOpts} - } - } - } + default_on_attach = function(client, bufnr) + attach_keymaps(client, bufnr) + format_callback(client, bufnr) + end - require('crates').setup { - null_ls = { - enabled = true, - name = "crates.nvim", - } - } - rt.setup(rustopts) - ''} - - ${optionalString cfg.zig.enable '' - -- Zig config - lspconfig.zls.setup { - capabilities = capabilities, - on_attach=default_on_attach, - cmd = {"${pkgs.zls}/bin/zls"}, - settings = { - ["zls"] = { - zig_exe_path = "${pkgs.zig}/bin/zig", - zig_lib_path = "${pkgs.zig}/lib/zig", - } - } - } - ''} - - ${writeIf cfg.python '' - -- Python config - lspconfig.pyright.setup{ - capabilities = capabilities; - on_attach=default_on_attach; - cmd = {"${pkgs.nodePackages.pyright}/bin/pyright-langserver", "--stdio"} - } - ''} - - ${writeIf cfg.nix.enable ( - (writeIf (cfg.nix.server == "rnix") '' - -- Nix (rnix) config - lspconfig.rnix.setup{ - capabilities = capabilities, - ${writeIf (cfg.nix.formatter == "alejandra") - '' - on_attach = function(client, bufnr) - attach_keymaps(client, bufnr) - end, - ''} - ${writeIf (cfg.nix.formatter == "nixpkgs-fmt") - '' - on_attach = default_on_attach, - ''} - cmd = {"${cfg.nix.pkg}/bin/rnix-lsp"}, - } - '') - + (writeIf (cfg.nix.server == "nil") '' - -- Nix (nil) config - lspconfig.nil_ls.setup{ - capabilities = capabilities, - on_attach=default_on_attach, - cmd = {"${cfg.nix.pkg}/bin/nil"}, - settings = { - ["nil"] = { - ${writeIf (cfg.nix.formatter == "alejandra") - '' - formatting = { - command = {"${pkgs.alejandra}/bin/alejandra", "--quiet"}, - }, - ''} - ${writeIf (cfg.nix.formatter == "nixpkgs-fmt") - '' - formatting = { - command = {"${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt"}, - }, - ''} - }, - }; - } - '') - )} - - - ${writeIf cfg.clang.enable '' - -- CCLS (clang) config - lspconfig.ccls.setup{ - capabilities = capabilities; - on_attach=default_on_attach; - cmd = {"${pkgs.ccls}/bin/ccls"}; - ${ - if cfg.clang.cclsOpts == "" - then "" - else "init_options = ${cfg.clang.cclsOpts}" - } - } - ''} - - ${writeIf cfg.sql '' - -- SQLS config - lspconfig.sqls.setup { - on_attach = function(client) - client.server_capabilities.execute_command = true - on_attach_keymaps(client, bufnr) - require'sqls'.setup{} - end, - cmd = {"${pkgs.sqls}/bin/sqls", "-config", string.format("%s/config.yml", vim.fn.getcwd()) } - } - ''} - - ${writeIf cfg.go '' - -- Go config - lspconfig.gopls.setup { - capabilities = capabilities; - on_attach = default_on_attach; - cmd = {"${pkgs.gopls}/bin/gopls", "serve"}, - } - ''} - - ${writeIf cfg.ts '' - -- TS config - lspconfig.tsserver.setup { - capabilities = capabilities; - on_attach = function(client, bufnr) - attach_keymaps(client, bufnr) - end, - cmd = { "${pkgs.nodePackages.typescript-language-server}/bin/typescript-language-server", "--stdio" } - } - ''} - ''; - } - ); + local capabilities = vim.lsp.protocol.make_client_capabilities() + ${optionalString usingNvimCmp "capabilities = require('cmp_nvim_lsp').default_capabilities()"} + ''; + }; } diff --git a/modules/lsp/default.nix b/modules/lsp/default.nix index db4f027..cd18221 100644 --- a/modules/lsp/default.nix +++ b/modules/lsp/default.nix @@ -4,6 +4,10 @@ ./config.nix ./module.nix + ./lspconfig + ./lspsaga + ./null-ls + # lsp plugins ./lspsaga ./nvim-code-action-menu diff --git a/modules/lsp/flutter-tools-nvim/flutter-tools.nix b/modules/lsp/flutter-tools-nvim/flutter-tools.nix index 2f87c31..9bd460b 100644 --- a/modules/lsp/flutter-tools-nvim/flutter-tools.nix +++ b/modules/lsp/flutter-tools-nvim/flutter-tools.nix @@ -6,6 +6,8 @@ with lib; with builtins; { options.vim.lsp.dart.flutter-tools = { + enable = mkEnableOption "Enable flutter-tools for flutter support"; + color = { enable = mkEnableOption "Whether or mot to highlight color variables at all"; diff --git a/modules/lsp/lspconfig/config.nix b/modules/lsp/lspconfig/config.nix new file mode 100644 index 0000000..70485be --- /dev/null +++ b/modules/lsp/lspconfig/config.nix @@ -0,0 +1,25 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.lsp; +in { + config = mkIf cfg.lspconfig.enable (mkMerge [ + { + vim.lsp.enable = true; + + vim.startPlugins = ["nvim-lspconfig"]; + + vim.luaConfigRC.lspconfig = nvim.dag.entryAfter ["lsp-setup"] '' + local lspconfig = require('lspconfig') + ''; + } + { + vim.luaConfigRC = mapAttrs (_: v: (nvim.dag.entryAfter ["lspconfig"] v)) cfg.lspconfig.sources; + } + ]); +} diff --git a/modules/lsp/lspconfig/default.nix b/modules/lsp/lspconfig/default.nix new file mode 100644 index 0000000..117e4d4 --- /dev/null +++ b/modules/lsp/lspconfig/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./config.nix + ./lspconfig.nix + ]; +} diff --git a/modules/lsp/lspconfig/lspconfig.nix b/modules/lsp/lspconfig/lspconfig.nix new file mode 100644 index 0000000..7bc3dab --- /dev/null +++ b/modules/lsp/lspconfig/lspconfig.nix @@ -0,0 +1,18 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; { + options.vim.lsp.lspconfig = { + enable = mkEnableOption "nvim-lspconfig, also enabled automatically"; + + sources = mkOption { + description = "nvim-lspconfig sources"; + type = with types; attrsOf str; + default = {}; + }; + }; +} diff --git a/modules/lsp/module.nix b/modules/lsp/module.nix index a6b95d9..88a2811 100644 --- a/modules/lsp/module.nix +++ b/modules/lsp/module.nix @@ -1,73 +1,13 @@ { - pkgs, config, lib, + pkgs, ... }: with lib; -with builtins; let - cfg = config.vim.lsp; -in { +with builtins; { options.vim.lsp = { - enable = mkEnableOption "Enable neovim LSP support. Requires language specific LSPs to be anabled to take effect"; - formatOnSave = mkEnableOption "Format on save"; - nix = { - enable = mkEnableOption "Nix LSP"; - server = mkOption { - type = with types; enum ["rnix" "nil"]; - default = "nil"; - description = "Which LSP to use"; - }; - - pkg = mkOption { - type = types.package; - default = - if (cfg.nix.server == "rnix") - then pkgs.rnix-lsp - else pkgs.nil; - description = "The LSP package to use"; - }; - - formatter = mkOption { - type = with types; enum ["nixpkgs-fmt" "alejandra"]; - default = "alejandra"; - description = "Which nix formatter to use"; - }; - }; - rust = { - enable = mkEnableOption "Rust LSP"; - rustAnalyzerOpts = mkOption { - type = types.str; - default = '' - ["rust-analyzer"] = { - experimental = { - procAttrMacros = true, - }, - }, - ''; - description = "Options to pass to rust analyzer"; - }; - }; - python = mkEnableOption "Python LSP"; - clang = { - enable = mkEnableOption "C language LSP"; - c_header = mkEnableOption "C syntax header files"; - cclsOpts = mkOption { - type = types.str; - default = ""; - }; - }; - - dart = { - enable = mkEnableOption "Dart Language LSP"; - flutter-tools = { - enable = mkEnableOption ""; - }; - }; - - sql = mkEnableOption "SQL Language LSP"; - go = mkEnableOption "Go language LSP"; - ts = mkEnableOption "TS language LSP"; - zig.enable = mkEnableOption "Zig language LSP"; + enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options"; + formatOnSave = mkEnableOption "format on save"; }; } diff --git a/modules/lsp/null-ls/config.nix b/modules/lsp/null-ls/config.nix new file mode 100644 index 0000000..7f1289a --- /dev/null +++ b/modules/lsp/null-ls/config.nix @@ -0,0 +1,36 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.lsp; +in { + config = mkIf cfg.null-ls.enable (mkMerge [ + { + vim.lsp.enable = true; + vim.startPlugins = ["null-ls"]; + + vim.luaConfigRC.null_ls-setup = nvim.dag.entryAnywhere '' + local null_ls = require("null-ls") + local null_helpers = require("null-ls.helpers") + local null_methods = require("null-ls.methods") + local ls_sources = {} + ''; + vim.luaConfigRC.null_ls = nvim.dag.entryAfter ["null_ls-setup" "lsp-setup"] '' + require('null-ls').setup({ + diagnostics_format = "[#{m}] #{s} (#{c})", + debounce = 250, + default_timeout = 5000, + sources = ls_sources, + on_attach=default_on_attach + }) + ''; + } + { + vim.luaConfigRC = mapAttrs (_: v: (nvim.dag.entryBetween ["null_ls"] ["null_ls-setup"] v)) cfg.null-ls.sources; + } + ]); +} diff --git a/modules/lsp/null-ls/default.nix b/modules/lsp/null-ls/default.nix new file mode 100644 index 0000000..01e6e59 --- /dev/null +++ b/modules/lsp/null-ls/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./config.nix + ./null-ls.nix + ]; +} diff --git a/modules/lsp/null-ls/null-ls.nix b/modules/lsp/null-ls/null-ls.nix new file mode 100644 index 0000000..b8b661c --- /dev/null +++ b/modules/lsp/null-ls/null-ls.nix @@ -0,0 +1,20 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.lsp; +in { + options.vim.lsp.null-ls = { + enable = mkEnableOption "null-ls, also enabled automatically"; + + sources = mkOption { + description = "null-ls sources"; + type = with types; attrsOf str; + default = {}; + }; + }; +} diff --git a/modules/modules.nix b/modules/modules.nix index 47e9eb8..86d137f 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -30,6 +30,7 @@ ./session ./comments ./projects + ./languages ]; pkgsModule = {config, ...}: { diff --git a/modules/treesitter/config.nix b/modules/treesitter/config.nix index 08acaa0..c38b2b9 100644 --- a/modules/treesitter/config.nix +++ b/modules/treesitter/config.nix @@ -1,4 +1,5 @@ { + pkgs, config, lib, ... @@ -6,59 +7,49 @@ with lib; with builtins; let cfg = config.vim.treesitter; + usingNvimCmp = config.vim.autocomplete.enable && config.vim.autocomplete.type == "nvim-cmp"; in { - config = mkIf cfg.enable ( - let - writeIf = cond: msg: - if cond - then msg - else ""; - in { - vim.startPlugins = [ - "nvim-treesitter" - ( - if cfg.autotagHtml - then "nvim-ts-autotag" - else null - ) - ]; + config = mkIf cfg.enable { + vim.startPlugins = + ["nvim-treesitter"] + ++ optional cfg.autotagHtml "nvim-ts-autotag" + ++ optional usingNvimCmp "cmp-treesitter"; - # For some reason treesitter highlighting does not work on start if this is set before syntax on - vim.configRC.treesitter = writeIf cfg.fold (nvim.dag.entryBefore ["basic"] '' - " Tree-sitter based folding - set foldmethod=expr - set foldexpr=nvim_treesitter#foldexpr() - set nofoldenable - ''); + vim.autocomplete.sources = ["treesitter"]; - vim.luaConfigRC.treesitter = nvim.dag.entryAnywhere '' - -- Treesitter config - require'nvim-treesitter.configs'.setup { - highlight = { - enable = true, - disable = {}, + # For some reason treesitter highlighting does not work on start if this is set before syntax on + vim.configRC.treesitter-fold = mkIf cfg.fold (nvim.dag.entryBefore ["basic"] '' + set foldmethod=expr + set foldexpr=nvim_treesitter#foldexpr() + set nofoldenable + ''); + + vim.luaConfigRC.treesitter = nvim.dag.entryAnywhere '' + require'nvim-treesitter.configs'.setup { + highlight = { + enable = true, + disable = {}, + }, + + auto_install = false, + ensure_installed = {}, + + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", }, + }, - auto_install = false, - ensure_installed = {}, - - incremental_selection = { - enable = true, - keymaps = { - init_selection = "gnn", - node_incremental = "grn", - scope_incremental = "grc", - node_decremental = "grm", - }, - }, - - ${writeIf cfg.autotagHtml '' - autotag = { - enable = true, - }, - ''} - } - ''; - } - ); + ${optionalString cfg.autotagHtml '' + autotag = { + enable = true, + }, + ''} + } + ''; + }; } diff --git a/modules/treesitter/treesitter.nix b/modules/treesitter/treesitter.nix index ab3cea6..a1928a5 100644 --- a/modules/treesitter/treesitter.nix +++ b/modules/treesitter/treesitter.nix @@ -5,51 +5,23 @@ ... }: with lib; -with builtins; { +with builtins; let + cfg = config.vim.treesitter; + usingNvimCmp = config.vim.autocomplete.enable && config.vim.autocomplete.type == "nvim-cmp"; +in { options.vim.treesitter = { - enable = mkOption { - default = false; - type = types.bool; - description = "Enable tree-sitter [nvim-treesitter]"; - }; + enable = mkEnableOption "treesitter, also enabled automatically through language options"; - fold = mkOption { - default = false; - type = types.bool; - description = "Enable fold with tree-sitter"; - }; + fold = mkEnableOption "fold with treesitter"; - autotagHtml = mkOption { - default = false; - type = types.bool; - description = "Enable autoclose and rename html tag [nvim-ts-autotag]"; - }; + autotagHtml = mkEnableOption "autoclose and rename html tag"; grammars = mkOption { type = with types; listOf package; - default = with (pkgs.vimPlugins.nvim-treesitter.builtGrammars); - [ - c - cpp - nix - python - rust - markdown - comment - toml - make - tsx - html - javascript - css - graphql - json - zig - ] - ++ (optional config.vim.notes.orgmode.enable org); # add orgmode grammar if enabled + default = []; description = '' - List of treesitter grammars to install. - When enabling a language, its treesitter grammar is added for you. + List of treesitter grammars to install. For supported languages + use the `vim.language..treesitter` option ''; }; }; From ba463a3bdf7c92e10dbc9008e1d584fba20b8cdd Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 17 Apr 2023 23:58:07 +0300 Subject: [PATCH 13/33] feat: bump flake inputs --- flake.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index fa55e41..f28d95b 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "alpha-nvim": { "flake": false, "locked": { - "lastModified": 1679422215, - "narHash": "sha256-jNJ/0ueUXgArpWHypIkNA4hKrwYjthva7gK9JuE4VWM=", + "lastModified": 1681755353, + "narHash": "sha256-yiwFWoz7C+VYL0hrDobTINE4K1v4sbB8koZuURAKlzw=", "owner": "goolord", "repo": "alpha-nvim", - "rev": "dafa11a6218c2296df044e00f88d9187222ba6b0", + "rev": "87c204040e3f5d4c1c95067b35905d8f8a2f2545", "type": "github" }, "original": { @@ -195,11 +195,11 @@ "colorizer": { "flake": false, "locked": { - "lastModified": 1681740520, - "narHash": "sha256-OBL10BJrZuOaauRdCjZxUiUSWgTN3VJARQCqWwx0tlg=", + "lastModified": 1681750992, + "narHash": "sha256-TXKYJY4+ozr54jBa3rUuJuO1Y4nrHfsX0yrQs3wtMDQ=", "owner": "uga-rosa", "repo": "ccc.nvim", - "rev": "1c96900635c23b48ac7993d257e8dc9ec382196a", + "rev": "a4a79302c2389f6852b1a655b47ea2edecccb081", "type": "github" }, "original": { @@ -707,11 +707,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1681693905, - "narHash": "sha256-XdXMvCt+i2ZcmAIPZvu3RUwcdaC9OX7d1WMAJJokzeA=", + "lastModified": 1681723626, + "narHash": "sha256-lu9vrGVzptuG+DyR1iaFnIHkliwEdOLPTT/IsZND+Cg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "db34d7561caa508ece0265a56f382c5d3b7a6c1b", + "rev": "269c677b54ea828a9f0f4cb02f4beee9c95a2284", "type": "github" }, "original": { @@ -1095,11 +1095,11 @@ "obsidian-nvim": { "flake": false, "locked": { - "lastModified": 1680635774, - "narHash": "sha256-tkOksS2jAz9VjfBq/PtanxuWtKFEQxLbEFuLXUP5cKQ=", + "lastModified": 1681757981, + "narHash": "sha256-7L/C/BKDCaYFJspEnOesrsCfOFe4XxxEiTlVh4ntT+Q=", "owner": "epwalsh", "repo": "obsidian.nvim", - "rev": "d2433fba40bb023f4b05ff2f51590f415be1eb71", + "rev": "9dd19303aea80ff10b53de6879d973256125e395", "type": "github" }, "original": { From fdca3b1e7e66ffe8d499ea661037dbb1aec3be83 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 00:38:57 +0300 Subject: [PATCH 14/33] feat(languages: move markdown and tidal to languages module) --- extra.nix | 6 +++- modules/languages/default.nix | 3 ++ modules/languages/markdown/config.nix | 24 ++++++++++++++ modules/{ => languages}/markdown/default.nix | 3 +- modules/languages/markdown/markdown.nix | 20 ++++++++++++ modules/languages/nix.nix | 2 +- modules/{ => languages}/tidal/config.nix | 0 modules/{ => languages}/tidal/default.nix | 0 modules/{ => languages}/tidal/tidal.nix | 0 modules/lsp/default.nix | 2 +- modules/markdown/config.nix | 12 ------- modules/markdown/glow/config.nix | 33 -------------------- modules/markdown/glow/default.nix | 6 ---- modules/markdown/glow/glow.nix | 33 -------------------- modules/markdown/module.nix | 19 ----------- modules/modules.nix | 2 -- modules/utility/binds/which-key/config.nix | 2 +- 17 files changed, 56 insertions(+), 111 deletions(-) create mode 100644 modules/languages/markdown/config.nix rename modules/{ => languages}/markdown/default.nix (62%) create mode 100644 modules/languages/markdown/markdown.nix rename modules/{ => languages}/tidal/config.nix (100%) rename modules/{ => languages}/tidal/default.nix (100%) rename modules/{ => languages}/tidal/tidal.nix (100%) delete mode 100644 modules/markdown/config.nix delete mode 100644 modules/markdown/glow/config.nix delete mode 100644 modules/markdown/glow/default.nix delete mode 100644 modules/markdown/glow/glow.nix delete mode 100644 modules/markdown/module.nix diff --git a/extra.nix b/extra.nix index 5fba36b..f7e48d5 100644 --- a/extra.nix +++ b/extra.nix @@ -13,6 +13,10 @@ inputs: let configuration.imports = modules; }; + tidalConfig = { + config.vim.languages.tidal.enable = true; + }; + mainConfig = isMaximal: { config = { vim = { @@ -191,5 +195,5 @@ inputs: let }; }; in { - inherit neovimConfiguration mainConfig; + inherit neovimConfiguration mainConfig tidalConfig; } diff --git a/modules/languages/default.nix b/modules/languages/default.nix index 3b26e35..5e370cc 100644 --- a/modules/languages/default.nix +++ b/modules/languages/default.nix @@ -8,6 +8,9 @@ with lib; let }; in { imports = [ + ./markdown + ./tidal + ./clang.nix ./go.nix ./nix.nix diff --git a/modules/languages/markdown/config.nix b/modules/languages/markdown/config.nix new file mode 100644 index 0000000..8f6e626 --- /dev/null +++ b/modules/languages/markdown/config.nix @@ -0,0 +1,24 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.markdown; +in { + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.glow.enable { + vim.startPlugins = ["glow-nvim"]; + + vim.globals = { + "glow_binary_path" = "${pkgs.glow}/bin"; + }; + + vim.configRC.glow = nvim.dag.entryAnywhere '' + autocmd FileType markdown noremap p :Glow + ''; + }) + ]); +} diff --git a/modules/markdown/default.nix b/modules/languages/markdown/default.nix similarity index 62% rename from modules/markdown/default.nix rename to modules/languages/markdown/default.nix index e975149..3834589 100644 --- a/modules/markdown/default.nix +++ b/modules/languages/markdown/default.nix @@ -1,7 +1,6 @@ {...}: { imports = [ - ./glow ./config.nix - ./module.nix + ./markdown.nix ]; } diff --git a/modules/languages/markdown/markdown.nix b/modules/languages/markdown/markdown.nix new file mode 100644 index 0000000..706bf5d --- /dev/null +++ b/modules/languages/markdown/markdown.nix @@ -0,0 +1,20 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.markdown; +in { + options.vim.languages.markdown = { + enable = mkEnableOption "Markdown language support"; + + glow.enable = mkOption { + type = types.bool; + default = true; + description = "Enable markdown preview in neovim with glow"; + }; + }; +} diff --git a/modules/languages/nix.nix b/modules/languages/nix.nix index 5063f6b..f7273ac 100644 --- a/modules/languages/nix.nix +++ b/modules/languages/nix.nix @@ -8,7 +8,7 @@ with lib; with builtins; let cfg = config.vim.languages.nix; - useFormat = "on_attach = default_on_attatch"; + useFormat = "on_attach = default_on_attach"; noFormat = "on_attach = attach_keymaps"; defaultServer = "nil"; diff --git a/modules/tidal/config.nix b/modules/languages/tidal/config.nix similarity index 100% rename from modules/tidal/config.nix rename to modules/languages/tidal/config.nix diff --git a/modules/tidal/default.nix b/modules/languages/tidal/default.nix similarity index 100% rename from modules/tidal/default.nix rename to modules/languages/tidal/default.nix diff --git a/modules/tidal/tidal.nix b/modules/languages/tidal/tidal.nix similarity index 100% rename from modules/tidal/tidal.nix rename to modules/languages/tidal/tidal.nix diff --git a/modules/lsp/default.nix b/modules/lsp/default.nix index cd18221..16b7f47 100644 --- a/modules/lsp/default.nix +++ b/modules/lsp/default.nix @@ -4,7 +4,7 @@ ./config.nix ./module.nix - ./lspconfig + ./lspconfig ./lspsaga ./null-ls diff --git a/modules/markdown/config.nix b/modules/markdown/config.nix deleted file mode 100644 index c8929ce..0000000 --- a/modules/markdown/config.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; { - config = { - vim.markdown = { - enable = mkDefault false; - }; - }; -} diff --git a/modules/markdown/glow/config.nix b/modules/markdown/glow/config.nix deleted file mode 100644 index f0019f2..0000000 --- a/modules/markdown/glow/config.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.vim.markdown.glow; -in { - config = (mkIf cfg.enable) { - vim.startPlugins = [ - "glow-nvim" - ]; - - vim.globals = { - "glow_binary_path" = "${pkgs.glow}/bin"; - }; - - vim.configRC.glow-nvim = nvim.dag.entryAnywhere '' - autocmd FileType markdown noremap pm :Glow - ''; - - vim.luaConfigRC.glow-nvim = nvim.dag.entryAnywhere '' - require('glow').setup({ - -- use glow path from vim.globals - path = vim.g.glow_binary_path, - border = "${toString cfg.border}", - pager = ${boolToString cfg.pager}, - width = 120, - }) - ''; - }; -} diff --git a/modules/markdown/glow/default.nix b/modules/markdown/glow/default.nix deleted file mode 100644 index 9b128a3..0000000 --- a/modules/markdown/glow/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -_: { - imports = [ - ./glow.nix - ./config.nix - ]; -} diff --git a/modules/markdown/glow/glow.nix b/modules/markdown/glow/glow.nix deleted file mode 100644 index ad20b65..0000000 --- a/modules/markdown/glow/glow.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; -with builtins; { - options.vim.markdown.glow = { - enable = mkOption { - type = types.bool; - default = false; - description = "Enable markdown preview in neovim with glow"; - }; - border = mkOption { - type = types.enum ["shadow" "rounded" "single" "double" "none"]; - default = "double"; - description = "Border style for glow preview"; - }; - - # style should be either light or dark - style = mkOption { - type = types.enum ["light" "dark"]; - default = "dark"; - description = "Style for glow preview"; - }; - - pager = mkOption { - type = types.bool; - default = false; - description = "Enable pager for glow preview"; - }; - }; -} diff --git a/modules/markdown/module.nix b/modules/markdown/module.nix deleted file mode 100644 index 761f58c..0000000 --- a/modules/markdown/module.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; -with builtins; let - cfg = config.vim.markdown; -in { - options.vim.markdown = { - enable = mkEnableOption "Enable markdown tools and plugins"; - }; - - config = mkIf (cfg.enable) { - /* - ... - */ - }; -} diff --git a/modules/modules.nix b/modules/modules.nix index 86d137f..a23241c 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -14,10 +14,8 @@ ./visuals ./lsp ./treesitter - ./tidal ./autopairs ./snippets - ./markdown ./git ./minimap ./dashboard diff --git a/modules/utility/binds/which-key/config.nix b/modules/utility/binds/which-key/config.nix index e2f5ae1..2a7b4b8 100644 --- a/modules/utility/binds/which-key/config.nix +++ b/modules/utility/binds/which-key/config.nix @@ -106,7 +106,7 @@ in { } ${ - if config.vim.markdown.glow.enable + if config.vim.languages.markdown.glow.enable then '' -- Markdown ["pm"] = { name = "+Preview Markdown" }, From 84ecf8f3fd87d92ec6dc8866a2042291325c8a7a Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 00:55:12 +0300 Subject: [PATCH 15/33] feat: gitsigns-codeactions --- modules/git/config.nix | 59 +++++++++++++++++++++++++++++++++++++----- modules/git/git.nix | 53 +++++-------------------------------- 2 files changed, 58 insertions(+), 54 deletions(-) diff --git a/modules/git/config.nix b/modules/git/config.nix index ae2c1b4..fffda35 100644 --- a/modules/git/config.nix +++ b/modules/git/config.nix @@ -1,13 +1,58 @@ { + pkgs, config, lib, ... }: -with lib; { - config = { - vim.git = { - enable = mkDefault false; - gitsigns.enable = mkDefault false; - }; - }; +with lib; +with builtins; let + cfg = config.vim.git; +in { + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.gitsigns.enable (mkMerge [ + { + vim.startPlugins = ["gitsigns-nvim"]; + + vim.luaConfigRC.gitsigns = nvim.dag.entryAnywhere '' + require('gitsigns').setup { + keymaps = { + noremap = true, + + ['n gn'] = { expr = true, "&diff ? \'\' : 'Gitsigns next_hunk'"}, + ['n gp'] = { expr = true, "&diff ? \'\' : 'Gitsigns prev_hunk'"}, + + ['n gs'] = 'Gitsigns stage_hunk', + ['v gs'] = ':Gitsigns stage_hunk', + ['n gu'] = 'Gitsigns undo_stage_hunk', + ['n gr'] = 'Gitsigns reset_hunk', + ['v gr'] = ':Gitsigns reset_hunk', + ['n gR'] = 'Gitsigns reset_buffer', + ['n gp'] = 'Gitsigns preview_hunk', + ['n gb'] = 'lua require"gitsigns".blame_line{full=true}', + ['n gS'] = 'Gitsigns stage_buffer', + ['n gU'] = 'Gitsigns reset_buffer_index', + ['n gts'] = ':Gitsigns toggle_signs', + ['n gtn'] = ':Gitsigns toggle_numhl', + ['n gtl'] = ':Gitsigns toggle_linehl', + ['n gtw'] = ':Gitsigns toggle_word_diff', + + -- Text objects + ['o ih'] = ':Gitsigns select_hunk', + ['x ih'] = ':Gitsigns select_hunk' + }, + } + ''; + } + + (mkIf cfg.gitsigns.codeActions { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources.gitsigns-ca = '' + table.insert( + ls_sources, + null_ls.builtins.code_actions.gitsigns + ) + ''; + }) + ])) + ]); } diff --git a/modules/git/git.nix b/modules/git/git.nix index e9af83b..80da18c 100644 --- a/modules/git/git.nix +++ b/modules/git/git.nix @@ -1,4 +1,5 @@ { + pkgs, config, lib, ... @@ -8,54 +9,12 @@ with builtins; let cfg = config.vim.git; in { options.vim.git = { - enable = mkOption { - type = types.bool; - description = "Enable git plugins"; - }; + enable = mkEnableOption "Git support"; - gitsigns.enable = mkOption { - type = types.bool; - description = "Enable git options"; + gitsigns = { + enable = mkEnableOption "gitsigns"; + + codeActions = mkEnableOption "gitsigns codeactions through null-ls"; }; }; - - config = - mkIf cfg.enable - { - vim.startPlugins = - if (cfg.gitsigns.enable) - then ["gitsigns-nvim"] - else []; - - vim.luaConfigRC.gitsigns = mkIf (cfg.gitsigns.enable) (nvim.dag.entryAnywhere '' - -- GitSigns setup - require('gitsigns').setup { - keymaps = { - noremap = true, - - ['n gn'] = { expr = true, "&diff ? \'\' : 'Gitsigns next_hunk'"}, - ['n gp'] = { expr = true, "&diff ? \'\' : 'Gitsigns prev_hunk'"}, - - ['n gs'] = 'Gitsigns stage_hunk', - ['v gs'] = ':Gitsigns stage_hunk', - ['n gu'] = 'Gitsigns undo_stage_hunk', - ['n gr'] = 'Gitsigns reset_hunk', - ['v gr'] = ':Gitsigns reset_hunk', - ['n gR'] = 'Gitsigns reset_buffer', - ['n gp'] = 'Gitsigns preview_hunk', - ['n gb'] = 'lua require"gitsigns".blame_line{full=true}', - ['n gS'] = 'Gitsigns stage_buffer', - ['n gU'] = 'Gitsigns reset_buffer_index', - ['n gts'] = ':Gitsigns toggle_signs', - ['n gtn'] = ':Gitsigns toggle_numhl', - ['n gtl'] = ':Gitsigns toggle_linehl', - ['n gtw'] = ':Gitsigns toggle_word_diff', - - -- Text objects - ['o ih'] = ':Gitsigns select_hunk', - ['x ih'] = ':Gitsigns select_hunk' - }, - } - ''); - }; } From 544792e0b99229f7e8ed2e0674c2e9d3e58d78db Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 00:55:27 +0300 Subject: [PATCH 16/33] feat: use mkGrammarOption --- extra.nix | 1 + lib/types/default.nix | 2 +- lib/types/languages.nix | 5 +++++ modules/languages/clang.nix | 12 ++---------- modules/languages/default.nix | 2 +- modules/languages/go.nix | 6 +----- modules/languages/markdown/config.nix | 5 +++++ modules/languages/markdown/markdown.nix | 9 +++++++++ modules/languages/nix.nix | 6 +----- modules/languages/python.nix | 6 +----- modules/languages/rust.nix | 6 +----- modules/languages/ts.nix | 12 ++---------- modules/languages/zig.nix | 6 +----- 13 files changed, 31 insertions(+), 47 deletions(-) diff --git a/extra.nix b/extra.nix index f7e48d5..2880d5b 100644 --- a/extra.nix +++ b/extra.nix @@ -115,6 +115,7 @@ inputs: let vim.git = { enable = true; gitsigns.enable = true; + gitsigns.codeActions = true; }; vim.minimap = { diff --git a/lib/types/default.nix b/lib/types/default.nix index 6317160..6d5777d 100644 --- a/lib/types/default.nix +++ b/lib/types/default.nix @@ -5,5 +5,5 @@ in { inherit (typesDag) dagOf; inherit (typesPlugin) pluginsOpt; - inherit (typesLanguage) diagnostics; + inherit (typesLanguage) diagnostics mkGrammarOption; } diff --git a/lib/types/languages.nix b/lib/types/languages.nix index 7dc57af..577db50 100644 --- a/lib/types/languages.nix +++ b/lib/types/languages.nix @@ -23,4 +23,9 @@ in { type = with types; listOf (either (enum (attrNames diagnostics)) (submodule diagnosticSubmodule)); default = defaultDiagnostics; }; + + mkGrammarOption = pkgs: grammar: + mkPackageOption pkgs ["${grammar} treesitter"] { + default = ["vimPlugins" "nvim-treesitter" "builtGrammars" grammar]; + }; } diff --git a/modules/languages/clang.nix b/modules/languages/clang.nix index 4514329..a9d1191 100644 --- a/modules/languages/clang.nix +++ b/modules/languages/clang.nix @@ -41,16 +41,8 @@ in { type = types.bool; default = config.vim.languages.enableTreesitter; }; - cPackage = mkOption { - description = "C treesitter grammar to use"; - type = types.package; - default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.c; - }; - cppPackage = mkOption { - description = "C++ treesitter grammar to use"; - type = types.package; - default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.cpp; - }; + cPackage = nvim.types.mkGrammarOption pkgs "c"; + cppPackage = nvim.types.mkGrammarOption pkgs "cpp"; }; lsp = { diff --git a/modules/languages/default.nix b/modules/languages/default.nix index 5e370cc..ee7cb4c 100644 --- a/modules/languages/default.nix +++ b/modules/languages/default.nix @@ -8,7 +8,7 @@ with lib; let }; in { imports = [ - ./markdown + ./markdown ./tidal ./clang.nix diff --git a/modules/languages/go.nix b/modules/languages/go.nix index 0ceb111..f63a6f4 100644 --- a/modules/languages/go.nix +++ b/modules/languages/go.nix @@ -31,11 +31,7 @@ in { type = types.bool; default = config.vim.languages.enableTreesitter; }; - package = mkOption { - description = "Go treesitter grammar to use"; - type = types.package; - default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.go; - }; + package = nvim.types.mkGrammarOption pkgs "go"; }; lsp = { diff --git a/modules/languages/markdown/config.nix b/modules/languages/markdown/config.nix index 8f6e626..bf0ef5a 100644 --- a/modules/languages/markdown/config.nix +++ b/modules/languages/markdown/config.nix @@ -9,6 +9,11 @@ with builtins; let cfg = config.vim.languages.markdown; in { config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + (mkIf cfg.glow.enable { vim.startPlugins = ["glow-nvim"]; diff --git a/modules/languages/markdown/markdown.nix b/modules/languages/markdown/markdown.nix index 706bf5d..41ab653 100644 --- a/modules/languages/markdown/markdown.nix +++ b/modules/languages/markdown/markdown.nix @@ -16,5 +16,14 @@ in { default = true; description = "Enable markdown preview in neovim with glow"; }; + + treesitter = { + enable = mkOption { + description = "Enable Markdown treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = nvim.types.mkGrammarOption pkgs "markdown"; + }; }; } diff --git a/modules/languages/nix.nix b/modules/languages/nix.nix index f7273ac..3313c34 100644 --- a/modules/languages/nix.nix +++ b/modules/languages/nix.nix @@ -92,11 +92,7 @@ in { type = types.bool; default = config.vim.languages.enableTreesitter; }; - package = mkOption { - description = "Nix treesitter grammar to use"; - type = types.package; - default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.nix; - }; + package = nvim.types.mkGrammarOption pkgs "nix"; }; lsp = { diff --git a/modules/languages/python.nix b/modules/languages/python.nix index c2cabda..ab80ca6 100644 --- a/modules/languages/python.nix +++ b/modules/languages/python.nix @@ -64,11 +64,7 @@ in { type = with types; enum (attrNames servers); default = defaultServer; }; - package = mkOption { - description = "Python LSP server package"; - type = types.package; - default = servers.${cfg.lsp.server}.package; - }; + package = nvim.types.mkGrammarOption pkgs "python"; }; format = { diff --git a/modules/languages/rust.nix b/modules/languages/rust.nix index b58d885..8c330b3 100644 --- a/modules/languages/rust.nix +++ b/modules/languages/rust.nix @@ -17,11 +17,7 @@ in { type = types.bool; default = config.vim.languages.enableTreesitter; }; - package = mkOption { - description = "Rust treesitter grammar to use"; - type = types.package; - default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.rust; - }; + package = nvim.types.mkGrammarOption pkgs "rust"; }; crates = { diff --git a/modules/languages/ts.nix b/modules/languages/ts.nix index 318b623..d1c9796 100644 --- a/modules/languages/ts.nix +++ b/modules/languages/ts.nix @@ -63,16 +63,8 @@ in { type = types.bool; default = config.vim.languages.enableTreesitter; }; - tsPackage = mkOption { - description = "Typescript treesitter grammar to use"; - type = types.package; - default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.tsx; - }; - jsPackage = mkOption { - description = "Javascript treesitter grammar to use"; - type = types.package; - default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.javascript; - }; + tsPackage = nvim.types.mkGrammarOption pkgs "tsx"; + jsPackage = nvim.types.mkGrammarOption pkgs "javascript"; }; lsp = { diff --git a/modules/languages/zig.nix b/modules/languages/zig.nix index 8dbcb7f..0ce85db 100644 --- a/modules/languages/zig.nix +++ b/modules/languages/zig.nix @@ -17,11 +17,7 @@ in { type = types.bool; default = config.vim.languages.enableTreesitter; }; - package = mkOption { - description = "Zig treesitter grammar to use"; - type = types.package; - default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.zig; - }; + package = nvim.types.mkGrammarOption pkgs "zig"; }; lsp = { enable = mkOption { From 1829e321b5f56038b17479cfaecca74c28b112ae Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 00:59:23 +0300 Subject: [PATCH 17/33] feat: yoink asciidoc from nmd --- lib/default.nix | 1 + lib/nmd.nix | 17 +++++++++++++++++ .../autopairs/nvim-autopairs/nvim-autopairs.nix | 2 +- modules/treesitter/treesitter.nix | 2 +- 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 lib/nmd.nix diff --git a/lib/default.nix b/lib/default.nix index e7b721b..37840c1 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -3,4 +3,5 @@ booleans = import ./booleans.nix {inherit lib;}; types = import ./types {inherit lib;}; languages = import ./languages.nix {inherit lib;}; + nmd = import ./nmd.nix; } diff --git a/lib/nmd.nix b/lib/nmd.nix new file mode 100644 index 0000000..fd945f1 --- /dev/null +++ b/lib/nmd.nix @@ -0,0 +1,17 @@ +# Copied from nmd master: https://gitlab.com/rycee/nmd/-/blob/master/default.nix?ref_type=heads +# Allows asciiDoc in options. It is easier to copy & keep updated then figure out how to pass the nmd input +# along to user modules +{ + # Indicates that the given text should be interpreted as AsciiDoc markup. + asciiDoc = text: { + _type = "asciiDoc"; + inherit text; + }; + + # Indicates that the given text should be interpreted as AsciiDoc markup and + # used in a literal context. + literalAsciiDoc = text: { + _type = "literalAsciiDoc"; + inherit text; + }; +} diff --git a/modules/autopairs/nvim-autopairs/nvim-autopairs.nix b/modules/autopairs/nvim-autopairs/nvim-autopairs.nix index ecfda6f..1b3f8b7 100644 --- a/modules/autopairs/nvim-autopairs/nvim-autopairs.nix +++ b/modules/autopairs/nvim-autopairs/nvim-autopairs.nix @@ -23,7 +23,7 @@ with builtins; { map_cr = mkOption { type = types.bool; default = true; - description = "map on insert mode"; + description = nvim.nmd.asciiDoc ''map on insert mode''; }; map_complete = mkOption { diff --git a/modules/treesitter/treesitter.nix b/modules/treesitter/treesitter.nix index a1928a5..84a09ea 100644 --- a/modules/treesitter/treesitter.nix +++ b/modules/treesitter/treesitter.nix @@ -19,7 +19,7 @@ in { grammars = mkOption { type = with types; listOf package; default = []; - description = '' + description = nvim.nmd.asciiDoc '' List of treesitter grammars to install. For supported languages use the `vim.language..treesitter` option ''; From 7355debede2f2c286804e9754b2f1889216bea0d Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 01:05:18 +0300 Subject: [PATCH 18/33] feat: move html into languages --- extra.nix | 1 + flake/overlays.nix | 7 +++++- modules/languages/default.nix | 1 + modules/languages/html.nix | 42 +++++++++++++++++++++++++++++++++++ modules/lsp/default.nix | 2 +- modules/treesitter/config.nix | 7 ------ 6 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 modules/languages/html.nix diff --git a/extra.nix b/extra.nix index 2880d5b..c1d444f 100644 --- a/extra.nix +++ b/extra.nix @@ -36,6 +36,7 @@ inputs: let enableExtraDiagnostics = true; nix.enable = true; + html.enable = isMaximal; clang.enable = isMaximal; sql.enable = isMaximal; rust = { diff --git a/flake/overlays.nix b/flake/overlays.nix index 1850a91..8a2dfb8 100644 --- a/flake/overlays.nix +++ b/flake/overlays.nix @@ -1,4 +1,8 @@ -{inputs, ...}: let +{ + inputs, + pkgs, + ... +}: let inherit (import ../extra.nix inputs) neovimConfiguration mainConfig; buildPkg = pkgs: modules: @@ -14,5 +18,6 @@ in { neovim-nix = buildPkg prev [nixConfig]; neovim-maximal = buildPkg prev [maximalConfig]; neovim-tidal = buildPkg prev [tidalConfig]; + devPkg = buildPkg pkgs [nixConfig {config.vim.languages.html.enable = pkgs.lib.mkForce true;}]; }; } diff --git a/modules/languages/default.nix b/modules/languages/default.nix index ee7cb4c..3708737 100644 --- a/modules/languages/default.nix +++ b/modules/languages/default.nix @@ -19,6 +19,7 @@ in { ./sql.nix ./ts.nix ./zig.nix + ./html.nix ]; options.vim.languages = { diff --git a/modules/languages/html.nix b/modules/languages/html.nix new file mode 100644 index 0000000..b897e1c --- /dev/null +++ b/modules/languages/html.nix @@ -0,0 +1,42 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.html; +in { + options.vim.languages.html = { + enable = mkEnableOption "HTML language support"; + + treesitter = { + enable = mkOption { + description = "Enable HTML treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = nvim.types.mkGrammarOption pkgs "html"; + + autotagHtml = mkOption { + description = "Enable autoclose/autorename of html tags (nvim-ts-autotag)"; + type = types.bool; + default = true; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + + vim.startPlugins = optional cfg.treesitter.autotagHtml "nvim-ts-autotag"; + + vim.luaConfigRC.html-autotag = mkIf cfg.treesitter.autotagHtml (nvim.dag.entryAnywhere '' + require('nvim-ts-autotag').setup() + ''); + }) + ]); +} diff --git a/modules/lsp/default.nix b/modules/lsp/default.nix index 16b7f47..b9a39c6 100644 --- a/modules/lsp/default.nix +++ b/modules/lsp/default.nix @@ -1,4 +1,4 @@ -{...}: { +_: { imports = [ # nvim lsp support ./config.nix diff --git a/modules/treesitter/config.nix b/modules/treesitter/config.nix index c38b2b9..27744ef 100644 --- a/modules/treesitter/config.nix +++ b/modules/treesitter/config.nix @@ -12,7 +12,6 @@ in { config = mkIf cfg.enable { vim.startPlugins = ["nvim-treesitter"] - ++ optional cfg.autotagHtml "nvim-ts-autotag" ++ optional usingNvimCmp "cmp-treesitter"; vim.autocomplete.sources = ["treesitter"]; @@ -43,12 +42,6 @@ in { node_decremental = "grm", }, }, - - ${optionalString cfg.autotagHtml '' - autotag = { - enable = true, - }, - ''} } ''; }; From c8b247b4d6d8c6c5e26b596372c1bd05b4206af4 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 01:10:49 +0300 Subject: [PATCH 19/33] docs: cleanup --- docs/languages.adoc | 76 ++------------ docs/manual.xml | 1 - docs/plugins.adoc | 184 --------------------------------- docs/release-notes/rl-0.3.adoc | 10 ++ 4 files changed, 21 insertions(+), 250 deletions(-) delete mode 100644 docs/plugins.adoc diff --git a/docs/languages.adoc b/docs/languages.adoc index a14e35f..4db7ddb 100644 --- a/docs/languages.adoc +++ b/docs/languages.adoc @@ -1,71 +1,17 @@ [[ch-languages]] == Language Support -Language specific support combines some combination of language specific plugins, `treesitter` support, `nvim-lspconfig` langauge servers, and `null-ls` integration. This gets you capabilities ranging from autocompletion to formatting to diagnostics. The following languages have support beyond just `treesitter` highlighting. +Language specific support means there is a combination of language specific plugins, `treesitter` support, `nvim-lspconfig` language servers, and `null-ls` integration. This gets you capabilities ranging from autocompletion to formatting to diagnostics. The following languages have sections under the `vim.languages` attribute. See the configuration docs for details. -[[sec-languages-rust]] -=== Rust +* Rust: <> +* Nix: <> +* SQL: <> +* C/C++: <> +* Typescript/Javascript: <> +* Python: <>: +* Zig: <> +* Markdown: <> +* HTML: <> -*LSP Server*: https://github.com/rust-analyzer/rust-analyzer[rust-analyzer] +Adding support for more languages, and improving support for existing ones are great places where you can contribute with a PR. -*Formatting*: Built into LSP, uses https://github.com/rust-lang/rustfmt[rustfmt] - -*Plugins*: See <> - -[[sec-languages-nix]] -=== Nix - -*LSP Server*: Choice between https://github.com/oxalica/nil[nil] and https://github.com/nix-community/rnix-lsp[rnix-lsp] - -*Formatting*: Choice between https://github.com/kamadorueda/alejandra[alejandra] and https://github.com/nix-community/nixpkgs-fmt[nixpkgs-fmt] - -[[sec-languages-sql]] -=== SQL - -*LSP Server*: https://github.com/lighttiger2505/sqls[sqls] - -*Formatting*: Disabled LSP formatting, instead using https://github.com/sqlfluff/sqlfluff[sqlfluff] - -*Linting*: https://github.com/sqlfluff/sqlfluff[sqlfluff] - -*Plugins*: See <> - -[[sec-languages-clang]] -=== C/C++ - -*LSP Server*: https://github.com/MaskRay/ccls[ccls] - -*Formatting*: Built into language server - -[[sec-languages-typescript]] -=== Typescript - -*LSP Server*: https://github.com/typescript-language-server/typescript-language-server[typescript-language-server] - -*Formatting*: Disabled LSP formatting, instead using https://github.com/prettier/prettier[prettier] - -*Linting*: https://github.com/prettier/prettier[eslint] - -[[sec-languages-python]] -=== Python - -*LSP Server*: https://github.com/microsoft/pyright[pyright] - -*Formatting*: https://github.com/psf/black[black] - -[[sec-languages-zig]] -=== Zig - -*LSP Server*: https://github.com/zigtools/zls[zls] - -*Formatting*: Built into LSP, uses `zig fmt`. - -[[sec-languages-markdown]] -=== Markdown - -*Plugins*: See <> - -[[sec-languages-html]] -=== HTML - -*Plugins*: See <> diff --git a/docs/manual.xml b/docs/manual.xml index a03698f..3f01228 100644 --- a/docs/manual.xml +++ b/docs/manual.xml @@ -21,7 +21,6 @@ - Configuration Options diff --git a/docs/plugins.adoc b/docs/plugins.adoc deleted file mode 100644 index 12e6f50..0000000 --- a/docs/plugins.adoc +++ /dev/null @@ -1,184 +0,0 @@ -[[ch-plugins]] -== Plugins - -The following are the neovim plugins used within neovim-flake. Some plugins are explicitly enabled by the user, while others are enabled implicitly. - -[[sec-plugins-autopairs]] -=== Autopairs - -* https://github.com/windwp/nvim-autopairs[nvim-autopairs] an autopair plugin for neovim - - -[[sec-plugins-assistant]] -=== Coding Assistants - -* https://github.com/zbirenbaum/copilot.lua[copilot.lua] a lua replacement for github.vim, the license nightmare AI assistant -* https://github.com/codota/tabnine-nvim[tabnine-nvim] neovim plugin for the more ethically acceptable AI assistant TabNine - -[[sec-plugins-buffer]] -=== Buffers - -* https://github.com/akinsho/bufferline.nvim[nvim-bufferline-lua] a buffer line with tab integration -* https://github.com/famiu/bufdelete.nvim[bufdelete-nvim] delete buffers without losing window layout - -[[sec-plugins-commenting]] -=== Commenting - -* https://github.com/b3nj5m1n/kommentary[kommentary] neovim plugin to comment text in and out, written in lua. Supports commenting out the current line, a visual selection and a motion -* https://github.com/folke/todo-comments.nvim[todo-comments.nvim] plugin to highlight and search for todo comments like TODO, HACK, BUG in your codebase - -[[sec-plugins-completions]] -=== Completions - -* https://github.com/hrsh7th/nvim-cmp[nvim-cmp] a completion engine that utilizes sources -** https://github.com/hrsh7th/cmp-buffer[cmp-buffer] a source for buffer words -** https://github.com/hrsh7th/cmp-nvim-lsp[cmp-nvim-lsp] a source for builtin LSP client -** https://github.com/hrsh7th/cmp-vsnip[cmp-vsnip] a source for vim-vsnip autocomplete -** https://github.com/hrsh7th/cmp-path[cmp-path] a source for path autocomplete -** https://github.com/ray-x/cmp-treesitter[cmp-treesitter] treesitter nodes autcomplete - -[[sec-plugins-dashboard]] -=== Dashboard - -* https://github.com/glepnir/dashboard-nvim[dashboard.nvim] fancy and blazing fast start screen plugin for Neovim -* https://github.com/goolord/alpha-nvim[alpha.nvim] a fast and fully programmable greeter for neovim -* https://github.com/mhinz/vim-startify[vim-startify] a fancy start screen for {neo,}vim - -[[sec-plugins-server]] -=== Language Server - -* https://github.com/neovim/nvim-lspconfig[nvim-lspconfig] common configurations for built-in language server -* https://github.com/jose-elias-alvarez/null-ls.nvim[null-ls.nvim] neovim as a language server to inject LSP diagnostics, code actions, etc. -* https://github.com/glepnir/lspsaga.nvim[lspsaga.nvim] useful UI and tools for lsp -* https://github.com/folke/trouble.nvim[trouble.nvim] pretty list of lsp data -* https://github.com/weilbith/nvim-code-action-menu[nvim-code-action-menu] a better code action menu with diff support -* https://github.com/ray-x/lsp_signature.nvim[lsp-signature] show function signatures as you type -* https://github.com/onsails/lspkind-nvim[lspkind-nvim] for pictograms in lsp (with support for nvim-cmp) - - -[[sec-plugins-statuslines]] -=== Statuslines - -* https://github.com/hoob3rt/lualine.nvim[lualine.nvim] statusline written in lua. - -[[sec-plugins-filetrees]] -=== Filetrees - -* https://github.com/kyazdani42/nvim-tree.lua[nvim-tree-lua] a file explorer tree written in lua. Using - -[[sec-plugins-git]] -=== Git - -* https://github.com/lewis6991/gitsigns.nvim[gitsigns.nvim] a variety of git decorations - -[[sec-plugins-treesitter]] -=== Treesitter - -* https://github.com/romgrk/nvim-treesitter-context[nvim-treesitter-context] a context bar using tree-sitter - -[[sec-plugins-visuals]] -=== Visuals - -* https://github.com/lukas-reineke/indent-blankline.nvim[indent-blankline] for indentation guides -* https://github.com/kyazdani42/nvim-web-devicons[nvim-web-devicons] plugins and colors for icons. Requires patched font -* https://github.com/declancm/cinnamon.nvim[cinnamon.nvim] smooth scrolling for ANY movement command -* https://github.com/nvim-cursorline[nvim-cursorline] a plugin for neovim that highlights cursor words and lines -* https://github.com/petertriho/nvim-scrollbar[nvim-scrollbar] a scrollbar plugin for neovim -* https://github.com/Eandrju/cellular-automaton.nvim[cellular-automaton] a vanity to plugin to help you procrastinate more efficiently - -[[sec-plugins-minimap]] -=== Minimap - -* https://github.com/wfxr/minimap.vim[minimap.vim] a blazing fast minimap plugin for neovim. Depends on code-minimap -* https://github.com/gorbit99/codewindow.nvim[codewindow.nvim] a simple, configurable minimap plugin for neovim with no external dependencies - -[[sec-plugins-notifications]] -=== Notifications - -* https://github.com/rcarriga/nvim-notify[nvim-notify] simple notification plugin that also integrates with noice.nvim - -[[sec-plugins-notes]] -=== Note-taking - -* https://github.com/obsidian.nvim[obsidian.nvim] a neovim plugin that deeply integrates with the obsidian markdown editor. Also works standalone -* https://github.com/nvim-orgmode/orgmode[orgmode] a neovim replacement for emac orgmode - -[[sec-plugins-session-management]] -=== Session Management - -* https://github.com/Shatur/neovim-session-manager[neovim-session-manager] a simple wrapper around :mksession - -[[sec-plugins-snippets]] -=== Snippets - -* https://github.com/hrsh7th/vim-vsnip[vim-vsnip] a snippet plugin that supports LSP/VSCode's snippet format - - -[[sec-plugins-terminal]] -=== Terminal - -* https://github.com/akinsho/toggleterm.nvim[toggleterm.nvim] a simple terminal plugin that opens a terminal buffer on demand - -[[sec-plugins-themes]] -=== Themes - -* https://github.com/navarasu/onedark.nvim[onedark] a dark colorscheme with multiple options -* https://github.com/folke/tokyonight.nvim[tokyonight-nvim] a neovim theme with multiple color options -* https://github.com/catppuccin/nvim[catppuccin] a pastel theme with 4 color options - - -[[sec-plugins-utilities]] -=== Utilities - -* https://github.com/nvim-telescope/telescope.nvim[telescope] an extendable fuzzy finder of lists. Working ripgrep and fd -* https://github.com/folke/which-key.nvim[which-key] a popup that displays possible keybindings of command being typed -* https://github.com/sudormrfbin/cheatsheet.nvim[cheatsheet.nvim] a searchable cheatsheet for neovim from within the editor using Telescope -* https://github.com/ga-rosa/ccc.nvim[ccc.nvim] super powerful color picker and colorizer plugin. -* https://github.com/ziontee113/icon-picker.nvim[icon-picker.nvim] an icon picker plugin that provides access to thousands of icons -* https://github.com/jbyuki/venn.nvim[venn.nvim] draw venn diagrams inside neovim - -[[sec-plugins-ui]] -=== UI Elements - -* https://github.com/folke/noice.nvim[noice.nvim] an experimental neovim plugin that replaces some UI components of neovim - - -[[sec-plugins-presence]] -=== Rich Presence - -* https://github.com/andweeb/presence.nvim[presence.nvim] light and powerful discord rich presence plugin - -[[sec-plugins-markdown]] -=== Markdown - -* https://github.com/ellisonleao/glow.nvim[glow.nvim] a markdown preview directly in neovim using glow - -[[sec-plugins-rust]] -=== Rust - -* https://github.com/simrat39/rust-tools.nvim[rust-tools] provides tools for rust -* https://github.com/Saecki/crates.nvim[crates.nvim] provides tools for working with `cargo.toml` - -[[sec-plugins-tidalcycles]] -=== Tidal Cycles - -* https://github.com/tidalcycles/vim-tidal[vim-tidal] for tidal cycles integration into vim - -[[sec-plugins-sql]] -=== SQL - -* https://github.com/nanotee/sqls.nvim[sqls.nvim] for useful actions that leverage `sqls` LSP - -[[sec-plugins-html]] -=== HTML - -* https://github.com/windwp/nvim-ts-autotag[nvim-ts-autotag] uses treesitter to autoclose/rename html tags - -[[sec-plugins-dependencies]] -=== Dependencies - -* https://github.com/nvim-lua/plenary.nvim[plenary] which is a dependency of some plugins, installed automatically if needed -* https://github.comstevearc/dressing.nvim[dressing.nvim] which is a dependency for icon-picker.nvim -* https://github.com/preservim/vim-markdown[vim-markdown] which is a dependency for obsidian.nvim -* https://github.comgodlygeek/tabular[tabular] which is a dependency for vim-markdown -* https://github.com/MunifTanjim/nui.nvim[nui.nvim] which is a dependency for nui-nvim diff --git a/docs/release-notes/rl-0.3.adoc b/docs/release-notes/rl-0.3.adoc index e69de29..f275c79 100644 --- a/docs/release-notes/rl-0.3.adoc +++ b/docs/release-notes/rl-0.3.adoc @@ -0,0 +1,10 @@ +* Treesitter grammars are now configurable with <>. Utilizes the nixpkgs `nvim-treesitter` plugin rather than a custom input in order to take advantage of build support of pinned versions. See https://discourse.nixos.org/t/psa-if-you-are-on-unstable-try-out-nvim-treesitter-withallgrammars/23321?u=snowytrees[discourse] for more information. Packages can be found under the `pkgs.vimPlugins.nvim-treesitter.builtGrammars` attribute. Treesitter grammars for supported languages should be enabled within the module. By default no grammars are installed, thus the following grammars which do not have a language section are not included anymore: comment, toml, make, html, css, graphql, json. + +* A new section has been added for language support: `vim.languages.`. The options <>, <>, etc. will enable the respective section for all languages that have been enabled. +** All LSP languages have been moved here +** `plantuml` and `markdown` have been moved here +** A new section has been added for `html`. The old `vim.treesitter.autotagHtml` can be found at <>. + +* <> has been added allowing you to turn on gitsigns codeactions. + +* Removed the plugins document in the docs. Was too unwieldy to keep updated. From 2627d0484adb226f43392648326a72da448edeb7 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 01:11:02 +0300 Subject: [PATCH 20/33] feat: fix for when internal formatter is true --- modules/languages/default.nix | 2 +- modules/languages/nix.nix | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/languages/default.nix b/modules/languages/default.nix index 3708737..b3b7d34 100644 --- a/modules/languages/default.nix +++ b/modules/languages/default.nix @@ -2,7 +2,7 @@ with lib; let mkEnable = desc: mkOption { - description = "Turn on ${desc} for enabled langauges by default"; + description = "Turn on ${desc} for enabled languages by default"; type = types.bool; default = false; }; diff --git a/modules/languages/nix.nix b/modules/languages/nix.nix index 3313c34..c6dae73 100644 --- a/modules/languages/nix.nix +++ b/modules/languages/nix.nix @@ -15,7 +15,7 @@ with builtins; let servers = { rnix = { package = pkgs.rnix-lsp; - internalFormatter = true; + internalFormatter = cfg.format.type == "nixpkgs-fmt"; lspConfig = '' lspconfig.rnix.setup{ capabilities = capabilities, @@ -31,7 +31,7 @@ with builtins; let nil = { package = pkgs.nil; - internalFormatter = cfg.format.type != "nixpkgs-fmt"; + internalFormatter = true; lspConfig = '' lspconfig.nil_ls.setup{ capabilities = capabilities, From 2df414b5778423de13ee14ecb5807f71786e131c Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 01:36:14 +0300 Subject: [PATCH 21/33] feat: rewrite visuals using lib.mkMerge --- extra.nix | 2 +- modules/languages/markdown/config.nix | 3 +- modules/languages/markdown/markdown.nix | 3 +- modules/visuals/config.nix | 217 ++++++++++-------------- 4 files changed, 93 insertions(+), 132 deletions(-) diff --git a/extra.nix b/extra.nix index c1d444f..91b20be 100644 --- a/extra.nix +++ b/extra.nix @@ -84,7 +84,7 @@ inputs: let vim.autopairs.enable = true; vim.autocomplete = { - enable = true; + enable = false; type = "nvim-cmp"; }; diff --git a/modules/languages/markdown/config.nix b/modules/languages/markdown/config.nix index bf0ef5a..b031f47 100644 --- a/modules/languages/markdown/config.nix +++ b/modules/languages/markdown/config.nix @@ -11,7 +11,8 @@ in { config = mkIf cfg.enable (mkMerge [ (mkIf cfg.treesitter.enable { vim.treesitter.enable = true; - vim.treesitter.grammars = [cfg.treesitter.package]; + + vim.treesitter.grammars = [cfg.treesitter.mdPackage cfg.treesitter.mdInlinePackage]; }) (mkIf cfg.glow.enable { diff --git a/modules/languages/markdown/markdown.nix b/modules/languages/markdown/markdown.nix index 41ab653..d81cb1b 100644 --- a/modules/languages/markdown/markdown.nix +++ b/modules/languages/markdown/markdown.nix @@ -23,7 +23,8 @@ in { type = types.bool; default = config.vim.languages.enableTreesitter; }; - package = nvim.types.mkGrammarOption pkgs "markdown"; + mdPackage = nvim.types.mkGrammarOption pkgs "markdown"; + mdInlinePackage = nvim.types.mkGrammarOption pkgs "markdown-inline"; }; }; } diff --git a/modules/visuals/config.nix b/modules/visuals/config.nix index ff87b50..532df52 100644 --- a/modules/visuals/config.nix +++ b/modules/visuals/config.nix @@ -6,94 +6,52 @@ with lib; let cfg = config.vim.visuals; in { - config = mkIf cfg.enable { - vim.startPlugins = [ - ( - if cfg.nvimWebDevicons.enable - then "nvim-web-devicons" - else null - ) - ( - if cfg.lspkind.enable - then "lspkind" - else null - ) - ( - if cfg.cursorWordline.enable - then "nvim-cursorline" - else null - ) - ( - if cfg.indentBlankline.enable - then "indent-blankline" - else null - ) - ( - if cfg.scrollBar.enable - then "scrollbar-nvim" - else null - ) - ( - if cfg.smoothScroll.enable - then "cinnamon-nvim" - else null - ) - ( - if cfg.cellularAutomaton.enable - then "cellular-automaton" - else null - ) - ( - if cfg.fidget-nvim.enable - then "fidget-nvim" - else null - ) - ]; + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.lspkind.enable { + vim.startPlugins = ["lspkind"]; + vim.luaConfigRC.lspkind = nvim.dag.entryAnywhere '' + -- lspkind + require'lspkind'.init() + ''; + }) - vim.luaConfigRC.visuals = nvim.dag.entryAnywhere '' - ${ - if cfg.lspkind.enable - then "require'lspkind'.init()" - else "" - } - ${ - if cfg.indentBlankline.enable - then '' - -- highlight error: https://github.com/lukas-reineke/indent-blankline.nvim/issues/59 - vim.wo.colorcolumn = "99999" - vim.opt.list = true + (mkIf cfg.indentBlankline.enable { + vim.startPlugins = ["indent-blankline"]; + vim.luaConfigRC.indent-blankline = nvim.dag.entryAnywhere '' + -- highlight error: https://github.com/lukas-reineke/indent-blankline.nvim/issues/59 + vim.wo.colorcolumn = "99999" + vim.opt.list = true + ${optionalString (cfg.indentBlankline.eolChar != "") '' + vim.opt.listchars:append({ eol = "${cfg.indentBlankline.eolChar}" }) + ''} + ${optionalString (cfg.indentBlankline.fillChar != "") '' + vim.opt.listchars:append({ eol = "${cfg.indentBlankline.fillChar}" }) + ''} - ${ - if cfg.indentBlankline.eolChar == "" - then "" - else ''vim.opt.listchars:append({ eol = "${cfg.indentBlankline.eolChar}" })'' - } + require("indent_blankline").setup { + char = "${cfg.indentBlankline.listChar}", + show_current_context = ${boolToString cfg.indentBlankline.showCurrContext}, + show_end_of_line = true, + } + ''; + }) - ${ - if cfg.indentBlankline.fillChar == "" - then "" - else ''vim.opt.listchars:append({ space = "${cfg.indentBlankline.fillChar}"})'' - } + (mkIf cfg.cursorWordline.enable { + vim.startPlugins = ["nvim-cursorline"]; + vim.luaConfigRC.cursorline = nvim.dag.entryAnywhere '' + vim.g.cursorline_timeout = ${toString cfg.cursorWordline.lineTimeout} + ''; + }) - require("indent_blankline").setup { - char = "${cfg.indentBlankline.listChar}", - show_current_context = ${boolToString cfg.indentBlankline.showCurrContext}, - show_end_of_line = true, - } - '' - else "" - } + (mkIf cfg.nvimWebDevicons.enable { + vim.startPlugins = ["nvim-web-devicons"]; + }) - ${ - if cfg.cursorWordline.enable - then "vim.g.cursorline_timeout = ${toString cfg.cursorWordline.lineTimeout}" - else "" - } - - ${ - if cfg.scrollBar.enable - then "require('scrollbar').setup{ + (mkIf cfg.scrollBar.enable { + vim.startPlugins = ["scrollbar-nvim"]; + vim.luaConfigRC.scrollBar = nvim.dag.entryAnywhere '' + require('scrollbar').setup{ excluded_filetypes = { 'prompt', 'TelescopePrompt', @@ -101,56 +59,57 @@ in { 'NvimTree', 'alpha' }, - }" - else "" - } - ${ - if cfg.smoothScroll.enable - then "require('cinnamon').setup()" - else "" - } - ${ - if cfg.cellularAutomaton.enable - then '' - local config = { - fps = 50, - name = 'slide', } + ''; + }) - -- init function is invoked only once at the start - -- config.init = function (grid) - -- - -- end + (mkIf cfg.smoothScroll.enable { + vim.startPlugins = ["cinnamon-nvim"]; + vim.luaConfigRC.smoothScroll = nvim.dag.entryAnywhere '' + require('cinnamon').setup() + ''; + }) - -- update function - config.update = function (grid) - for i = 1, #grid do - local prev = grid[i][#(grid[i])] - for j = 1, #(grid[i]) do - grid[i][j], prev = prev, grid[i][j] - end - end - return true - end - - require("cellular-automaton").register_animation(config) - - vim.keymap.set("n", "fml", "CellularAutomaton make_it_rain") - '' - else "" - } - ${ - if cfg.fidget-nvim.enable - then '' - require"fidget".setup{ - align = { - bottom = ${boolToString cfg.fidget-nvim.align.bottom}, - right = ${boolToString cfg.fidget-nvim.align.right}, + (mkIf cfg.cellularAutomaton.enable { + vim.startPlugins = ["cellular-automaton"]; + vim.luaConfigRC.cellularAUtomaton = nvim.dag.entryAnywhere '' + local config = { + fps = 50, + name = 'slide', } + + -- init function is invoked only once at the start + -- config.init = function (grid) + -- + -- end + + -- update function + config.update = function (grid) + for i = 1, #grid do + local prev = grid[i][#(grid[i])] + for j = 1, #(grid[i]) do + grid[i][j], prev = prev, grid[i][j] + end + end + return true + end + + require("cellular-automaton").register_animation(config) + + vim.keymap.set("n", "fml", "CellularAutomaton make_it_rain") + ''; + }) + + (mkIf cfg.fidget-nvim.enable { + vim.startPlugins = ["fidget-nvim"]; + vim.luaConfigRC.fidget-nvim = nvim.dag.entryAnywhere '' + require"fidget".setup{ + align = { + bottom = ${boolToString cfg.fidget-nvim.align.bottom}, + right = ${boolToString cfg.fidget-nvim.align.right}, } - '' - else "" - } - ''; - }; + } + ''; + }) + ]); } From 104c21c904adbd94a619ed41e279c0db0879c5aa Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 01:48:44 +0300 Subject: [PATCH 22/33] feat(LSP): lspkind and sources --- extra.nix | 11 +++- modules/completion/nvim-cmp/config.nix | 72 ++++++++++++++++-------- modules/completion/nvim-cmp/nvim-cmp.nix | 43 +++++++++++--- modules/languages/rust.nix | 2 +- modules/lsp/default.nix | 1 + modules/lsp/lspkind/config.nix | 20 +++++++ modules/lsp/lspkind/default.nix | 6 ++ modules/lsp/lspkind/lspkind.nix | 22 ++++++++ modules/treesitter/config.nix | 2 +- modules/visuals/config.nix | 8 --- modules/visuals/visuals.nix | 6 -- 11 files changed, 143 insertions(+), 50 deletions(-) create mode 100644 modules/lsp/lspkind/config.nix create mode 100644 modules/lsp/lspkind/default.nix create mode 100644 modules/lsp/lspkind/lspkind.nix diff --git a/extra.nix b/extra.nix index 91b20be..3828409 100644 --- a/extra.nix +++ b/extra.nix @@ -29,6 +29,16 @@ inputs: let }; }; + vim.lsp = { + formatOnSave = true; + lspkind.enable = false; + lightbulb.enable = true; + lspsaga.enable = false; + nvimCodeActionMenu.enable = true; + trouble.enable = true; + lspSignature.enable = true; + }; + vim.languages = { enableLSP = true; enableFormat = true; @@ -56,7 +66,6 @@ inputs: let smoothScroll.enable = true; cellularAutomaton.enable = true; fidget-nvim.enable = true; - lspkind.enable = true; indentBlankline = { enable = true; fillChar = ""; diff --git a/modules/completion/nvim-cmp/config.nix b/modules/completion/nvim-cmp/config.nix index 4495243..b9fecec 100644 --- a/modules/completion/nvim-cmp/config.nix +++ b/modules/completion/nvim-cmp/config.nix @@ -7,8 +7,27 @@ with lib; with builtins; let cfg = config.vim.autocomplete; + lspkindEnabled = config.vim.lsp.enable && config.vim.lsp.lspkind.enable; builtSources = - concatMapStringsSep "\n" (x: "{ name = '${x}'},") cfg.sources; + concatMapStringsSep + "\n" + (n: "{ name = '${n}'},") + (attrNames cfg.sources); + + builtMaps = + concatStringsSep + "\n" + (mapAttrsToList + (n: v: + if v == null + then "" + else "${n} = '${v}',") + cfg.sources); + + dagPlacement = + if lspkindEnabled + then nvim.dag.entryAfter ["lspkind"] + else nvim.dag.entryAnywhere; in { config = mkIf cfg.enable { vim.startPlugins = [ @@ -18,14 +37,28 @@ in { "cmp-path" ]; - vim.autocomplete.sources = [ - "nvim-cmp" - "vsnip" - "buffer" - "path" - ]; + vim.autocomplete.sources = { + "nvim-cmp" = null; + "vsnip" = "[VSnip]"; + "buffer" = "[Buffer]"; + "crates" = "[Crates]"; + "path" = "[Path]"; + }; + + vim.luaConfigRC.completion = mkIf (cfg.type == "nvim-cmp") (dagPlacement '' + local nvim_cmp_menu_map = function(entry, vim_item) + -- name for each source + vim_item.menu = ({ + ${builtMaps} + })[entry.source.name] + print(vim_item.menu) + return vim_item + end + + ${optionalString lspkindEnabled '' + lspkind_opts.before = ${cfg.formatting.format} + ''} - vim.luaConfigRC.completion = mkIf (cfg.type == "nvim-cmp") (nvim.dag.entryAnywhere '' local has_words_before = function() local line, col = unpack(vim.api.nvim_win_get_cursor(0)) return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil @@ -80,23 +113,12 @@ in { completeopt = 'menu,menuone,noinsert', }, formatting = { - format = function(entry, vim_item) - -- type of kind - vim_item.kind = ${ - optionalString (config.vim.visuals.lspkind.enable) - "require('lspkind').presets.default[vim_item.kind] .. ' ' .." - } vim_item.kind - - -- name for each source - vim_item.menu = ({ - buffer = "[Buffer]", - nvim_lsp = "[LSP]", - vsnip = "[VSnip]", - crates = "[Crates]", - path = "[Path]", - })[entry.source.name] - return vim_item - end, + format = + ${ + if lspkindEnabled + then "lspkind.cmp_format(lspkind_opts)" + else cfg.formatting.format + }, } }) ${optionalString (config.vim.autopairs.enable && config.vim.autopairs.type == "nvim-autopairs") '' diff --git a/modules/completion/nvim-cmp/nvim-cmp.nix b/modules/completion/nvim-cmp/nvim-cmp.nix index 6585218..77c677e 100644 --- a/modules/completion/nvim-cmp/nvim-cmp.nix +++ b/modules/completion/nvim-cmp/nvim-cmp.nix @@ -5,11 +5,7 @@ ... }: with lib; -with builtins; let - cfg = config.vim.autocomplete; - builtSources = - concatMapStringsSep "\n" (x: "{ name = '${x}'},") cfg.sources; -in { +with builtins; { options.vim = { autocomplete = { enable = mkOption { @@ -25,9 +21,40 @@ in { }; sources = mkOption { - description = "List of source names for nvim-cmp"; - type = with types; listOf str; - default = []; + description = nvim.nmd.asciiDoc '' + Attribute set of source names for nvim-cmp. + + If an attribute set is provided, then the menu value of + `vim_item` in the format will be set to the value (if + utilizing the `nvim_cmp_menu_map` function). + + Note: only use a single attribute name per attribute set + ''; + type = with types; attrsOf (nullOr str); + default = {}; + example = '' + {nvim-cmp = null; buffer = "[Buffer]";} + ''; + }; + + formatting = { + format = mkOption { + description = nvim.nmd.asciiDoc '' + The function used to customize the appearance of the completion menu. + + If <> is true, then the function + will be called before modifications from lspkind. + + Default is to call the menu mapping function. + ''; + type = types.str; + default = "nvim_cmp_menu_map"; + example = '' + function(entry, vim_item) + return vim_item + end + ''; + }; }; }; }; diff --git a/modules/languages/rust.nix b/modules/languages/rust.nix index 8c330b3..25930cd 100644 --- a/modules/languages/rust.nix +++ b/modules/languages/rust.nix @@ -54,7 +54,7 @@ in { vim.startPlugins = ["crates-nvim"]; - vim.autocomplete.sources = ["crates"]; + vim.autocomplete.sources = {"crates" = "[Crates]";}; vim.luaConfigRC.rust-crates = nvim.dag.entryAnywhere '' require('crates').setup { null_ls = { diff --git a/modules/lsp/default.nix b/modules/lsp/default.nix index b9a39c6..050187b 100644 --- a/modules/lsp/default.nix +++ b/modules/lsp/default.nix @@ -14,6 +14,7 @@ _: { ./trouble ./lsp-signature ./lightbulb + ./lspkind # flutter-tools ./flutter-tools-nvim diff --git a/modules/lsp/lspkind/config.nix b/modules/lsp/lspkind/config.nix new file mode 100644 index 0000000..a243d62 --- /dev/null +++ b/modules/lsp/lspkind/config.nix @@ -0,0 +1,20 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.lsp; +in { + config = mkIf (cfg.enable && cfg.lspkind.enable) { + vim.startPlugins = ["lspkind"]; + vim.luaConfigRC.lspkind = nvim.dag.entryAnywhere '' + local lspkind = require'lspkind' + local lspkind_opts = { + mode = '${cfg.lspkind.mode}' + } + ''; + }; +} diff --git a/modules/lsp/lspkind/default.nix b/modules/lsp/lspkind/default.nix new file mode 100644 index 0000000..81f7418 --- /dev/null +++ b/modules/lsp/lspkind/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./config.nix + ./lspkind.nix + ]; +} diff --git a/modules/lsp/lspkind/lspkind.nix b/modules/lsp/lspkind/lspkind.nix new file mode 100644 index 0000000..82d721b --- /dev/null +++ b/modules/lsp/lspkind/lspkind.nix @@ -0,0 +1,22 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.lsp; +in { + options.vim.lsp = { + lspkind = { + enable = mkEnableOption "vscode-like pictograms for lsp [lspkind]"; + + mode = mkOption { + description = "Defines how annotations are shown"; + type = with types; enum ["text" "text_symbol" "symbol_text" "symbol"]; + default = "symbol_text"; + }; + }; + }; +} diff --git a/modules/treesitter/config.nix b/modules/treesitter/config.nix index 27744ef..b75121b 100644 --- a/modules/treesitter/config.nix +++ b/modules/treesitter/config.nix @@ -14,7 +14,7 @@ in { ["nvim-treesitter"] ++ optional usingNvimCmp "cmp-treesitter"; - vim.autocomplete.sources = ["treesitter"]; + vim.autocomplete.sources = {"treesitter" = "[Treesitter]";}; # For some reason treesitter highlighting does not work on start if this is set before syntax on vim.configRC.treesitter-fold = mkIf cfg.fold (nvim.dag.entryBefore ["basic"] '' diff --git a/modules/visuals/config.nix b/modules/visuals/config.nix index 532df52..d1dd0ec 100644 --- a/modules/visuals/config.nix +++ b/modules/visuals/config.nix @@ -7,14 +7,6 @@ with lib; let cfg = config.vim.visuals; in { config = mkIf cfg.enable (mkMerge [ - (mkIf cfg.lspkind.enable { - vim.startPlugins = ["lspkind"]; - vim.luaConfigRC.lspkind = nvim.dag.entryAnywhere '' - -- lspkind - require'lspkind'.init() - ''; - }) - (mkIf cfg.indentBlankline.enable { vim.startPlugins = ["indent-blankline"]; vim.luaConfigRC.indent-blankline = nvim.dag.entryAnywhere '' diff --git a/modules/visuals/visuals.nix b/modules/visuals/visuals.nix index 7fe03ad..695e3b6 100644 --- a/modules/visuals/visuals.nix +++ b/modules/visuals/visuals.nix @@ -18,12 +18,6 @@ with builtins; { default = false; }; - lspkind.enable = mkOption { - type = types.bool; - description = "Enable vscode-like pictograms for lsp [lspkind]"; - default = false; - }; - scrollBar.enable = mkOption { type = types.bool; description = "Enable scrollbar [scrollbar.nvim]"; From b4999306614e6300657cdb3c2db53b4fe8f18c31 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 01:53:08 +0300 Subject: [PATCH 23/33] feat(lualine): minor refactor --- modules/statusline/lualine/config.nix | 1 + modules/statusline/lualine/lualine.nix | 14 +++----------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/modules/statusline/lualine/config.nix b/modules/statusline/lualine/config.nix index deb78fb..7d4d879 100644 --- a/modules/statusline/lualine/config.nix +++ b/modules/statusline/lualine/config.nix @@ -22,6 +22,7 @@ in { always_divide_middle = true, globalstatus = ${boolToString cfg.globalStatus}, ignore_focus = {'NvimTree'}, + extensions = {${optionalString config.vim.filetree.nvimTreeLua.enable "'nvim-tree'"}}, refresh = { statusline = ${toString cfg.refresh.statusline}, tabline = ${toString cfg.refresh.tabline}, diff --git a/modules/statusline/lualine/lualine.nix b/modules/statusline/lualine/lualine.nix index f95850a..5cd51e8 100644 --- a/modules/statusline/lualine/lualine.nix +++ b/modules/statusline/lualine/lualine.nix @@ -8,11 +8,7 @@ with builtins; let supported_themes = import ./supported_themes.nix; in { options.vim.statusline.lualine = { - enable = mkOption { - type = types.bool; - description = "Enable lualine statusline"; - default = true; - }; + enable = mkEnableOption "lualine"; icons = { enable = mkOption { @@ -47,6 +43,7 @@ in { }; theme = mkOption { + description = "Theme for lualine"; default = "auto"; type = types.enum ( [ @@ -82,13 +79,8 @@ in { "tomorrow" "wombat" ] - ++ ( - if elem config.vim.theme.name supported_themes - then [config.vim.theme.name] - else [] - ) + ++ optional (elem config.vim.theme.name supported_themes) config.vim.theme.name ); - description = "Theme for lualine"; }; sectionSeparator = { From 58f7d8b62e5a9911344da632f06eec7aa97efa54 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 01:53:17 +0300 Subject: [PATCH 24/33] docs: update 0.3 release notes --- docs/release-notes/rl-0.3.adoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/release-notes/rl-0.3.adoc b/docs/release-notes/rl-0.3.adoc index f275c79..2f0bde1 100644 --- a/docs/release-notes/rl-0.3.adoc +++ b/docs/release-notes/rl-0.3.adoc @@ -8,3 +8,8 @@ * <> has been added allowing you to turn on gitsigns codeactions. * Removed the plugins document in the docs. Was too unwieldy to keep updated. + + +* `vim.visual.lspkind` has been moved to <> + +* Improved handling of completion formatting. When setting <>, can also include optional menu mapping. And can provide your own function with <>. From 8658ea13a2bd60c0fb78944bd23e0a009ae2c93b Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 02:01:45 +0300 Subject: [PATCH 25/33] feat(lib): lua namespace for conversion helpers --- lib/booleans.nix | 9 --------- lib/default.nix | 1 + lib/lua.nix | 12 ++++++++++++ lib/types/plugins.nix | 1 + 4 files changed, 14 insertions(+), 9 deletions(-) delete mode 100644 lib/booleans.nix create mode 100644 lib/lua.nix diff --git a/lib/booleans.nix b/lib/booleans.nix deleted file mode 100644 index 277dd18..0000000 --- a/lib/booleans.nix +++ /dev/null @@ -1,9 +0,0 @@ -# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix -{lib}: { - # Converts a boolean to a yes/no string. This is used in lots of - # configuration formats. - yesNo = value: - if value - then "yes" - else "no"; -} diff --git a/lib/default.nix b/lib/default.nix index 37840c1..ad6771a 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -4,4 +4,5 @@ types = import ./types {inherit lib;}; languages = import ./languages.nix {inherit lib;}; nmd = import ./nmd.nix; + lua = import ./lua.nix {inherit lib;}; } diff --git a/lib/lua.nix b/lib/lua.nix new file mode 100644 index 0000000..b21c459 --- /dev/null +++ b/lib/lua.nix @@ -0,0 +1,12 @@ +# Helpers for converting values to lua +{lib}: { + yesNo = value: + if value + then "yes" + else "no"; + + nullString = value: + if value == null + then "nil" + else "'${value}'"; +} diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 3ff9dd1..770a47a 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -41,6 +41,7 @@ with lib; let "rust-tools" "onedark" "catppuccin" + "dracula" "minimap-vim" "dashboard-nvim" "alpha-nvim" From c1c98d57e3ecdd8edfed6d2fd11bc1f3619c7530 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 02:01:51 +0300 Subject: [PATCH 26/33] feat: dracula theme --- flake.lock | 29 +++++++++++++++++++++++------ flake.nix | 5 +++++ modules/theme/supported_themes.nix | 7 +++++++ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index f28d95b..4c237c8 100644 --- a/flake.lock +++ b/flake.lock @@ -305,6 +305,22 @@ "type": "github" } }, + "dracula": { + "flake": false, + "locked": { + "lastModified": 1681364507, + "narHash": "sha256-RJT+fYJyTD+8krT/+M6644ycJ2rzenPBd9NQpGjAMGw=", + "owner": "Mofiqul", + "repo": "dracula.nvim", + "rev": "b5bd9c7e4c6c8f4712610bda92140c735fe90521", + "type": "github" + }, + "original": { + "owner": "Mofiqul", + "repo": "dracula.nvim", + "type": "github" + } + }, "dressing-nvim": { "flake": false, "locked": { @@ -707,11 +723,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1681723626, - "narHash": "sha256-lu9vrGVzptuG+DyR1iaFnIHkliwEdOLPTT/IsZND+Cg=", + "lastModified": 1681753173, + "narHash": "sha256-MrGmzZWLUqh2VstoikKLFFIELXm/lsf/G9U9zR96VD4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "269c677b54ea828a9f0f4cb02f4beee9c95a2284", + "rev": "0a4206a51b386e5cda731e8ac78d76ad924c7125", "type": "github" }, "original": { @@ -1244,6 +1260,7 @@ "crates-nvim": "crates-nvim", "dashboard-nvim": "dashboard-nvim", "diffview-nvim": "diffview-nvim", + "dracula": "dracula", "dressing-nvim": "dressing-nvim", "fidget-nvim": "fidget-nvim", "flake-parts": "flake-parts", @@ -1558,11 +1575,11 @@ "trouble": { "flake": false, "locked": { - "lastModified": 1679827111, - "narHash": "sha256-uw/wfMKoFN2sHw/99ZcqGKJ3jQVP9pkDHqDaXaYn3CA=", + "lastModified": 1681764706, + "narHash": "sha256-znQA0i8gVzThGBBgkvBISFgSE47C5VZcMZ45dnJmewM=", "owner": "folke", "repo": "trouble.nvim", - "rev": "2ae7237c2917d661f458443c9a88680f8ca2d7b2", + "rev": "c25fab9a76e5559b0da4ee012c734f16e72bdf85", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 6e7d363..65a80c3 100644 --- a/flake.nix +++ b/flake.nix @@ -268,6 +268,11 @@ flake = false; }; + dracula = { + url = "github:Mofiqul/dracula.nvim"; + flake = false; + }; + # Rust crates crates-nvim = { url = "github:Saecki/crates.nvim"; diff --git a/modules/theme/supported_themes.nix b/modules/theme/supported_themes.nix index c0ebfcf..814b412 100644 --- a/modules/theme/supported_themes.nix +++ b/modules/theme/supported_themes.nix @@ -19,6 +19,13 @@ styles = ["day" "night" "storm"]; }; + dracula = { + setup = '' + require('dracula').setup({}); + require('dracula').load(); + ''; + }; + catppuccin = { setup = { style ? "mocha", From 6b3d529bc9388a7acd4c85c310710c3dcd674459 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 02:10:40 +0300 Subject: [PATCH 27/33] docs: fix escaping characters --- flake.lock | 10 ++--- flake.nix | 2 +- modules/treesitter/context.nix | 79 ++++++++++++++++++++++++++++------ 3 files changed, 73 insertions(+), 18 deletions(-) diff --git a/flake.lock b/flake.lock index 4c237c8..15262b0 100644 --- a/flake.lock +++ b/flake.lock @@ -1063,15 +1063,15 @@ "nvim-treesitter-context": { "flake": false, "locked": { - "lastModified": 1652175020, - "narHash": "sha256-dYw/Y6+Eni7gTSjvCCl7E6ho8xSTxDYAwH3xGEhf54Q=", - "owner": "lewis6991", + "lastModified": 1681297663, + "narHash": "sha256-INYJBQDHgq+2V469JLIq54LolGb6T7nlgmmVDQcxwkk=", + "owner": "nvim-treesitter", "repo": "nvim-treesitter-context", - "rev": "c931a3136a696c1827eda78ac678aea542115bd0", + "rev": "0d730df898f3dc27fd88f03cfa6d26d2405554b4", "type": "github" }, "original": { - "owner": "lewis6991", + "owner": "nvim-treesitter", "repo": "nvim-treesitter-context", "type": "github" } diff --git a/flake.nix b/flake.nix index 65a80c3..7678e24 100644 --- a/flake.nix +++ b/flake.nix @@ -87,7 +87,7 @@ flake = false; }; nvim-treesitter-context = { - url = "github:lewis6991/nvim-treesitter-context"; + url = "github:nvim-treesitter/nvim-treesitter-context"; flake = false; }; nvim-lightbulb = { diff --git a/modules/treesitter/context.nix b/modules/treesitter/context.nix index 30472ae..08039bb 100644 --- a/modules/treesitter/context.nix +++ b/modules/treesitter/context.nix @@ -1,29 +1,84 @@ { + pkgs, config, lib, ... }: with lib; with builtins; let - cfg = config.vim.treesitter; + treesitter = config.vim.treesitter; + cfg = treesitter.context; in { - options.vim.treesitter.context.enable = mkOption { - type = types.bool; - default = false; - description = "enable function context [nvim-treesitter-context]"; + options.vim.treesitter.context = { + enable = mkEnableOption "context of current buffer contents [nvim-treesitter-context] "; + + maxLines = mkOption { + description = "How many lines the window should span. Values <=0 mean no limit."; + type = types.int; + default = 0; + }; + + minWindowHeight = mkOption { + description = "Minimum editor window height to enable context. Values <= 0 mean no limit."; + type = types.int; + default = 0; + }; + + lineNumbers = mkOption { + description = ""; + type = types.bool; + default = true; + }; + + multilineThreshold = mkOption { + description = "Maximum number of lines to collapse for a single context line."; + type = types.int; + default = 20; + }; + + trimScope = mkOption { + description = nvim.nmd.asciiDoc "Which context lines to discard if <> is exceeded."; + type = types.enum ["inner" "outer"]; + default = "outer"; + }; + + mode = mkOption { + description = "Line used to calculate context."; + type = types.enum ["cursor" "topline"]; + default = "cursor"; + }; + + separator = mkOption { + description = nvim.nmd.asciiDoc '' + Separator between context and content. Should be a single character string, like '-'. + + When separator is set, the context will only show up when there are at least 2 lines above cursorline. + ''; + type = with types; nullOr str; + default = null; + }; + + zindex = mkOption { + description = "The Z-index of the context window."; + type = types.int; + default = 20; + }; }; - config = mkIf (cfg.enable && cfg.context.enable) { - vim.startPlugins = [ - "nvim-treesitter-context" - ]; + config = mkIf (treesitter.enable && cfg.enable) { + vim.startPlugins = ["nvim-treesitter-context"]; vim.luaConfigRC.treesitter-context = nvim.dag.entryAnywhere '' - -- Treesitter Context config require'treesitter-context'.setup { enable = true, - throttle = true, - max_lines = 0 + max_lines = ${toString cfg.maxLines}, + min_window_height = ${toString cfg.minWindowHeight}, + line_numbers = ${boolToString cfg.lineNumbers}, + multiline_threshold = ${toString cfg.multilineThreshold}, + trim_scope = '${cfg.trimScope}', + mode = '${cfg.mode}', + separator = ${nvim.lua.nullString cfg.separator}, + max_lines = ${toString cfg.zindex}, } ''; }; From 8e2ea2bbfc5f633ffded0f207c88cd4d12309e02 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 02:17:26 +0300 Subject: [PATCH 28/33] docs: update 0.3 release notes --- docs/release-notes/rl-0.3.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release-notes/rl-0.3.adoc b/docs/release-notes/rl-0.3.adoc index 2f0bde1..26b52c2 100644 --- a/docs/release-notes/rl-0.3.adoc +++ b/docs/release-notes/rl-0.3.adoc @@ -13,3 +13,5 @@ * `vim.visual.lspkind` has been moved to <> * Improved handling of completion formatting. When setting <>, can also include optional menu mapping. And can provide your own function with <>. + +* For <> and <> turning them off should use `null` rather than `""` now. From ad95175224d95f937a796afa1435b64751bea698 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 02:17:36 +0300 Subject: [PATCH 29/33] feat(visuals): Update and configurations --- extra.nix | 4 ++-- modules/visuals/config.nix | 10 +++++---- modules/visuals/visuals.nix | 45 +++++++++++++++++++++---------------- 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/extra.nix b/extra.nix index 3828409..e73face 100644 --- a/extra.nix +++ b/extra.nix @@ -68,8 +68,8 @@ inputs: let fidget-nvim.enable = true; indentBlankline = { enable = true; - fillChar = ""; - eolChar = ""; + fillChar = null; + eolChar = null; showCurrContext = true; }; cursorWordline = { diff --git a/modules/visuals/config.nix b/modules/visuals/config.nix index d1dd0ec..7137d70 100644 --- a/modules/visuals/config.nix +++ b/modules/visuals/config.nix @@ -14,17 +14,19 @@ in { vim.wo.colorcolumn = "99999" vim.opt.list = true - ${optionalString (cfg.indentBlankline.eolChar != "") '' + ${optionalString (cfg.indentBlankline.eolChar != null) '' vim.opt.listchars:append({ eol = "${cfg.indentBlankline.eolChar}" }) ''} - ${optionalString (cfg.indentBlankline.fillChar != "") '' - vim.opt.listchars:append({ eol = "${cfg.indentBlankline.fillChar}" }) + ${optionalString (cfg.indentBlankline.fillChar != null) '' + vim.opt.listchars:append({ space = "${cfg.indentBlankline.fillChar}" }) ''} require("indent_blankline").setup { + enabled = true, char = "${cfg.indentBlankline.listChar}", show_current_context = ${boolToString cfg.indentBlankline.showCurrContext}, - show_end_of_line = true, + show_end_of_line = ${boolToString cfg.indentBlankline.showEndOfLine}, + use_treesitter = ${boolToString cfg.indentBlankline.useTreesitter}, } ''; }) diff --git a/modules/visuals/visuals.nix b/modules/visuals/visuals.nix index 695e3b6..b1794c1 100644 --- a/modules/visuals/visuals.nix +++ b/modules/visuals/visuals.nix @@ -6,17 +6,9 @@ with lib; with builtins; { options.vim.visuals = { - enable = mkOption { - type = types.bool; - description = "Enable visual enhancements"; - default = false; - }; + enable = mkEnableOption "Visual enhancements."; - nvimWebDevicons.enable = mkOption { - type = types.bool; - description = "Enable dev icons. required for certain plugins [nvim-web-devicons]"; - default = false; - }; + nvimWebDevicons.enable = mkEnableOption "dev icons. Required for certain plugins [nvim-web-devicons]."; scrollBar.enable = mkOption { type = types.bool; @@ -58,15 +50,12 @@ with builtins; { }; cursorWordline = { - enable = mkOption { - type = types.bool; - description = "Enable word and delayed line highlight [nvim-cursorline]"; - default = false; - }; + enable = mkEnableOption "word and delayed line highlight [nvim-cursorline]."; lineTimeout = mkOption { type = types.int; description = "Time in milliseconds for cursorline to appear"; + default = 500; }; }; @@ -84,21 +73,39 @@ with builtins; { }; fillChar = mkOption { - type = types.str; description = "Character to fill indents"; + type = with types; nullOr types.str; default = "⋅"; }; eolChar = mkOption { - type = types.str; description = "Character at end of line"; + type = with types; nullOr types.str; default = "↴"; }; - showCurrContext = mkOption { + showEndOfLine = mkOption { + description = nvim.nmd.asciiDoc '' + Displays the end of line character set by <> instead of the + indent guide on line returns. + ''; type = types.bool; + default = cfg.indentBlankline.eolChar != null; + defaultText = literalExpression "config.vim.visuals.indentBlankline.eolChar != null"; + }; + + showCurrContext = mkOption { description = "Highlight current context from treesitter"; - default = true; + type = types.bool; + default = config.vim.treesitter.enable; + defaultText = literalExpression "config.vim.treesitter.enable"; + }; + + useTreesitter = mkOption { + description = "Use treesitter to calculate indentation when possible."; + type = types.bool; + default = config.vim.treesitter.enable; + defaultText = literalExpression "config.vim.treesitter.enable"; }; }; }; From acf592e8b1a6c82aaf54040cd5222f454aee2488 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 02:34:41 +0300 Subject: [PATCH 30/33] modified: modules/completion/nvim-cmp/nvim-cmp.nix --- extra.nix | 2 +- modules/completion/nvim-cmp/nvim-cmp.nix | 5 +- modules/lsp/config.nix | 2 +- modules/statusline/lualine/lualine.nix | 84 +++++++++++++----------- modules/visuals/visuals.nix | 4 +- 5 files changed, 53 insertions(+), 44 deletions(-) diff --git a/extra.nix b/extra.nix index e73face..4765bcf 100644 --- a/extra.nix +++ b/extra.nix @@ -93,7 +93,7 @@ inputs: let vim.autopairs.enable = true; vim.autocomplete = { - enable = false; + enable = true; type = "nvim-cmp"; }; diff --git a/modules/completion/nvim-cmp/nvim-cmp.nix b/modules/completion/nvim-cmp/nvim-cmp.nix index 77c677e..bb6f7f9 100644 --- a/modules/completion/nvim-cmp/nvim-cmp.nix +++ b/modules/completion/nvim-cmp/nvim-cmp.nix @@ -49,10 +49,13 @@ with builtins; { ''; type = types.str; default = "nvim_cmp_menu_map"; - example = '' + example = nvim.nmd.literalAsciiDoc '' + [source,lua] + --- function(entry, vim_item) return vim_item end + --- ''; }; }; diff --git a/modules/lsp/config.nix b/modules/lsp/config.nix index a90bd02..5e56b9c 100644 --- a/modules/lsp/config.nix +++ b/modules/lsp/config.nix @@ -12,7 +12,7 @@ in { config = mkIf cfg.enable { vim.startPlugins = optional usingNvimCmp "cmp-nvim-lsp"; - vim.autocomplete.sources = ["nvim_lsp"]; + vim.autocomplete.sources = {"nvim_lsp" = "[LSP]";}; vim.luaConfigRC.lsp-setup = '' vim.g.formatsave = ${boolToString cfg.formatOnSave}; diff --git a/modules/statusline/lualine/lualine.nix b/modules/statusline/lualine/lualine.nix index 5cd51e8..f1bd31c 100644 --- a/modules/statusline/lualine/lualine.nix +++ b/modules/statusline/lualine/lualine.nix @@ -42,46 +42,50 @@ in { default = true; }; - theme = mkOption { - description = "Theme for lualine"; - default = "auto"; - type = types.enum ( - [ - "auto" - "16color" - "gruvbox" - "ayu_dark" - "ayu_light" - "ayu_mirage" - "codedark" - "dracula" - "everforest" - "gruvbox" - "gruvbox_light" - "gruvbox_material" - "horizon" - "iceberg_dark" - "iceberg_light" - "jellybeans" - "material" - "modus_vivendi" - "molokai" - "nightfly" - "nord" - "oceanicnext" - "onelight" - "palenight" - "papercolor_dark" - "papercolor_light" - "powerline" - "seoul256" - "solarized_dark" - "tomorrow" - "wombat" - ] - ++ optional (elem config.vim.theme.name supported_themes) config.vim.theme.name - ); - }; + theme = let + themeSupported = elem config.vim.theme.name supported_themes; + in + mkOption { + description = "Theme for lualine"; + type = types.enum ([ + "auto" + "16color" + "gruvbox" + "ayu_dark" + "ayu_light" + "ayu_mirage" + "codedark" + "dracula" + "everforest" + "gruvbox" + "gruvbox_light" + "gruvbox_material" + "horizon" + "iceberg_dark" + "iceberg_light" + "jellybeans" + "material" + "modus_vivendi" + "molokai" + "nightfly" + "nord" + "oceanicnext" + "onelight" + "palenight" + "papercolor_dark" + "papercolor_light" + "powerline" + "seoul256" + "solarized_dark" + "tomorrow" + "wombat" + ] + ++ optional themeSupported config.vim.theme.name); + default = "auto"; + # TODO: xml generation error if the closing '' is on a new line. + # issue: https://gitlab.com/rycee/nmd/-/issues/10 + defaultText = nvim.nmd.literalAsciiDoc ''`config.vim.theme.name` if theme supports lualine else "auto"''; + }; sectionSeparator = { left = mkOption { diff --git a/modules/visuals/visuals.nix b/modules/visuals/visuals.nix index b1794c1..4981961 100644 --- a/modules/visuals/visuals.nix +++ b/modules/visuals/visuals.nix @@ -4,7 +4,9 @@ ... }: with lib; -with builtins; { +with builtins; let + cfg = config.vim.visuals; +in { options.vim.visuals = { enable = mkEnableOption "Visual enhancements."; From 07d5aee29c12923fb19353ffb2f62a7a4f3dfa8e Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 02:52:24 +0300 Subject: [PATCH 31/33] style: formatting --- flake.lock | 12 ++++++------ modules/autopairs/nvim-autopairs/nvim-autopairs.nix | 1 - modules/lsp/config.nix | 1 - 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/flake.lock b/flake.lock index 41ebb7e..3013939 100644 --- a/flake.lock +++ b/flake.lock @@ -340,11 +340,11 @@ "elixir-ls": { "flake": false, "locked": { - "lastModified": 1681462421, - "narHash": "sha256-pIwZFiCLJ0f7OXi1iTza04KSn7rpFpvUsNYrFh0FoEM=", + "lastModified": 1681745218, + "narHash": "sha256-b3mlcwV4eHR90e9BExhb51T5A7dQVMwXRRIGqKEFBzg=", "owner": "elixir-lsp", "repo": "elixir-ls", - "rev": "85cfc5604edeadb0a6a683c41abff60a0c959de7", + "rev": "bf9db5a29efb2331da6cfbc526ecbfc10d372abc", "type": "github" }, "original": { @@ -356,11 +356,11 @@ "elixir-tools": { "flake": false, "locked": { - "lastModified": 1681453321, - "narHash": "sha256-7QgWrdq4p5t8WVnFhL5P948JFPR0i2C06kisxl30D2U=", + "lastModified": 1681746276, + "narHash": "sha256-1ZCFU79xZW52Dtx864hxeANzn+L15fnfso2NBnzBvOU=", "owner": "elixir-tools", "repo": "elixir-tools.nvim", - "rev": "8ccb696c048eca667486ee005f4386c0db8c5e14", + "rev": "7b42d9131521a11cfd504b450bb445757cf2ef63", "type": "github" }, "original": { diff --git a/modules/autopairs/nvim-autopairs/nvim-autopairs.nix b/modules/autopairs/nvim-autopairs/nvim-autopairs.nix index f807459..1b3f8b7 100644 --- a/modules/autopairs/nvim-autopairs/nvim-autopairs.nix +++ b/modules/autopairs/nvim-autopairs/nvim-autopairs.nix @@ -24,7 +24,6 @@ with builtins; { type = types.bool; default = true; description = nvim.nmd.asciiDoc ''map on insert mode''; - }; map_complete = mkOption { diff --git a/modules/lsp/config.nix b/modules/lsp/config.nix index 86f5069..2bf2567 100644 --- a/modules/lsp/config.nix +++ b/modules/lsp/config.nix @@ -61,5 +61,4 @@ in { ${optionalString usingNvimCmp "capabilities = require('cmp_nvim_lsp').default_capabilities()"} ''; }; - } From 824c852ec173d6029d8014b7eba26555711b4a55 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 03:18:02 +0300 Subject: [PATCH 32/33] feat: refactor dart and elixir LSPs according to the new structure --- extra.nix | 2 + modules/languages/dart/config.nix | 60 +++++++++++++ modules/languages/dart/dart.nix | 90 +++++++++++++++++++ .../dart}/default.nix | 2 +- modules/languages/default.nix | 2 + modules/{lsp => languages}/elixir/config.nix | 3 +- modules/{lsp => languages}/elixir/default.nix | 0 modules/languages/elixir/elixir-tools.nix | 11 +++ modules/lsp/default.nix | 4 - modules/lsp/elixir/elixir-tools.nix | 10 --- modules/lsp/flutter-tools-nvim/config.nix | 33 ------- .../lsp/flutter-tools-nvim/flutter-tools.nix | 37 -------- 12 files changed, 167 insertions(+), 87 deletions(-) create mode 100644 modules/languages/dart/config.nix create mode 100644 modules/languages/dart/dart.nix rename modules/{lsp/flutter-tools-nvim => languages/dart}/default.nix (64%) rename modules/{lsp => languages}/elixir/config.nix (98%) rename modules/{lsp => languages}/elixir/default.nix (100%) create mode 100644 modules/languages/elixir/elixir-tools.nix delete mode 100644 modules/lsp/elixir/elixir-tools.nix delete mode 100644 modules/lsp/flutter-tools-nvim/config.nix delete mode 100644 modules/lsp/flutter-tools-nvim/flutter-tools.nix diff --git a/extra.nix b/extra.nix index 4765bcf..afa2df1 100644 --- a/extra.nix +++ b/extra.nix @@ -57,6 +57,8 @@ inputs: let go.enable = isMaximal; zig.enable = isMaximal; python.enable = isMaximal; + dart.enable = isMaximal; + elixir.enable = isMaximal; }; vim.visuals = { diff --git a/modules/languages/dart/config.nix b/modules/languages/dart/config.nix new file mode 100644 index 0000000..9866db4 --- /dev/null +++ b/modules/languages/dart/config.nix @@ -0,0 +1,60 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.dart; + ftcfg = cfg.flutter-tools; + servers = { + dart = { + package = pkgs.dart; + lspConfig = '' + lspconfig.dart.setup{ + capabilities = capabilities; + on_attach=default_on_attach; + cmd = {"${pkgs.dart}/bin/dart"}; + ${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.dartOpts}"} + } + ''; + }; + }; +in { + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.lspconfig.enable = true; + + vim.lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + + (mkIf (ftcfg.enable) { + vim.startPlugins = ["flutter-tools"]; + + vim.luaConfigRC.flutter-tools = nvim.dag.entryAnywhere '' + require('flutter-tools').setup { + lsp = { + color = { -- show the derived colours for dart variables + enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10 + background = ${boolToString ftcfg.color.highlightBackground}, -- highlight the background + foreground = ${boolToString ftcfg.color.highlightForeground}, -- highlight the foreground + virtual_text = ${boolToString ftcfg.color.virtualText.enable}, -- show the highlight using virtual text + virtual_text_str = ${ftcfg.color.virtualText.character} -- the virtual text character to highlight + }, + + capabilities = capabilities, + on_attach = default_on_attach; + flags = lsp_flags, + }, + } + + ''; + }) + ]); +} diff --git a/modules/languages/dart/dart.nix b/modules/languages/dart/dart.nix new file mode 100644 index 0000000..21bf960 --- /dev/null +++ b/modules/languages/dart/dart.nix @@ -0,0 +1,90 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; +with builtins; let + cfg = config.vim.languages.dart; + defaultServer = "dart"; + servers = { + dart = { + package = pkgs.dart; + lspConfig = '' + lspconfig.dart.setup{ + capabilities = capabilities; + on_attach=default_on_attach; + cmd = {"${pkgs.dart}/bin/dart"}; + ${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.dartOpts}"} + } + ''; + }; + }; +in { + options.vim.languages.dart = { + enable = mkEnableOption "Dart language support"; + + treesitter = { + enable = mkOption { + description = "Enable Dart treesitter"; + type = types.bool; + default = config.vim.languages.enableTreesitter; + }; + package = nvim.types.mkGrammarOption pkgs "dart"; + }; + + lsp = { + enable = mkOption { + description = "Enable Dart LSP support"; + type = types.bool; + default = config.vim.languages.enableLSP; + }; + server = mkOption { + description = "The Dart LSP server to use"; + type = with types; enum (attrNames servers); + default = defaultServer; + }; + package = mkOption { + description = "Dart LSP server package"; + type = types.package; + default = servers.${cfg.lsp.server}.package; + }; + opts = mkOption { + description = "Options to pass to Dart LSP server"; + type = with types; nullOr str; + default = null; + }; + }; + + flutter-tools = { + enable = mkEnableOption "Enable flutter-tools for flutter support"; + + color = { + enable = mkEnableOption "Whether or mot to highlight color variables at all"; + + highlightBackground = mkOption { + type = types.bool; + default = false; + description = "Highlight the background"; + }; + + highlightForeground = mkOption { + type = types.bool; + default = false; + description = "Highlight the foreground"; + }; + + virtualText = { + enable = mkEnableOption "Show the highlight using virtual text"; + + character = mkOption { + type = types.str; + default = "■"; + description = "Virtual text character to highlight"; + }; + }; + }; + }; + }; +} diff --git a/modules/lsp/flutter-tools-nvim/default.nix b/modules/languages/dart/default.nix similarity index 64% rename from modules/lsp/flutter-tools-nvim/default.nix rename to modules/languages/dart/default.nix index 4cbe9c0..da454ec 100644 --- a/modules/lsp/flutter-tools-nvim/default.nix +++ b/modules/languages/dart/default.nix @@ -1,6 +1,6 @@ _: { imports = [ - ./flutter-tools.nix + ./dart.nix ./config.nix ]; } diff --git a/modules/languages/default.nix b/modules/languages/default.nix index b3b7d34..75d08ab 100644 --- a/modules/languages/default.nix +++ b/modules/languages/default.nix @@ -10,6 +10,8 @@ in { imports = [ ./markdown ./tidal + ./dart + ./elixir ./clang.nix ./go.nix diff --git a/modules/lsp/elixir/config.nix b/modules/languages/elixir/config.nix similarity index 98% rename from modules/lsp/elixir/config.nix rename to modules/languages/elixir/config.nix index 1b1e2a5..e0ef5f9 100644 --- a/modules/lsp/elixir/config.nix +++ b/modules/languages/elixir/config.nix @@ -6,12 +6,11 @@ }: with lib; with builtins; let - cfg = config.vim.lsp.elixir; + cfg = config.vim.languages.elixir; in { config = mkIf (cfg.enable) { vim.startPlugins = [ "elixir-tools" - "plenary-nvim" ]; vim.luaConfigRC.elixir-tools = nvim.dag.entryAnywhere '' diff --git a/modules/lsp/elixir/default.nix b/modules/languages/elixir/default.nix similarity index 100% rename from modules/lsp/elixir/default.nix rename to modules/languages/elixir/default.nix diff --git a/modules/languages/elixir/elixir-tools.nix b/modules/languages/elixir/elixir-tools.nix new file mode 100644 index 0000000..83da10f --- /dev/null +++ b/modules/languages/elixir/elixir-tools.nix @@ -0,0 +1,11 @@ +{ + config, + lib, + ... +}: +with lib; +with builtins; { + options.vim.languages.elixir = { + enable = mkEnableOption "elixir support"; + }; +} diff --git a/modules/lsp/default.nix b/modules/lsp/default.nix index a6f1e52..7f13e40 100644 --- a/modules/lsp/default.nix +++ b/modules/lsp/default.nix @@ -15,9 +15,5 @@ _: { ./lsp-signature ./lightbulb ./lspkind - - # language specific modules - ./flutter-tools-nvim # dart & flutter - ./elixir # elixir ]; } diff --git a/modules/lsp/elixir/elixir-tools.nix b/modules/lsp/elixir/elixir-tools.nix deleted file mode 100644 index d3fe1ec..0000000 --- a/modules/lsp/elixir/elixir-tools.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; -with builtins; { - options.vim.lsp.elixir = { - }; -} diff --git a/modules/lsp/flutter-tools-nvim/config.nix b/modules/lsp/flutter-tools-nvim/config.nix deleted file mode 100644 index 2c97e90..0000000 --- a/modules/lsp/flutter-tools-nvim/config.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; -with builtins; let - cfg = config.vim.lsp; - ftcfg = cfg.dart.flutter-tools; -in { - config = mkIf (cfg.enable && ftcfg.enable) { - vim.startPlugins = ["flutter-tools"]; - - vim.luaConfigRC.flutter-tools = nvim.dag.entryAnywhere '' - require('flutter-tools').setup { - lsp = { - color = { -- show the derived colours for dart variables - enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10 - background = ${boolToString ftcfg.color.highlightBackground}, -- highlight the background - foreground = ${boolToString ftcfg.color.highlightForeground}, -- highlight the foreground - virtual_text = ${boolToString ftcfg.color.virtualText.enable}, -- show the highlight using virtual text - virtual_text_str = ${ftcfg.color.virtualText.character} -- the virtual text character to highlight - }, - - capabilities = capabilities, - on_attach = default_on_attach; - flags = lsp_flags, - }, - } - - ''; - }; -} diff --git a/modules/lsp/flutter-tools-nvim/flutter-tools.nix b/modules/lsp/flutter-tools-nvim/flutter-tools.nix deleted file mode 100644 index 9bd460b..0000000 --- a/modules/lsp/flutter-tools-nvim/flutter-tools.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; -with builtins; { - options.vim.lsp.dart.flutter-tools = { - enable = mkEnableOption "Enable flutter-tools for flutter support"; - - color = { - enable = mkEnableOption "Whether or mot to highlight color variables at all"; - - highlightBackground = mkOption { - type = types.bool; - default = false; - description = "Highlight the background"; - }; - - highlightForeground = mkOption { - type = types.bool; - default = false; - description = "Highlight the foreground"; - }; - - virtualText = { - enable = mkEnableOption "Show the highlight using virtual text"; - - character = mkOption { - type = types.str; - default = "■"; - description = "Virtual text character to highlight"; - }; - }; - }; - }; -} From 936efd2197c7f810c50165856586fb1ebc041a34 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Apr 2023 03:22:35 +0300 Subject: [PATCH 33/33] feat: ignore codeaction menu for scrollbar --- modules/visuals/config.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/visuals/config.nix b/modules/visuals/config.nix index 7137d70..676fb82 100644 --- a/modules/visuals/config.nix +++ b/modules/visuals/config.nix @@ -51,7 +51,8 @@ in { 'TelescopePrompt', 'noice', 'NvimTree', - 'alpha' + 'alpha', + 'code-action-menu-menu' }, } '';