diff --git a/.github/README.md b/.github/README.md index 780e34b5..cd34e6e1 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,5 +1,5 @@
- neovim-flake Logo + neovim-flake Logo

❄️ neovim-flake

@@ -30,7 +30,10 @@
- A highly modular, configurable, extensible and easy to use Neovim configuration wrapper written in Nix. Designed for flexibility and ease of use, this flake allows you to easily configure your Neovim instance with a few lines of Nix code. + A highly modular, configurable, extensible and easy to use Neovim configuration + wrapper written in Nix. Designed for flexibility and ease of use, this flake + allows you to easily configure your Neovim instance with a few lines of + Nix code.
@@ -62,106 +65,137 @@ ### Using `nix` CLI -If you would like to try out the configuration before even thinking about installing it, you can run the following command +If you would like to try out the configuration before even thinking about +installing it, you can run the following command ```console nix run github:notashelf/neovim-flake ``` -This will get you a feel for the base configuration and UI design. The flake exposes `#nix` as the default package, providing minimal language support and various -utilities.You may also use `#nix`, `#tidal` or `#maximal` to get try out different configurations. +This will get you a feel for the base configuration and UI design. +The flake exposes `#nix` as the default package, providing minimal +language support and various utilities.You may also use `#nix`, +`#tidal` or `#maximal` to get try out different configurations. -It is as simple as changing the target output to get a different configuration. For example, to get a configuration with `tidal` support, run: +It is as simple as changing the target output to get a different +configuration. For example, to get a configuration with `tidal` support, run: ```console nix run github:notashelf/neovim-flake#tidal ``` -Similar instructions will apply for `nix profile install`. However, you are recommended to instead use the module system as described in the manual. +Similar instructions will apply for `nix profile install`. However, you are +recommended to instead use the module system as described in the manual. > [!NOTE] -> The `maximal` configuration is _massive_ and will take a while to build. To get a feel for the configuration, use the default `nix` or `tidal` configurations. -> Should you choose to try out the `maximal` configuration, using the binary cache as described in the manual is _strongly_ recommended. +> The `maximal` configuration is _massive_ and will take a while to build. +> To get a feel for the configuration, use the default `nix` or `tidal` +> configurations. Should you choose to try out the `maximal` configuration, +> using the binary cache as described in the manual is _strongly_ recommended. ### Docker -As of version 0.5, an image for the `nix` output is published to Dockerhub and GitHub packages with each tagged release. If you do not have Nix installed +As of version 0.5, an image for the `nix` output is published to Dockerhub +and GitHub packages with each tagged release. If you do not have Nix installed on your system, you may run neovim within a container using your favorite tool. -The following command will open the current directory in neovim with necessary tools bootstrapped. +The following command will open the current directory in neovim with necessary +tools bootstrapped. ```console docker run -v `pwd`:/home/neovim/demo --rm -it notashelf/neovim-flake:latest ``` -The available registeres are `ghcr.io` and `dockerhub` for the time being. Adjust to your liking. +The available registeres are `ghcr.io` and `dockerhub` for the time being. +Adjust to your liking. ## Documentation -See the [neovim-flake Manual](https://notashelf.github.io/neovim-flake/) for detailed installation guides, configurations, available options, release notes -and more. +See the [neovim-flake Manual](https://notashelf.github.io/neovim-flake/) for +detailed installation guides, configurations, available options, release notes +and more. Tips for installing userspace plugins is also contained in the +documentation. -If you want to dive right into trying **neovim-flake** you can get a fully featured configuration with `nix` -language support by running: +If you want to dive right into trying **neovim-flake** you can get a fully +featured configuration with `nix` language support by running: ```console nix run github:notashelf/neovim-flake ``` -Please create an issue on the [issue tracker](../../../issues) if you find the documentation lacking or confusing. -I also appreciate any contributions to the documentation. +Please create an issue on the [issue tracker](../../../issues) if you find +the documentation lacking or confusing. I also appreciate any contributions +to the documentation. ## Help -You can create an issue on the [issue tracker](../../../issues) to ask questions or report bugs. -I am not yet on spaces like matrix or IRC, so please use the issue tracker for now. +You can create an issue on the [issue tracker](../../../issues) to ask questions +or report bugs. I am not yet on spaces like matrix or IRC, so please use the issue +tracker for now. ## Contributing -I am always looking for new ways to help improve this flake. If you would like to contribute, please read -the [contributing guide](CONTRIBUTING.md) before submitting a pull request. You can also create an -issue on the [issue tracker](../../../issues) before submitting a pull request if you would like to discuss -a feature or bug fix. +I am always looking for new ways to help improve this flake. If you would like +to contribute, please read the [contributing guide](CONTRIBUTING.md) before +submitting a pull request. You can also create an issue on the +[issue tracker](../../../issues) before submitting a pull request if you would +like to discuss a feature or bug fix. ## Philosophy -The philosophy behind this flake configuration is to create an easily configurable and reproducible Neovim environment. -While it does sacrifice in size (which I know some users will find _disagreeable_), it offers a lot of flexibility and customizability in -exchange for the large size of the flake inputs. The "KISS" (Keep it simple, stupid) principle has mostly been abandoned here, however, you _can_ -ultimately leverage the flexibility of this flake to declare a configuration that follows KISS principles, as it is very easy to bring your -own plugins and configurations from non-nix. What this flake is meant to be does eventually fall into your hands. Whether you are a -developer, writer, or live coder, you can quickly craft a config that suits every project's need. Think of it like a distribution of Neovim that you have -full control over. A distribution that takes advantage of pinning vim plugins and third party dependencies (such as tree-sitter grammars, language servers, and more). +The philosophy behind this flake configuration is to create an easily +configurable and reproducible Neovim environment. While it does sacrifice in +size (which I know some users will find _disagreeable_), it offers a lot of +flexibility and customizability in exchange for the large size of the flake +inputs. The "KISS" (Keep it simple, stupid) principle has mostly been abandoned +here, however, you _can_ ultimately leverage the flexibility of this flake to +declare a configuration that follows KISS principles, as it is very easy to +bring your own plugins and configurations from non-nix. What this flake is +meant to be does eventually fall into your hands. Whether you are a developer, +writer, or live coder, you can quickly craft a config that suits every project's +needs. Think of it like a distribution of Neovim that you have full control over. -One should never get a broken config when setting options. If setting multiple options results in a broken Neovim, file an issue! -Each plugin knows when another plugin which allows for smart configuration of keybindings and automatic setup of things -like completion sources and languages. +A distribution that takes advantage of pinning vim plugins and third party +dependencies (such as tree-sitter grammars, language servers, and more). + +One should never get a broken config when setting options. If setting multiple +options results in a broken Neovim, file an issue! Each plugin knows when another +plugin which allows for smart configuration of keybindings and automatic setup +of things like completion sources and languages. ## FAQ **Q**: Why is this flake so big?
-**A**: I have sacrificed in size in order to provide a highly configurable and reproducible Neovim environment. A binary cache is provided to -eleminate the need to build the flake from source, but it is still a large flake. If you do not need all the features, you can use the default `nix` output -instead of the `maximal` output. This will reduce size by a lot, but you will lose some language specific features. +**A**: I have sacrificed in size in order to provide a highly configurable and +reproducible Neovim environment. A binary cache is provided to eleminate the +need to build the flake from source, but it is still a large flake. If you do +not need all the features, you can use the default `nix` output instead of the +`maximal` output. This will reduce size by a lot, but you will lose some +language specific features.

**Q**: Will you try to make this flake smaller?
-**A**: Yes. As a matter of fact, I am actively working on making this flake smaller. Unfortunately the process of providing everything -possible by itself makes the flake large. Best I can do is to optimize the flake as much as possible by selecting plugins that -are small and fast. And the binary cache, so at least you don't have to build it from source. +**A**: Yes. As a matter of fact, I am actively working on making this flake +smaller. Unfortunately the process of providing everything possible by itself +makes the flake large. Best I can do is to optimize the flake as much as +possible by selecting plugins that are small and fast. And the binary cache, so +at least you don't have to build it from source.

**Q**: Will you use a plugin manager/language server installer?
-**A**: No. If you feel the need to ask that question, then you have missed the whole point of using nix and ultimately this flake. -The whole reason we use nix is to be able to handle EVERYTHING declaratively, well including the LSP and plugin installations. +**A**: No. If you feel the need to ask that question, then you have missed the +whole point of using nix and ultimately this flake. The whole reason we use nix +is to be able to handle EVERYTHING declaratively, well including the LSP and +plugin installations.

**Q**: Can you add _X_?
-**A**: Maybe. Open an issue using the appropriate template and I will consider it. I do not intend to -add _every plugin that is in existence_, but I will consider it, should it offer something useful to the flake. +**A**: Maybe. Open an issue using the appropriate template and I will consider +it. I do not intend to add _every plugin that is in existence_, but I will +consider it, should it offer something useful to the flake. ## Credits @@ -180,14 +214,16 @@ and everyone who has submitted issues or pull requests! ### Inspiration -This configuration borrows from and is based on a few other configurations, including: +This configuration borrows from and is based on a few other configurations, +including: - [@jordanisaacs's](https://github.com/jordanisaacs) [neovim-flake](https://github.com/jordanisaacs/neovim-flake) that this flake is originally based on. - [@sioodmy's](https://github.com/sioodmy) [dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design choices. - [@wiltaylor's](https://github.com/wiltaylor) [neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and design ideas. - [@gvolpe's](https://github.com/gvolpe) [neovim-flake](https://github.com/gvolpe/neovim-flake) for plugin, design and nix concepts. -I am grateful for their previous work and inspiration, and I wholeheartedly recommend checking their work out. +I am grateful for their previous work and inspiration, and I wholeheartedly +recommend checking their work out.
--- diff --git a/assets/neovim-flake-logo-work.svg b/.github/assets/neovim-flake-logo-work.svg similarity index 100% rename from assets/neovim-flake-logo-work.svg rename to .github/assets/neovim-flake-logo-work.svg diff --git a/flake.lock b/flake.lock index 7ad4c537..43165783 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "alpha-nvim": { "flake": false, "locked": { - "lastModified": 1705520464, - "narHash": "sha256-Yz5ZqxjaargJjnbmH1L43EwYp5J5w5RPREG7/smdRQc=", + "lastModified": 1708891191, + "narHash": "sha256-kTVPKZ/e1us/uHfSwFwR38lFYN8EotJq2jKz6xm/eqg=", "owner": "goolord", "repo": "alpha-nvim", - "rev": "4b36c1ca9ea475bdc006896657cf1ccc486aeffa", + "rev": "41283fb402713fc8b327e60907f74e46166f4cfd", "type": "github" }, "original": { @@ -19,11 +19,11 @@ "bufdelete-nvim": { "flake": false, "locked": { - "lastModified": 1703393686, - "narHash": "sha256-O0JRhx6UJzeZTG+XwGi/6DLaoX8hfqxwSt0W9yQXhBw=", + "lastModified": 1708814161, + "narHash": "sha256-ljUNfmpImtxFCS19HC9kFlaLlqaPDltKtnx1+/6Y33U=", "owner": "famiu", "repo": "bufdelete.nvim", - "rev": "0b9c0f182b09c51170bb9f252f15de7695e4d507", + "rev": "f6bcea78afb3060b198125256f897040538bcb81", "type": "github" }, "original": { @@ -35,11 +35,11 @@ "catppuccin": { "flake": false, "locked": { - "lastModified": 1706227543, - "narHash": "sha256-br32TBzK++QK6RqlMjyN4vmNi1cgNgDca8byZqV3oUQ=", + "lastModified": 1711706907, + "narHash": "sha256-GQjxE8lQj52pheJtHCS+9v2lsJY7wMj2IXVCoNRmQSQ=", "owner": "catppuccin", "repo": "nvim", - "rev": "afab7ec2a79c7127627dede79c0018b6e45663d0", + "rev": "aebe43db9cb26e1c70fc5b2fd4158169c405e720", "type": "github" }, "original": { @@ -51,11 +51,11 @@ "ccc": { "flake": false, "locked": { - "lastModified": 1702716924, - "narHash": "sha256-nWe7uYWPZ1LjQRVynYnPomb4EFfyh919Jsh07UPSdvg=", + "lastModified": 1711976559, + "narHash": "sha256-rSOjeklOdIPQvxNfUBG9Hm001cIlBgrPYcnm7afc9TE=", "owner": "uga-rosa", "repo": "ccc.nvim", - "rev": "ec6e23fd2c0bf4ffcf71c1271acdcee6e2c6f49c", + "rev": "46b8a38a3bc287f27789800d3d26480d093d65b5", "type": "github" }, "original": { @@ -99,11 +99,11 @@ "cinnamon-nvim": { "flake": false, "locked": { - "lastModified": 1670143364, - "narHash": "sha256-JglXQhoPgN9sQ3yuv0+VQxmKMvoQTu5lbGLSRaQkytI=", + "lastModified": 1711005384, + "narHash": "sha256-LNikkGldBpUsfyH8ThtX7RS1p/z3JzSPonT9qUU84jw=", "owner": "declancm", "repo": "cinnamon.nvim", - "rev": "c406ffda3a0302f32c23b24ab756ea20467d6578", + "rev": "559fe02fae00ffd78377e9c242b2faa25a428592", "type": "github" }, "original": { @@ -243,11 +243,11 @@ "copilot-lua": { "flake": false, "locked": { - "lastModified": 1704638182, - "narHash": "sha256-8/EPnigWaY2P4ZlVyu42DOQVOjRPgSCtmdOVbl2ACN8=", + "lastModified": 1709095198, + "narHash": "sha256-JX3sdsnOnjkY7r9fCtC2oauo0PXF3SQ+SHUo8ifBvAc=", "owner": "zbirenbaum", "repo": "copilot.lua", - "rev": "b03617a6dc4bc88b65ab5deac1631da9a9c2dcaf", + "rev": "f7612f5af4a7d7615babf43ab1e67a2d790c13a6", "type": "github" }, "original": { @@ -259,11 +259,11 @@ "crates-nvim": { "flake": false, "locked": { - "lastModified": 1706141227, - "narHash": "sha256-vkq1N6XvJOSsIbCCcAk1+9ReRMF4it/mofq55JhwQRY=", + "lastModified": 1710361360, + "narHash": "sha256-wfwSHuP05PEqCbpEG7GStGElMLkrDEbPW7V6p1EANGU=", "owner": "Saecki", "repo": "crates.nvim", - "rev": "f2a169840e97a8ed2048abb507d2742c3895c85b", + "rev": "b4f4987ccdb1cc3899ee541ef4375c73c48c4570", "type": "github" }, "original": { @@ -275,11 +275,11 @@ "dashboard-nvim": { "flake": false, "locked": { - "lastModified": 1699578883, - "narHash": "sha256-LNjYIRL5xZyLgFkoTu3K5USOfk1mtaXe5RhKBAbzYRw=", + "lastModified": 1712122933, + "narHash": "sha256-s2PDyOnE3jVk+RCp0aaV2vVJGkO394iDhQTEHRcb9kY=", "owner": "glepnir", "repo": "dashboard-nvim", - "rev": "63df28409d940f9cac0a925df09d3dc369db9841", + "rev": "7c0c09d55118a2afeb8874e885f87ae80d8ff452", "type": "github" }, "original": { @@ -324,11 +324,11 @@ "dracula": { "flake": false, "locked": { - "lastModified": 1705994462, - "narHash": "sha256-yGV/bA7+Xi+LBi4Iz/SZDVl0KWoo+IO9kgfSIgTk0Ow=", + "lastModified": 1708834650, + "narHash": "sha256-I3rtbJYv1D+kniOLL9hmTF3ucp/qSNewnO2GmYAERko=", "owner": "Mofiqul", "repo": "dracula.nvim", - "rev": "a6cb758d4b182d9f2b7e742910078d94877c1059", + "rev": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c", "type": "github" }, "original": { @@ -340,11 +340,11 @@ "dressing-nvim": { "flake": false, "locked": { - "lastModified": 1706209758, - "narHash": "sha256-P8XlaiNNbOtkOS2un+pfCOOayOzJ/8uLQFrcFlSW7tQ=", + "lastModified": 1710299803, + "narHash": "sha256-9AwOFTRvhWFo7USgoFYfceiojZM62IXPpBs8CnSqc18=", "owner": "stevearc", "repo": "dressing.nvim", - "rev": "0e88293ce3459f4bb310125f3366304af6dc7990", + "rev": "18e5beb3845f085b6a33c24112b37988f3f93c06", "type": "github" }, "original": { @@ -356,11 +356,11 @@ "elixir-ls": { "flake": false, "locked": { - "lastModified": 1705860624, - "narHash": "sha256-pd/ZkDpzlheEJfX7X6fFWY4Y5B5Y2EnJMBtuNHPuUJw=", + "lastModified": 1711286188, + "narHash": "sha256-OIB5f+FBOPsTWKGWyoU+/NQDMsJXBdj1v7UclbTP5ZY=", "owner": "elixir-lsp", "repo": "elixir-ls", - "rev": "d10ce2cfe3acf475949e9a21984d18be579d7ec4", + "rev": "3e71900e0d0891f9f95e35d9a52b16c6a773a259", "type": "github" }, "original": { @@ -372,11 +372,11 @@ "elixir-tools": { "flake": false, "locked": { - "lastModified": 1703976612, - "narHash": "sha256-6QdjqugY2kouDVzQa4bxFb9dp9vVantueO+6nnbnOwo=", + "lastModified": 1710172806, + "narHash": "sha256-pVDeS9oCFzA9t9J/JfYG/RfdMoSmaaERd5nUgL9KHyM=", "owner": "elixir-tools", "repo": "elixir-tools.nvim", - "rev": "163522196c962fa87cac0df2a0d1ad332e1e0755", + "rev": "4d003f4b41ab9b4f8b569104fa7818f048ed4e25", "type": "github" }, "original": { @@ -388,11 +388,11 @@ "fidget-nvim": { "flake": false, "locked": { - "lastModified": 1707329128, - "narHash": "sha256-mMLAhAbIs33RoU9c8COchbWRr2NM231zJn6TtwJmI+4=", + "lastModified": 1710942727, + "narHash": "sha256-8pBg8uQto5UzNBRhjFFMMmWLnmpYsG0L1mDa+FN8tpU=", "owner": "j-hui", "repo": "fidget.nvim", - "rev": "ad8873c16faa123fe3f9fd6539c41dfb0f97a9e9", + "rev": "933db4596e4bab1b09b6d48a10e21819e4cc458f", "type": "github" }, "original": { @@ -422,11 +422,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1704982712, - "narHash": "sha256-2Ptt+9h8dczgle2Oo6z5ni5rt/uLMG47UFTR1ry/wgg=", + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "07f6395285469419cf9d078f59b5b49993198c00", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", "type": "github" }, "original": { @@ -440,11 +440,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -471,11 +471,11 @@ "flutter-tools": { "flake": false, "locked": { - "lastModified": 1705943990, - "narHash": "sha256-g/cgFJ8kwBk1gNVaio+s1sa5KqpC/LMf06/6+MOPZk4=", + "lastModified": 1711622317, + "narHash": "sha256-TQRz2MHg6qnzZGUDVFUoaZJiTBwQ3Hjqvc8AAeVS93Y=", "owner": "akinsho", "repo": "flutter-tools.nvim", - "rev": "271eec9edb0f1a2bf30ad449ec3b4eeb2c88af05", + "rev": "4f18033c3b78aa5450e538d81dfbbb3e67aeadec", "type": "github" }, "original": { @@ -503,11 +503,11 @@ "gitsigns-nvim": { "flake": false, "locked": { - "lastModified": 1706282483, - "narHash": "sha256-jVzZPD9RdM0Ie3nWuZgv+XVhwWzLJ2QODrIGRCENWjo=", + "lastModified": 1712162672, + "narHash": "sha256-uEHuKccCAYpLGVJovz2PY2Q7THA47z8TA5CHWexBv3E=", "owner": "lewis6991", "repo": "gitsigns.nvim", - "rev": "fb9fd5312476b51a42a98122616e1c448d823d5c", + "rev": "b45ff86f5618d1421a88c12d4feb286b80a1e2d3", "type": "github" }, "original": { @@ -535,11 +535,11 @@ "gruvbox": { "flake": false, "locked": { - "lastModified": 1704132908, - "narHash": "sha256-p/y65ub1qL+5g0ZiWzaTyQeiP7LtVfsdcdJ0eb0A7Og=", + "lastModified": 1706538659, + "narHash": "sha256-jWnrRy/PT7D0UcPGL+XTbKHWvS0ixvbyqPtTzG9HY84=", "owner": "ellisonleao", "repo": "gruvbox.nvim", - "rev": "4176b0b720db0c90ab4030e5c1b4893faf41fd51", + "rev": "6e4027ae957cddf7b193adfaec4a8f9e03b4555f", "type": "github" }, "original": { @@ -599,11 +599,11 @@ "image-nvim": { "flake": false, "locked": { - "lastModified": 1707861531, - "narHash": "sha256-mh3J3lW2Co2uA7YJzSGum0ZmpJBP0ZzBWUvJLAI9bHw=", + "lastModified": 1711809713, + "narHash": "sha256-4xsyVDZOFidvLqwfWRB7BPMOejWk3/uhsnUsCNG/hpU=", "owner": "3rd", "repo": "image.nvim", - "rev": "4c6cb5ad93ee93d8d7b7c84e1eb291cee99f0a0e", + "rev": "a0b756d589c1623ebbfe344666e6d7c49bdc9d71", "type": "github" }, "original": { @@ -615,11 +615,11 @@ "indent-blankline": { "flake": false, "locked": { - "lastModified": 1705027513, - "narHash": "sha256-T0tbTyD9+J7OWcvfrPolrXbjGiXzEXhTtgC9Xj3ANFc=", + "lastModified": 1710388427, + "narHash": "sha256-Xp8ZQBz0in2MX3l0bnLUsSbH0lDPE+QvdmFpBFry5yY=", "owner": "lukas-reineke", "repo": "indent-blankline.nvim", - "rev": "12e92044d313c54c438bd786d11684c88f6f78cd", + "rev": "3d08501caef2329aba5121b753e903904088f7e6", "type": "github" }, "original": { @@ -647,11 +647,11 @@ "leap-nvim": { "flake": false, "locked": { - "lastModified": 1706284537, - "narHash": "sha256-kA6Lkfx7RHPUZjhxx4tc0gsAdhrfFvp6yY5qO+ZXUtM=", + "lastModified": 1711935259, + "narHash": "sha256-HcuNaKyf+rmhg3t4BQXiRlyeavwyhy16pfPn1Y1l09k=", "owner": "ggandor", "repo": "leap.nvim", - "rev": "14eda5bb233354933baa99b6d40bef3a40dbeaae", + "rev": "7a9407d17fab3a1c3cfe201965d680a408776152", "type": "github" }, "original": { @@ -663,11 +663,11 @@ "lsp-lines": { "flake": false, "locked": { - "lastModified": 1698584731, - "narHash": "sha256-3DWM2mTnm6b7J4cYUwCKBGHkXw/dQDO0ZTJXkTl06aE=", + "lastModified": 1709989705, + "narHash": "sha256-opViLzbwtyUgDoaVKz4z6SN06N8jCQ0YmoqPIht8e64=", "owner": "~whynothugo", "repo": "lsp_lines.nvim", - "rev": "cf2306dd332e34a3e91075b40bdd4f6db824b2ee", + "rev": "6f3defec73f7c87939e800e9afa5d0571b19b401", "type": "sourcehut" }, "original": { @@ -679,11 +679,11 @@ "lsp-signature": { "flake": false, "locked": { - "lastModified": 1701211782, - "narHash": "sha256-4GcTfu7MRpZUi5dqewaddSvaOezRl9ROKrR7wnnLnKE=", + "lastModified": 1710647656, + "narHash": "sha256-O7y7pcCvF0xUFamG+wMLe4mC6hUQ679rJV+ZUoWB0oY=", "owner": "ray-x", "repo": "lsp_signature.nvim", - "rev": "fed2c8389c148ff1dfdcdca63c2b48d08a50dea0", + "rev": "c6aeb2f1d2538bbdfdaab1664d9d4c3c75aa9db8", "type": "github" }, "original": { @@ -727,11 +727,11 @@ "lualine": { "flake": false, "locked": { - "lastModified": 1706181415, - "narHash": "sha256-LMMcRY4qnGywdK6Bl4YeAEKLhnRuOZ2txn4oYoso2gI=", + "lastModified": 1710998293, + "narHash": "sha256-+2fi58GolO3e0O7+kl+idNeFuTfJA1b5yCBdY2RnVjA=", "owner": "hoob3rt", "repo": "lualine.nvim", - "rev": "7d131a8d3ba5016229e8a1d08bf8782acea98852", + "rev": "b5e8bb642138f787a2c1c5aedc2a78cb2cebbd67", "type": "github" }, "original": { @@ -759,11 +759,11 @@ "minimap-vim": { "flake": false, "locked": { - "lastModified": 1696276849, - "narHash": "sha256-bPW/wDCvItpl0VIQCgz5AEYfx1aAnIMhB1S/tJN5/80=", + "lastModified": 1710689313, + "narHash": "sha256-GR8VAHla5HWry1TAZQv0Xp7iG256vIGeQcBGMxyt310=", "owner": "wfxr", "repo": "minimap.vim", - "rev": "701f4cf4b60a3e1685d2da484282f3a3d8bf9db6", + "rev": "395378137e6180762d5b963ca9ad5ac2db5d3283", "type": "github" }, "original": { @@ -812,11 +812,11 @@ "neocord": { "flake": false, "locked": { - "lastModified": 1704948184, - "narHash": "sha256-HnaMKTNjMuDwHDvxHH5kd4ysa5WU+MlbdD9jH/iJcU8=", + "lastModified": 1711651358, + "narHash": "sha256-ZZF7ttn/6QIsaub1m0LV0ZirvNVXyFh+WDc39wi4UsM=", "owner": "IogaMaster", "repo": "neocord", - "rev": "9b624d5189f699ab454e9515262c13965395b8dd", + "rev": "6269823e78a2d2d8c3954068da196879cf2f0fe6", "type": "github" }, "original": { @@ -828,11 +828,11 @@ "neodev-nvim": { "flake": false, "locked": { - "lastModified": 1706249139, - "narHash": "sha256-BRsZdc1TO88pCoehDv7ervBjaeOpcmSGm/RZAInhI9Q=", + "lastModified": 1711715247, + "narHash": "sha256-mAJOMVN7/xO7ykVNAeTeX+z2A/7yB8zdqlEKHL6Pb74=", "owner": "folke", "repo": "neodev.nvim", - "rev": "64b2a51b02c6f2ae177c745e4d8bc801a339fe09", + "rev": "ce9a2e8eaba5649b553529c5498acb43a6c317cd", "type": "github" }, "original": { @@ -867,11 +867,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1708807242, - "narHash": "sha256-sRTRkhMD4delO/hPxxi+XwLqPn8BuUq6nnj4JqLwOu0=", + "lastModified": 1711703276, + "narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "73de017ef2d18a04ac4bfd0c02650007ccb31c2a", + "rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", "type": "github" }, "original": { @@ -884,11 +884,11 @@ "nixpkgs-lib": { "locked": { "dir": "lib", - "lastModified": 1703961334, - "narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=", + "lastModified": 1711703276, + "narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9", + "rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", "type": "github" }, "original": { @@ -966,11 +966,11 @@ "noice-nvim": { "flake": false, "locked": { - "lastModified": 1705952416, - "narHash": "sha256-lNCdwB0B5arbTEIHdDoQ19/vQ0UT89AQFwZM+RHqOTg=", + "lastModified": 1711471279, + "narHash": "sha256-y6gHNkWVsIuwBf7MblCTKTZSqjGDxqeFeQZWexzwk94=", "owner": "folke", "repo": "noice.nvim", - "rev": "bf67d70bd7265d075191e7812d8eb42b9791f737", + "rev": "0cbe3f88d038320bdbda3c4c5c95f43a13c3aa12", "type": "github" }, "original": { @@ -982,27 +982,28 @@ "none-ls": { "flake": false, "locked": { - "lastModified": 1706069423, - "narHash": "sha256-s+Hp0Yzge7FKKDez4DO8uytsNORIqeNWYOLSO7kSZbo=", + "lastModified": 1708525772, + "narHash": "sha256-VCDUKiy9C3Bu9suf2bI6XSis1+j01oFC3GFPyQxi74c=", "owner": "nvimtools", "repo": "none-ls.nvim", - "rev": "a311c7cc8f17543143a7482cdbe3a384c371d56a", + "rev": "bb680d752cec37949faca7a1f509e2fe67ab418a", "type": "github" }, "original": { "owner": "nvimtools", "repo": "none-ls.nvim", + "rev": "bb680d752cec37949faca7a1f509e2fe67ab418a", "type": "github" } }, "nui-nvim": { "flake": false, "locked": { - "lastModified": 1704411133, - "narHash": "sha256-SWG0IQDNXrgWK1ApQSpc2oPKNYgTPend877DQ6FuqUc=", + "lastModified": 1710740032, + "narHash": "sha256-Zr5CNx6BIM6naCXW8YBc/Oj1qOtWV/3tuMoaaZjoSZA=", "owner": "MunifTanjim", "repo": "nui.nvim", - "rev": "35da9ca1de0fc4dda96c2e214d93d363c145f418", + "rev": "cbd2668414331c10039278f558630ed19b93e69b", "type": "github" }, "original": { @@ -1014,11 +1015,11 @@ "nvim-autopairs": { "flake": false, "locked": { - "lastModified": 1705959312, - "narHash": "sha256-4sZoZfg6ORbEwbvjIRnaDrKtVnoHpx7cAOcxn1Er6pg=", + "lastModified": 1710930065, + "narHash": "sha256-H4mJ43Eyo36noIqYZ0lyqM7WPwgIKqi96OjW5F3pfvU=", "owner": "windwp", "repo": "nvim-autopairs", - "rev": "096d0baecc34f6c5d8a6dd25851e9d5ad338209b", + "rev": "dbfc1c34bed415906395db8303c71039b3a3ffb4", "type": "github" }, "original": { @@ -1030,11 +1031,11 @@ "nvim-bufferline-lua": { "flake": false, "locked": { - "lastModified": 1706180994, - "narHash": "sha256-/iGzUDJaodkUyWpwim8UtwaRuarfu/Nk6wxVApk+QxY=", + "lastModified": 1709805539, + "narHash": "sha256-drvgwupiyRAoShL2enXEYUumkYJnG+QtIkBIVqVZK+U=", "owner": "akinsho", "repo": "nvim-bufferline.lua", - "rev": "d6cb9b7cac52887bcac65f8698e67479553c0748", + "rev": "64e2c5def50dfd6b6f14d96a45fa3d815a4a1eef", "type": "github" }, "original": { @@ -1046,11 +1047,11 @@ "nvim-cmp": { "flake": false, "locked": { - "lastModified": 1702541213, - "narHash": "sha256-BtAYRYn6m788zAq/mNnbAzAxp1TGf9QkRE0hSOp9sdc=", + "lastModified": 1712041554, + "narHash": "sha256-DBxQTmwuEGj2g7LP7d1PJk/SyO0iJq2CIIHsFh0QJ4I=", "owner": "hrsh7th", "repo": "nvim-cmp", - "rev": "538e37ba87284942c1d76ed38dd497e54e65b891", + "rev": "ce16de5665c766f39c271705b17fff06f7bcb84f", "type": "github" }, "original": { @@ -1126,11 +1127,11 @@ "nvim-dap": { "flake": false, "locked": { - "lastModified": 1705151920, - "narHash": "sha256-9Rc4dxbgN1LxoXPXHTi+V92MA0fEn5PveqCSMHbgn98=", + "lastModified": 1711382674, + "narHash": "sha256-HoLnYeA18TpHM1SJ3NOY53ZAyBo2y2EoUbAIr7TqtQI=", "owner": "mfussenegger", "repo": "nvim-dap", - "rev": "9adbfdca13afbe646d09a8d7a86d5d031fb9c5a5", + "rev": "405df1dcc2e395ab5173a9c3d00e03942c023074", "type": "github" }, "original": { @@ -1142,11 +1143,11 @@ "nvim-dap-ui": { "flake": false, "locked": { - "lastModified": 1705942789, - "narHash": "sha256-4tYSdxPj+/hxd8KNzCU6Lvf+ACxpKgYyGOlF+Jwzxa8=", + "lastModified": 1710867604, + "narHash": "sha256-KAwCt8E3lC0fzXQ9GpPsdb9wdWC6G2P4C/YFQFY9AAM=", "owner": "rcarriga", "repo": "nvim-dap-ui", - "rev": "d845ebd798ad1cf30aa4abd4c4eff795cdcfdd4f", + "rev": "edfa93f60b189e5952c016eee262d0685d838450", "type": "github" }, "original": { @@ -1190,11 +1191,11 @@ "nvim-lspconfig": { "flake": false, "locked": { - "lastModified": 1705757419, - "narHash": "sha256-StYsN9C2rV471JkncUR1PFeXs0S15ZGTF1DigSbwOHI=", + "lastModified": 1712139869, + "narHash": "sha256-DMhB4L/0FjYbhNx7SwFnyFVa4PLVLlwB4uiNbiKUmEo=", "owner": "neovim", "repo": "nvim-lspconfig", - "rev": "8917d2c830e04bf944a699b8c41f097621283828", + "rev": "96e5711040df23583591391ce49e556b8cd248d8", "type": "github" }, "original": { @@ -1206,11 +1207,11 @@ "nvim-navbuddy": { "flake": false, "locked": { - "lastModified": 1694669446, - "narHash": "sha256-zy1Tq8M5UITNAwtAlFYaUFlHnIZ5LWD9ZLaZcy7ulQ8=", + "lastModified": 1711239174, + "narHash": "sha256-EZXzFjGsZHkb2Ui5uvOottPHA8X15F6xyikab4dBlYk=", "owner": "SmiteshP", "repo": "nvim-navbuddy", - "rev": "f137a3466a6cd1965cdcc5398daff54e66eebbe5", + "rev": "f34237e8a41ebc6e2716af2ebf49854d8c5289c8", "type": "github" }, "original": { @@ -1251,14 +1252,30 @@ "type": "github" } }, + "nvim-nio": { + "flake": false, + "locked": { + "lastModified": 1712067294, + "narHash": "sha256-bjYtZygrL05qB2dM7Q8lJor81VYO+u8/JWQqfZ19Wzk=", + "owner": "nvim-neotest", + "repo": "nvim-nio", + "rev": "173f285eebb410199273fa178aa517fd2d7edd80", + "type": "github" + }, + "original": { + "owner": "nvim-neotest", + "repo": "nvim-nio", + "type": "github" + } + }, "nvim-notify": { "flake": false, "locked": { - "lastModified": 1705342184, - "narHash": "sha256-WhC80NnWXEAYHLORpUPIXb2s1ERJxyK3l2L9oke68mo=", + "lastModified": 1708161547, + "narHash": "sha256-xJYPOX4YLcWojMCdP1RO22/7FMrbcBQxqxrcVCE2TrU=", "owner": "rcarriga", "repo": "nvim-notify", - "rev": "80b67b265530632505193553d05127ae7fe09ddd", + "rev": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15", "type": "github" }, "original": { @@ -1270,11 +1287,11 @@ "nvim-session-manager": { "flake": false, "locked": { - "lastModified": 1705767424, - "narHash": "sha256-BTVhCevq40A7yOYp2fLg6N9A+yarIWJM83Z2bfvlQuU=", + "lastModified": 1708284146, + "narHash": "sha256-+TDWY8mprJfUp9ZFKbz83to7XW8iiovja22jHms+N1A=", "owner": "Shatur", "repo": "neovim-session-manager", - "rev": "b8a22f2c88429a11272117a901db66055abf3e7f", + "rev": "d8e1ba3bbcf3fdc6a887bcfbd94c48ae4707b457", "type": "github" }, "original": { @@ -1286,11 +1303,11 @@ "nvim-surround": { "flake": false, "locked": { - "lastModified": 1705526094, - "narHash": "sha256-CGAQtBxhiP6AUQzwdra5AOpsNu+oeLO2hCJnmL61jgE=", + "lastModified": 1709063002, + "narHash": "sha256-uInXJq+TrfKM9WfOlUAYxbDad9mwf7DK5lETyTu+ShM=", "owner": "kylechui", "repo": "nvim-surround", - "rev": "0c02c52182a9c2a7fa7e122b4037f6408e98434a", + "rev": "84a26afce16cffa7e3322cfa80a42cddf60616eb", "type": "github" }, "original": { @@ -1302,11 +1319,11 @@ "nvim-tree-lua": { "flake": false, "locked": { - "lastModified": 1705818283, - "narHash": "sha256-EKAzWIT2Qs65Il1pwgpkFsCogFViapUiSHcZgVy+QsY=", + "lastModified": 1711866287, + "narHash": "sha256-AMbUthY+49wREBr7EQSZ/tH8hT4gixPfcPT+ZzssUKw=", "owner": "nvim-tree", "repo": "nvim-tree.lua", - "rev": "7bdb220d0fe604a77361e92cdbc7af1b8a412126", + "rev": "d8d3a1590a05b2d8b5eb26e2ed1c6052b1b47a77", "type": "github" }, "original": { @@ -1318,11 +1335,11 @@ "nvim-treesitter-context": { "flake": false, "locked": { - "lastModified": 1706217055, - "narHash": "sha256-QhmTXikUIye+xxLw52ttRJz9T0bfhn/ks5VSQd8tDo0=", + "lastModified": 1711099836, + "narHash": "sha256-iDBFUMUjGJXzEioZ4cTydDYHRR30GF6z9W0M7IZUasc=", "owner": "nvim-treesitter", "repo": "nvim-treesitter-context", - "rev": "9c06b115abc57c99cf0aa81dc29490f5001f57a1", + "rev": "f19766163c18515fb4d3c12d572bf9cba6cdb990", "type": "github" }, "original": { @@ -1334,11 +1351,11 @@ "nvim-ts-autotag": { "flake": false, "locked": { - "lastModified": 1706174398, - "narHash": "sha256-C3FOh11eF5Blzh6vsFSA6AB7opXl5Gocdti1QhFZ2vM=", + "lastModified": 1707265789, + "narHash": "sha256-cPIEIjcYxX3ZkOyou2mYlHMdhBxCoVTpJVXZtiWe9Ks=", "owner": "windwp", "repo": "nvim-ts-autotag", - "rev": "a65b202cfd08e0e69e531eab737205ff5bc082a4", + "rev": "531f48334c422222aebc888fd36e7d109cb354cd", "type": "github" }, "original": { @@ -1350,11 +1367,11 @@ "nvim-web-devicons": { "flake": false, "locked": { - "lastModified": 1706072160, - "narHash": "sha256-w038PU9i1onEBo3x4bo1kDz9Fo46Whd8ZJhyIqxz3I8=", + "lastModified": 1711417099, + "narHash": "sha256-G8URFQdABLf3ptj+9kwSFGXly9D+4lkt3SXfbhVDH6g=", "owner": "nvim-tree", "repo": "nvim-web-devicons", - "rev": "b427ac5f9dff494f839e81441fb3f04a58cbcfbc", + "rev": "3ee60deaa539360518eaab93a6c701fe9f4d82ef", "type": "github" }, "original": { @@ -1366,11 +1383,11 @@ "obsidian-nvim": { "flake": false, "locked": { - "lastModified": 1706230460, - "narHash": "sha256-jl03+C9/L081eza6XwK05GiGZI0U82wqQBMwTjtedv8=", + "lastModified": 1711994732, + "narHash": "sha256-RD5EhYv2AZvCywxQYKkPjZPY/jEjl2rEofMVCHO6SJQ=", "owner": "epwalsh", "repo": "obsidian.nvim", - "rev": "194f9fc798ac0f73dbac2e83fc3d5c99b8f70e78", + "rev": "d70f3289399c25153b7f503b838afbf981124a37", "type": "github" }, "original": { @@ -1382,11 +1399,11 @@ "onedark": { "flake": false, "locked": { - "lastModified": 1705931596, - "narHash": "sha256-jjvZ2z93xd1Yng8g6+cdsXhLkm2lC7DSUHiFYC+Gg5k=", + "lastModified": 1706527208, + "narHash": "sha256-1+aO8vrUGEe/NIVI1C1xJyuQVPQZ1s510lopkEVP7No=", "owner": "navarasu", "repo": "onedark.nvim", - "rev": "14e5de43cf1ff761c280d1ff5b9980897f5b46c7", + "rev": "1230aaf2a427b2c5b73aba6e4a9a5881d3e69429", "type": "github" }, "original": { @@ -1398,11 +1415,11 @@ "orgmode-nvim": { "flake": false, "locked": { - "lastModified": 1706216082, - "narHash": "sha256-M9AI3LlJvs6ZqQPeYr+rqRFu4gYVZbLFV3PUuZ77ReE=", + "lastModified": 1712161945, + "narHash": "sha256-44dTemgSevEdiluUanGLySo7WbvKrXW+n2dUwUO4cqY=", "owner": "nvim-orgmode", "repo": "orgmode", - "rev": "ab045e3084d5987e8939d25d69b09baaf762278c", + "rev": "ddcfbb1e52b2ff5b90469eb13214676931a66e09", "type": "github" }, "original": { @@ -1431,11 +1448,11 @@ "plenary-nvim": { "flake": false, "locked": { - "lastModified": 1705841956, - "narHash": "sha256-awRAI1ov9OBt6VuNxk/qjPTSPBYsMJzURKVV+IA7kok=", + "lastModified": 1711369325, + "narHash": "sha256-wM/FuK24NPEyaWntwT+mi2SuPExC/abXDK9c2WvgUBk=", "owner": "nvim-lua", "repo": "plenary.nvim", - "rev": "663246936325062427597964d81d30eaa42ab1e4", + "rev": "8aad4396840be7fc42896e3011751b7609ca4119", "type": "github" }, "original": { @@ -1567,6 +1584,7 @@ "nvim-navbuddy": "nvim-navbuddy", "nvim-navic": "nvim-navic", "nvim-neoclip": "nvim-neoclip", + "nvim-nio": "nvim-nio", "nvim-notify": "nvim-notify", "nvim-session-manager": "nvim-session-manager", "nvim-surround": "nvim-surround", @@ -1608,11 +1626,11 @@ "rose-pine": { "flake": false, "locked": { - "lastModified": 1707703907, - "narHash": "sha256-jmDGDlCurGAG85SglAwmQr943kVr8KUr11zpPejQliQ=", + "lastModified": 1711769966, + "narHash": "sha256-GVYCkyFdVgye/8pEXPT8Y+4YyLmivgX/IHht/G1DdEA=", "owner": "rose-pine", "repo": "neovim", - "rev": "f01ce3a71748a92997d266cfe2c985decd18c601", + "rev": "19055dfe90bfa46a1e5b0a706d13980bdffa2dee", "type": "github" }, "original": { @@ -1681,11 +1699,11 @@ "smartcolumn": { "flake": false, "locked": { - "lastModified": 1703592909, - "narHash": "sha256-c5tENO4LJaSRELxuCOp/aI94ifhKjqd8J2chJbxfFdc=", + "lastModified": 1710067624, + "narHash": "sha256-DHIeDNUF9n9s14GVeojIwc5QUPwJMYYl3gRvhvO/rdE=", "owner": "m4xshen", "repo": "smartcolumn.nvim", - "rev": "a52915d6d9abf9972e249ebcffcc651cf9b062dd", + "rev": "cefb17be095ad5526030a21bb2a80553cae09127", "type": "github" }, "original": { @@ -1791,11 +1809,11 @@ "telescope": { "flake": false, "locked": { - "lastModified": 1706154992, - "narHash": "sha256-uagWtwd/L07RRUpSu+kVv0qD+neySSmSrIeFBJ0gZiM=", + "lastModified": 1712065014, + "narHash": "sha256-8Bp1E9JY1MByjRCcON1HJLYRswLx63lmz20rGrJW7Wc=", "owner": "nvim-telescope", "repo": "telescope.nvim", - "rev": "1bfbb1fb5c56d2dbe33216fcb2ebe82e499aa06c", + "rev": "4626aaa2bcfdacf55fd6d44b430e2df81b2403ff", "type": "github" }, "original": { @@ -1848,11 +1866,11 @@ "todo-comments": { "flake": false, "locked": { - "lastModified": 1705847650, - "narHash": "sha256-DiyieXXx7iYGWkpeOvduJf0n7dnpaQ7rXmaWvZQaCyE=", + "lastModified": 1711553769, + "narHash": "sha256-BJNU01iTRDNrPv48fgiJRS+ouaHkoqw2AYXKDRgDzfw=", "owner": "folke", "repo": "todo-comments.nvim", - "rev": "833d8dd8b07eeda37a09e99460f72a02616935cb", + "rev": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d", "type": "github" }, "original": { @@ -1864,11 +1882,11 @@ "toggleterm-nvim": { "flake": false, "locked": { - "lastModified": 1705944058, - "narHash": "sha256-y+83w0D2jD68QJpBCYXLqUUxVu9MTBZ+nJutYD7jAoQ=", + "lastModified": 1707733615, + "narHash": "sha256-FJyDxQm2vs9R4WkqAbh6ryCvEABfrLSKRrAGo/qI5jM=", "owner": "akinsho", "repo": "toggleterm.nvim", - "rev": "b49df5cdce67a8964d1b027dae94bde212092b51", + "rev": "193786e0371e3286d3bc9aa0079da1cd41beaa62", "type": "github" }, "original": { @@ -1880,11 +1898,11 @@ "tokyonight": { "flake": false, "locked": { - "lastModified": 1706078362, - "narHash": "sha256-qHuX21iC8edV5K0RgHin4PowMtKBXWXQgvHjx2SPTKE=", + "lastModified": 1711665767, + "narHash": "sha256-ItCmSUMMTe8iQeneIJLuWedVXsNgm+FXNtdrrdJ/1oE=", "owner": "folke", "repo": "tokyonight.nvim", - "rev": "e3301873c1e96903daebb98cc9b5926810bf73dd", + "rev": "9bf9ec53d5e87b025e2404069b71e7ebdc3a13e5", "type": "github" }, "original": { @@ -1896,11 +1914,11 @@ "trouble": { "flake": false, "locked": { - "lastModified": 1697626811, - "narHash": "sha256-8nLghiueYOtWY7OGVxow9A2G/5lgt+Kt5D8q1xeJvVg=", + "lastModified": 1711693365, + "narHash": "sha256-kIQ72fqAsiMF9jq0MzC6peaHJddYn5PRNXfYFHTQB5Q=", "owner": "folke", "repo": "trouble.nvim", - "rev": "f1168feada93c0154ede4d1fe9183bf69bac54ea", + "rev": "b9cf677f20bb2faa2dacfa870b084e568dca9572", "type": "github" }, "original": { @@ -1945,11 +1963,11 @@ "vim-dirtytalk": { "flake": false, "locked": { - "lastModified": 1697142601, - "narHash": "sha256-ezbcgCvOXhPSpsOZpCI2QIaFFaRGZAFbuAluMvB7Jjk=", + "lastModified": 1711553630, + "narHash": "sha256-1cLseaHfWgyAvzHcK93nl9sy66J/zvlnK7P4vnIthmY=", "owner": "psliwka", "repo": "vim-dirtytalk", - "rev": "f5b0d51a7d822177814e7edc116ca484f852665f", + "rev": "d2929ffff8639b2b4b4bb7c2b6c04575c1322d2f", "type": "github" }, "original": { @@ -1961,11 +1979,11 @@ "vim-illuminate": { "flake": false, "locked": { - "lastModified": 1706241276, - "narHash": "sha256-8stuFv+PzjmFKib1Y7kwK4C1db5dlDyptuaz9iU+ptM=", + "lastModified": 1707016059, + "narHash": "sha256-KNIu4cNyZddZSRS8KZ0U0T8uSSLJu8iqNLQN8e+Bv94=", "owner": "RRethy", "repo": "vim-illuminate", - "rev": "97c1265ff0b67064b6cfdc15bafc50202a537ae2", + "rev": "305bf07b919ac526deb5193280379e2f8b599926", "type": "github" }, "original": { @@ -1977,11 +1995,11 @@ "vim-markdown": { "flake": false, "locked": { - "lastModified": 1698870120, - "narHash": "sha256-d3GDuMlnhweAajSc284wWN/h0teu5uFG6NQTWa+dcxo=", + "lastModified": 1709279705, + "narHash": "sha256-eKwWdyvMZ7FV3FvOtqWVD7pulXNnhbEEjHq7MYg1woU=", "owner": "preservim", "repo": "vim-markdown", - "rev": "46add6c3017d3e4035dc10ffa9cb54221d8dfe1a", + "rev": "a657e697376909c41475a686eeef7fc7a4972d94", "type": "github" }, "original": { @@ -2094,11 +2112,11 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1706288111, - "narHash": "sha256-CvSS/BMm86Uzjeb8pEkWa3qnuzMiPPmT8hf5lDOP6TE=", + "lastModified": 1712017348, + "narHash": "sha256-At+mk7gHMk2kbisQhkts8cYkz7XhIRei9+zT3wP8bT8=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "7f5d4cbecf3aa75ac8afaef8a20723b3a57f7d20", + "rev": "63bdd97bf1c93a1da1c658ec9ab974fef52a7280", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 25bf39ed..51c88616 100644 --- a/flake.nix +++ b/flake.nix @@ -46,7 +46,7 @@ default = self'.devShells.lsp; nvim-nix = pkgs.mkShell {nativeBuildInputs = [config.packages.nix];}; lsp = pkgs.mkShell { - nativeBuildInputs = with pkgs; [nil statix deadnix]; + nativeBuildInputs = with pkgs; [nil statix deadnix alejandra]; }; }; }; @@ -117,7 +117,8 @@ }; none-ls = { - url = "github:nvimtools/none-ls.nvim"; + # https://github.com/nvimtools/none-ls.nvim/issues/58 + url = "github:nvimtools/none-ls.nvim/bb680d752cec37949faca7a1f509e2fe67ab418a"; flake = false; }; @@ -589,5 +590,11 @@ url = "github:tpope/vim-repeat"; flake = false; }; + + nvim-nio = { + # (required nvim-dap-ui) + url = "github:nvim-neotest/nvim-nio"; + flake = false; + }; }; } diff --git a/lib/binds.nix b/lib/binds.nix index c52e255a..34d7a7ce 100644 --- a/lib/binds.nix +++ b/lib/binds.nix @@ -1,6 +1,6 @@ {lib}: let inherit (lib.options) mkOption; - inherit (lib.modules) mkIf; + inherit (lib.modules) mkIf mkDefault; inherit (lib.types) nullOr str; inherit (lib.attrsets) isAttrs mapAttrs; @@ -65,6 +65,8 @@ mkSetLuaBinding = binding: action: mkLuaBinding binding.value action binding.description; + + pushDownDefault = attr: mapAttrs (_name: value: mkDefault value) attr; }; in binds diff --git a/lib/dag.nix b/lib/dag.nix index 0b2dfc4b..ba4d81ce 100644 --- a/lib/dag.nix +++ b/lib/dag.nix @@ -8,13 +8,16 @@ # - the addition of the function `entryBefore` indicating a "wanted # by" relationship. {lib}: let - inherit (lib) all filterAttrs nvim mapAttrs toposort; + inherit (builtins) isAttrs attrValues attrNames elem all; + inherit (lib.attrsets) filterAttrs mapAttrs; + inherit (lib.lists) toposort; + inherit (lib.nvim.dag) isEntry entryBetween; in { empty = {}; isEntry = e: e ? data && e ? after && e ? before; isDag = dag: - builtins.isAttrs dag && all nvim.dag.isEntry (builtins.attrValues dag); + isAttrs dag && all isEntry (attrValues dag); /* Takes an attribute set containing entries built by entryAnywhere, @@ -76,8 +79,8 @@ in { */ topoSort = dag: let dagBefore = dag: name: - builtins.attrNames - (filterAttrs (_n: v: builtins.elem name v.before) dag); + attrNames + (filterAttrs (_n: v: elem name v.before) dag); normalizedDag = mapAttrs (n: v: { name = n; @@ -85,8 +88,8 @@ in { after = v.after ++ dagBefore dag n; }) dag; - before = a: b: builtins.elem a.name b.after; - sorted = toposort before (builtins.attrValues normalizedDag); + before = a: b: elem a.name b.after; + sorted = toposort before (attrValues normalizedDag); in if sorted ? result then { @@ -100,8 +103,8 @@ in { entryBetween = before: after: data: {inherit data before after;}; # Create a DAG entry with no particular dependency information. - entryAnywhere = nvim.dag.entryBetween [] []; + entryAnywhere = entryBetween [] []; - entryAfter = nvim.dag.entryBetween []; - entryBefore = before: nvim.dag.entryBetween before []; + entryAfter = entryBetween []; + entryBefore = before: entryBetween before []; } diff --git a/lib/languages.nix b/lib/languages.nix index 18cfc371..e47202ee 100644 --- a/lib/languages.nix +++ b/lib/languages.nix @@ -1,32 +1,37 @@ # From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix -{lib}: { +{lib}: let + inherit (builtins) isString getAttr; + inherit (lib.options) mkOption; + inherit (lib.attrsets) listToAttrs; + inherit (lib.types) bool; +in { # Converts a boolean to a yes/no string. This is used in lots of # configuration formats. diagnosticsToLua = { lang, config, - diagnostics, + diagnosticsProviders, }: - lib.listToAttrs + listToAttrs (map (v: let type = - if builtins.isString v + if isString v then v - else builtins.getAttr v.type; + else getAttr v.type; package = - if builtins.isString v - then diagnostics.${type}.package + if isString v + then diagnosticsProviders.${type}.package else v.package; in { name = "${lang}-diagnostics-${type}"; - value = diagnostics.${type}.nullConfig package; + value = diagnosticsProviders.${type}.nullConfig package; }) config); mkEnable = desc: - lib.mkOption { + mkOption { description = "Turn on ${desc} for enabled languages by default"; - type = lib.types.bool; + type = bool; default = false; }; } diff --git a/lib/lua.nix b/lib/lua.nix index 708b4647..d7dd982c 100644 --- a/lib/lua.nix +++ b/lib/lua.nix @@ -1,7 +1,9 @@ # Helpers for converting values to lua {lib}: let - inherit (lib) mapAttrsToList filterAttrs concatStringsSep concatMapStringsSep stringToCharacters boolToString; - inherit (builtins) hasAttr head throw typeOf; + inherit (builtins) hasAttr head throw typeOf isList isAttrs isBool isInt isString isPath isFloat toJSON; + inherit (lib.attrsets) mapAttrsToList filterAttrs; + inherit (lib.strings) concatStringsSep concatMapStringsSep stringToCharacters; + inherit (lib.trivial) boolToString; in rec { # Convert a null value to lua's nil nullString = value: @@ -11,29 +13,29 @@ in rec { # convert an expression to lua expToLua = exp: - if builtins.isList exp + if isList exp then listToLuaTable exp # if list, convert to lua table - else if builtins.isAttrs exp + else if isAttrs exp then attrsetToLuaTable exp # if attrs, convert to table - else if builtins.isBool exp - then lib.boolToString exp # if bool, convert to string - else if builtins.isInt exp - then builtins.toString exp # if int, convert to string + else if isBool exp + then boolToString exp # if bool, convert to string + else if isInt exp + then toString exp # if int, convert to string else if exp == null then "nil" - else (builtins.toJSON exp); # otherwise jsonify the value and print as is + else (toJSON exp); # otherwise jsonify the value and print as is # convert list to a lua table listToLuaTable = list: - "{ " + (builtins.concatStringsSep ", " (map expToLua list)) + " }"; + "{ " + (concatStringsSep ", " (map expToLua list)) + " }"; # convert attrset to a lua table attrsetToLuaTable = attrset: "{ " + ( - builtins.concatStringsSep ", " + concatStringsSep ", " ( - lib.mapAttrsToList ( + mapAttrsToList ( name: value: name + " = " @@ -44,10 +46,10 @@ in rec { ) + " }"; # Convert a list of lua expressions to a lua table. The difference to listToLuaTable is that the elements here are expected to be lua expressions already, whereas listToLuaTable converts from nix types to lua first - luaTable = items: ''{${builtins.concatStringsSep "," items}}''; + luaTable = items: ''{${concatStringsSep "," items}}''; toLuaObject = args: - if builtins.isAttrs args + if isAttrs args then if hasAttr "__raw" args then args.__raw @@ -68,19 +70,19 @@ in rec { ) args))) + "}" - else if builtins.isList args + else if isList args then "{" + concatMapStringsSep "," toLuaObject args + "}" - else if builtins.isString args + else if isString args then # This should be enough! - builtins.toJSON args - else if builtins.isPath args - then builtins.toJSON (toString args) - else if builtins.isBool args + toJSON args + else if isPath args + then toJSON (toString args) + else if isBool args then "${boolToString args}" - else if builtins.isFloat args + else if isFloat args then "${toString args}" - else if builtins.isInt args + else if isInt args then "${toString args}" else if (args == null) then "nil" diff --git a/lib/types/languages.nix b/lib/types/languages.nix index 6b067595..e47f9644 100644 --- a/lib/types/languages.nix +++ b/lib/types/languages.nix @@ -15,13 +15,13 @@ with lib; let in { diagnostics = { langDesc, - diagnostics, - defaultDiagnostics, + diagnosticsProviders, + defaultDiagnosticsProvider, }: mkOption { description = "List of ${langDesc} diagnostics to enable"; - type = with types; listOf (either (enum (attrNames diagnostics)) (submodule diagnosticSubmodule)); - default = defaultDiagnostics; + type = with types; listOf (either (enum (attrNames diagnosticsProviders)) (submodule diagnosticSubmodule)); + default = defaultDiagnosticsProvider; }; mkGrammarOption = pkgs: grammar: diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 4db75421..da1d6bae 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -99,6 +99,7 @@ with lib; let "highlight-undo" "nvim-docs-view" "image-nvim" + "nvim-nio" ]; # You can either use the name of the plugin or a package. pluginType = with types; diff --git a/lib/vim.nix b/lib/vim.nix index c81dcc3b..da5bf558 100644 --- a/lib/vim.nix +++ b/lib/vim.nix @@ -1,5 +1,5 @@ let - inherit (builtins) isInt isBool toJSON; + inherit (builtins) isInt isBool toJSON toString; in rec { # yes? no. yesNo = value: @@ -16,7 +16,7 @@ in rec { # convert a literal value to a vim compliant value valToVim = val: if (isInt val) - then (builtins.toString val) + then (toString val) else ( if (isBool val) diff --git a/modules/basic/config.nix b/modules/basic/config.nix index 1a3e97bd..a74a6a99 100644 --- a/modules/basic/config.nix +++ b/modules/basic/config.nix @@ -4,12 +4,15 @@ ... }: let inherit (builtins) concatStringsSep; - inherit (lib) optionalString mkIf nvim; + inherit (lib.modules) mkIf; + inherit (lib.lists) optionals; + inherit (lib.strings) optionalString; + inherit (lib.nvim.dag) entryAfter; cfg = config.vim; in { config = { - vim.startPlugins = ["plenary-nvim"] ++ lib.optionals (cfg.spellChecking.enableProgrammingWordList) ["vim-dirtytalk"]; + vim.startPlugins = ["plenary-nvim"] ++ optionals (cfg.spellChecking.enableProgrammingWordList) ["vim-dirtytalk"]; vim.maps.normal = mkIf cfg.disableArrows { @@ -57,7 +60,7 @@ in { }; }; - vim.configRC.basic = nvim.dag.entryAfter ["globalsScript"] '' + vim.configRC.basic = entryAfter ["globalsScript"] '' " Settings that are set for everything set encoding=utf-8 set mouse=${cfg.mouseSupport} diff --git a/modules/basic/module.nix b/modules/basic/module.nix index 4a2750fc..263aae02 100644 --- a/modules/basic/module.nix +++ b/modules/basic/module.nix @@ -3,12 +3,12 @@ lib, ... }: let - inherit (lib) mkEnableOption mkOption; - inherit (lib.types) types; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) package path str bool int listOf enum nullOr; in { options.vim = { package = mkOption { - type = types.package; + type = package; default = pkgs.neovim-unwrapped; description = '' The neovim package to use. You will need to use an unwrapped package for this option to work as intended. @@ -18,13 +18,13 @@ in { debugMode = { enable = mkEnableOption "debug mode"; level = mkOption { - type = types.int; + type = int; default = 20; description = "Set the debug level"; }; logFile = mkOption { - type = types.path; + type = path; default = "/tmp/nvim.log"; description = "Set the log file"; }; @@ -33,7 +33,7 @@ in { enableLuaLoader = mkEnableOption "experimental Lua module loader to speed up the start up process"; leaderKey = mkOption { - type = with types; nullOr str; + type = nullOr str; default = null; description = "The leader key to be used internally"; }; @@ -42,7 +42,7 @@ in { enable = mkEnableOption "neovim's built-in spellchecking"; enableProgrammingWordList = mkEnableOption "vim-dirtytalk, a wordlist for programmers, that includes programming words"; languages = mkOption { - type = with types; listOf str; + type = listOf str; description = "The languages to be used for spellchecking"; default = ["en"]; example = ["en" "de"]; @@ -50,55 +50,55 @@ in { }; colourTerm = mkOption { - type = types.bool; + type = bool; default = true; description = "Set terminal up for 256 colours"; }; disableArrows = mkOption { - type = types.bool; + type = bool; default = false; description = "Set to prevent arrow keys from moving cursor"; }; hideSearchHighlight = mkOption { - type = types.bool; + type = bool; default = false; description = "Hide search highlight so it doesn't stay highlighted"; }; scrollOffset = mkOption { - type = types.int; + type = int; default = 8; description = "Start scrolling this number of lines from the top or bottom of the page."; }; wordWrap = mkOption { - type = types.bool; + type = bool; default = true; description = "Enable word wrapping."; }; syntaxHighlighting = mkOption { - type = types.bool; + type = bool; default = true; description = "Enable syntax highlighting"; }; mapLeaderSpace = mkOption { - type = types.bool; + type = bool; default = true; description = "Map the space key to leader key"; }; useSystemClipboard = mkOption { - type = types.bool; + type = bool; default = false; description = "Make use of the clipboard for default yank and paste operations. Don't use * and +"; }; mouseSupport = mkOption { - type = with types; enum ["a" "n" "v" "i" "c"]; + type = enum ["a" "n" "v" "i" "c"]; default = "a"; description = '' Set modes for mouse support. @@ -112,7 +112,7 @@ in { }; lineNumberMode = mkOption { - type = with types; enum ["relative" "number" "relNumber" "none"]; + type = enum ["relative" "number" "relNumber" "none"]; default = "relNumber"; description = '' How line numbers are displayed. Available options are @@ -121,78 +121,78 @@ in { }; preventJunkFiles = mkOption { - type = types.bool; + type = bool; default = false; description = "Prevent swapfile, backupfile from being created"; }; tabWidth = mkOption { - type = types.int; + type = int; default = 4; description = "Set the width of tabs"; }; autoIndent = mkOption { - type = types.bool; + type = bool; default = true; description = "Enable auto indent"; }; cmdHeight = mkOption { - type = types.int; + type = int; default = 1; description = "Height of the command pane"; }; updateTime = mkOption { - type = types.int; + type = int; default = 300; description = "The number of milliseconds till Cursor Hold event is fired"; }; showSignColumn = mkOption { - type = types.bool; + type = bool; default = true; description = "Show the sign column"; }; bell = mkOption { - type = types.enum ["none" "visual" "on"]; + type = enum ["none" "visual" "on"]; default = "none"; description = "Set how bells are handled. Options: on, visual or none"; }; mapTimeout = mkOption { - type = types.int; + type = int; default = 500; description = "Timeout in ms that neovim will wait for mapped action to complete"; }; splitBelow = mkOption { - type = types.bool; + type = bool; default = true; description = "New splits will open below instead of on top"; }; splitRight = mkOption { - type = types.bool; + type = bool; default = true; description = "New splits will open to the right"; }; enableEditorconfig = mkOption { - type = types.bool; + type = bool; default = true; description = "Follow editorconfig rules in current directory"; }; cursorlineOpt = mkOption { - type = types.enum ["line" "screenline" "number" "both"]; + type = enum ["line" "screenline" "number" "both"]; default = "line"; description = "Highlight the text line of the cursor with CursorLine hl-CursorLine"; }; searchCase = mkOption { - type = types.enum ["ignore" "smart" "sensitive"]; + type = enum ["ignore" "smart" "sensitive"]; default = "sensitive"; description = "Set the case sensitivity of search"; }; diff --git a/modules/completion/nvim-cmp/nvim-cmp.nix b/modules/completion/nvim-cmp/nvim-cmp.nix index 59c32db1..ac89783e 100644 --- a/modules/completion/nvim-cmp/nvim-cmp.nix +++ b/modules/completion/nvim-cmp/nvim-cmp.nix @@ -1,5 +1,5 @@ {lib, ...}: let - inherit (lib.options) mkEnableOption mkOption; + inherit (lib.options) mkEnableOption mkOption literalMD; inherit (lib.nvim.binds) mkMappingOption; inherit (lib.types) enum attrsOf nullOr str; in { @@ -52,7 +52,7 @@ in { ''; type = str; default = "nvim_cmp_menu_map"; - example = lib.literalMD '' + example = literalMD '' ```lua function(entry, vim_item) return vim_item diff --git a/modules/core/default.nix b/modules/core/default.nix index 13534a4a..682566cf 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -4,10 +4,16 @@ ... }: let inherit (builtins) attrValues attrNames map mapAttrs toJSON isString concatStringsSep filter; - inherit (lib) mkOption types mapAttrsFlatten filterAttrs optionalString getAttrs literalExpression; - inherit (lib) nvim; - inherit (nvim.lua) toLuaObject; - inherit (nvim.vim) valToVim; + inherit (lib.options) mkOption literalExpression mdDoc; + inherit (lib.attrsets) filterAttrs getAttrs; + inherit (lib.strings) optionalString; + inherit (lib.misc) mapAttrsFlatten; + inherit (lib.trivial) showWarnings; + inherit (lib.types) bool str listOf oneOf attrsOf nullOr attrs submodule unspecified lines; + inherit (lib.nvim.types) dagOf pluginsOpt extraPluginType; + inherit (lib.nvim.dag) entryAnywhere entryAfter topoSort; + inherit (lib.nvim.lua) toLuaObject; + inherit (lib.nvim.vim) valToVim; cfg = config.vim; @@ -22,7 +28,7 @@ mkBool = value: description: mkOption { - type = types.bool; + type = bool; default = value; inherit description; }; @@ -54,7 +60,7 @@ "Whether to use the 'noremap' variant of the command, ignoring any custom mappings on the defined action. It is highly advised to keep this on, which is the default."; desc = mkOption { - type = types.nullOr types.str; + type = nullOr str; default = null; description = "A description of this keybind, to be shown in which-key, if you have it enabled."; }; @@ -94,17 +100,17 @@ }) maps); - mapOption = types.submodule { + mapOption = submodule { options = mapConfigOptions // { action = mkOption { - type = types.str; + type = str; description = "The action to execute."; }; lua = mkOption { - type = types.bool; + type = bool; description = '' If true, `action` is considered to be lua code. Thus, it will not be wrapped in `""`. @@ -117,13 +123,13 @@ mapOptions = mode: mkOption { description = "Mappings for ${mode} mode"; - type = types.attrsOf mapOption; + type = attrsOf mapOption; default = {}; }; in { options = { - assertions = lib.mkOption { - type = with types; listOf unspecified; + assertions = mkOption { + type = listOf unspecified; internal = true; default = []; example = literalExpression '' @@ -139,9 +145,9 @@ in { warnings = mkOption { internal = true; default = []; - type = with types; listOf str; + type = listOf str; example = ["The `foo' service is deprecated and will go away soon!"]; - description = lib.mdDoc '' + description = mdDoc '' This option allows modules to show warnings to users during the evaluation of the system configuration. ''; @@ -150,46 +156,46 @@ in { vim = { viAlias = mkOption { description = "Enable vi alias"; - type = types.bool; + type = bool; default = true; }; vimAlias = mkOption { description = "Enable vim alias"; - type = types.bool; + type = bool; default = true; }; configRC = mkOption { description = "vimrc contents"; - type = types.oneOf [(nvim.types.dagOf types.lines) types.str]; + type = oneOf [(dagOf lines) str]; default = {}; }; luaConfigRC = mkOption { description = "vim lua config"; - type = types.oneOf [(nvim.types.dagOf types.lines) types.str]; + type = oneOf [(dagOf lines) str]; default = {}; }; builtConfigRC = mkOption { internal = true; - type = types.lines; + type = lines; description = "The built config for neovim after resolving the DAG"; }; - startPlugins = nvim.types.pluginsOpt { + startPlugins = pluginsOpt { default = []; description = "List of plugins to startup."; }; - optPlugins = nvim.types.pluginsOpt { + optPlugins = pluginsOpt { default = []; description = "List of plugins to optionally load"; }; extraPlugins = mkOption { - type = types.attrsOf nvim.types.extraPluginType; + type = attrsOf extraPluginType; default = {}; description = '' List of plugins and related config. @@ -210,7 +216,7 @@ in { }; luaPackages = mkOption { - type = types.listOf types.str; + type = listOf str; default = []; description = '' List of lua packages to install. @@ -220,11 +226,11 @@ in { globals = mkOption { default = {}; description = "Set containing global variable values"; - type = types.attrs; + type = attrs; }; maps = mkOption { - type = types.submodule { + type = submodule { options = { normal = mapOptions "normal"; insert = mapOptions "insert"; @@ -289,12 +295,12 @@ in { mapResult, }: let # When the value is a string, default it to dag.entryAnywhere - finalDag = lib.mapAttrs (_: value: + finalDag = mapAttrs (_: value: if isString value - then nvim.dag.entryAnywhere value + then entryAnywhere value else value) dag; - sortedDag = nvim.dag.topoSort finalDag; + sortedDag = topoSort finalDag; result = if sortedDag ? result then mapResult sortedDag.result @@ -305,7 +311,7 @@ in { vim = { startPlugins = map (x: x.package) (attrValues cfg.extraPlugins); configRC = { - globalsScript = nvim.dag.entryAnywhere (concatStringsSep "\n" globalsScript); + globalsScript = entryAnywhere (concatStringsSep "\n" globalsScript); luaScript = let mkSection = r: '' @@ -319,7 +325,7 @@ in { inherit mapResult; }; in - nvim.dag.entryAfter ["globalsScript"] luaConfig; + entryAfter ["globalsScript"] luaConfig; extraPluginConfigs = let mkSection = r: '' @@ -332,7 +338,7 @@ in { setup, ... }: - nvim.dag.entryAfter after setup) + entryAfter after setup) cfg.extraPlugins; pluginConfig = resolveDag { name = "extra plugins config"; @@ -340,7 +346,7 @@ in { inherit mapResult; }; in - nvim.dag.entryAfter ["luaScript"] pluginConfig; + entryAfter ["luaScript"] pluginConfig; # This is probably not the right way to set the config. I'm not sure how it should look like. mappings = let @@ -359,7 +365,7 @@ in { ]; mapConfig = wrapLuaConfig (concatStringsSep "\n" (map (v: concatStringsSep "\n" v) maps)); in - nvim.dag.entryAfter ["globalsScript"] mapConfig; + entryAfter ["globalsScript"] mapConfig; }; builtConfigRC = let @@ -368,7 +374,7 @@ in { baseSystemAssertWarn = if failedAssertions != [] then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}" - else lib.showWarnings config.warnings; + else showWarnings config.warnings; mkSection = r: '' " SECTION: ${r.name} diff --git a/modules/dashboard/dashboard-nvim/dashboard-nvim.nix b/modules/dashboard/dashboard-nvim/dashboard-nvim.nix index 62333918..518082eb 100644 --- a/modules/dashboard/dashboard-nvim/dashboard-nvim.nix +++ b/modules/dashboard/dashboard-nvim/dashboard-nvim.nix @@ -1,5 +1,5 @@ {lib, ...}: let - inherit (lib) mkEnableOption; + inherit (lib.options) mkEnableOption; in { options.vim.dashboard.dashboard-nvim = { enable = mkEnableOption "Fancy and Blazing Fast start screen plugin of neovim [dashboard.nvim]"; diff --git a/modules/debugger/nvim-dap/config.nix b/modules/debugger/nvim-dap/config.nix index cc04c268..b26a5bd7 100644 --- a/modules/debugger/nvim-dap/config.nix +++ b/modules/debugger/nvim-dap/config.nix @@ -49,7 +49,7 @@ in { ]; }) (mkIf (cfg.enable && cfg.ui.enable) { - vim.startPlugins = ["nvim-dap-ui"]; + vim.startPlugins = ["nvim-dap-ui" "nvim-nio"]; vim.luaConfigRC.nvim-dap-ui = entryAfter ["nvim-dap"] ('' local dapui = require("dapui") diff --git a/modules/default.nix b/modules/default.nix index c9703b90..8ecdaefc 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -6,8 +6,9 @@ inputs: { extraSpecialArgs ? {}, }: let inherit (builtins) map filter isString toString getAttr; - inherit (pkgs) wrapNeovim vimPlugins; + inherit (pkgs) wrapNeovimUnstable vimPlugins; inherit (pkgs.vimUtils) buildVimPlugin; + inherit (pkgs.neovimUtils) makeNeovimConfig; extendedLib = import ../lib/stdlib-extended.nix lib; @@ -57,21 +58,22 @@ inputs: { (f: f != null) plugins); - neovim = wrapNeovim vimOptions.package { + plugins = + (buildConfigPlugins vimOptions.startPlugins) + ++ (map (package: { + plugin = package; + optional = false; + }) + (buildConfigPlugins + vimOptions.optPlugins)); + + neovim = wrapNeovimUnstable vimOptions.package (makeNeovimConfig { inherit (vimOptions) viAlias; inherit (vimOptions) vimAlias; - inherit extraLuaPackages; - - configure = { - customRC = vimOptions.builtConfigRC; - - packages.myVimPackage = { - start = buildConfigPlugins vimOptions.startPlugins; - opt = buildConfigPlugins vimOptions.optPlugins; - }; - }; - }; + inherit plugins; + customRC = vimOptions.builtConfigRC; + }); in { inherit (module) options config; inherit (module._module.args) pkgs; diff --git a/modules/filetree/nvimtree/config.nix b/modules/filetree/nvimtree/config.nix index f6ac65a9..0286c1af 100644 --- a/modules/filetree/nvimtree/config.nix +++ b/modules/filetree/nvimtree/config.nix @@ -33,7 +33,7 @@ in { vim.luaConfigRC.nvimtreelua = entryAnywhere '' ${ - lib.optionalString cfg.disableNetrw '' + optionalString cfg.disableNetrw '' -- disable netrew completely vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 diff --git a/modules/filetree/nvimtree/nvimtree.nix b/modules/filetree/nvimtree/nvimtree.nix index 21125772..ecd74b58 100644 --- a/modules/filetree/nvimtree/nvimtree.nix +++ b/modules/filetree/nvimtree/nvimtree.nix @@ -3,29 +3,30 @@ lib, ... }: let - inherit (lib) mkEnableOption mkOption types literalExpression; + inherit (lib.options) mkEnableOption mkOption literalExpression; + inherit (lib.types) nullOr str bool int listOf enum attrs oneOf addCheck submodule; in { options.vim.filetree.nvimTree = { enable = mkEnableOption "filetree via nvim-tree.lua"; mappings = { toggle = mkOption { - type = types.nullOr types.str; + type = nullOr str; default = "t"; description = "Toggle NvimTree"; }; refresh = mkOption { - type = types.nullOr types.str; + type = nullOr str; default = "tr"; description = "Refresh NvimTree"; }; findFile = mkOption { - type = types.nullOr types.str; + type = nullOr str; default = "tg"; description = "Find file in NvimTree"; }; focus = mkOption { - type = types.nullOr types.str; + type = nullOr str; default = "tf"; description = "Focus NvimTree"; }; @@ -34,19 +35,19 @@ in { disableNetrw = mkOption { default = false; description = "Disables netrw and replaces it with tree"; - type = types.bool; + type = bool; }; hijackNetrw = mkOption { default = true; description = "Prevents netrw from automatically opening when opening directories"; - type = types.bool; + type = bool; }; autoreloadOnWrite = mkOption { default = true; description = "Auto reload tree on write"; - type = types.bool; + type = bool; }; updateFocusedFile = mkOption { @@ -55,16 +56,16 @@ in { until it finds the file. ''; default = {}; - type = types.submodule { + type = submodule { options = { enable = mkOption { - type = types.bool; + type = bool; default = false; description = "update focused file"; }; updateRoot = mkOption { - type = types.bool; + type = bool; default = false; description = '' Update the root directory of the tree if the file is not under current @@ -75,7 +76,7 @@ in { }; ignoreList = mkOption { - type = with types; listOf str; + type = listOf str; default = []; description = '' List of buffer names and filetypes that will not update the root dir @@ -93,26 +94,26 @@ in { sorter = mkOption { default = "name"; description = "How files within the same directory are sorted."; - type = types.enum ["name" "extension" "modification_time" "case_sensitive" "suffix" "filetype"]; + type = enum ["name" "extension" "modification_time" "case_sensitive" "suffix" "filetype"]; }; foldersFirst = mkOption { default = true; description = "Sort folders before files. Has no effect when `sort.sorter` is a function."; - type = types.bool; + type = bool; }; }; hijackCursor = mkOption { default = false; description = "Hijack the cursor in the tree to put it at the start of the filename"; - type = types.bool; + type = bool; }; hijackUnnamedBufferWhenOpening = mkOption { default = false; description = "Open nvimtree in place of the unnamed buffer if it's empty."; - type = types.bool; + type = bool; }; rootDirs = mkOption { @@ -120,7 +121,7 @@ in { description = '' Preferred root directories. Only relevant when `updateFocusedFile.updateRoot` is `true` ''; - type = with types; listOf str; + type = listOf str; }; preferStartupRoot = mkOption { @@ -129,11 +130,11 @@ in { Prefer startup root directory when updating root directory of the tree. Only relevant when `update_focused_file.update_root` is `true` ''; - type = types.bool; + type = bool; }; syncRootWithCwd = mkOption { - type = types.bool; + type = bool; default = false; description = '' Changes the tree root directory on `DirChanged` and refreshes the tree. @@ -145,13 +146,13 @@ in { reloadOnBufEnter = mkOption { default = false; - type = types.bool; + type = bool; description = "Automatically reloads the tree on `BufEnter` nvim-tree."; }; respectBufCwd = mkOption { default = false; - type = types.bool; + type = bool; description = "Will change cwd of nvim-tree to that of new buffer's when opening nvim-tree."; }; @@ -163,10 +164,10 @@ in { autoOpen = false; }; - type = types.submodule { + type = submodule { options = { enable = mkOption { - type = types.bool; + type = bool; description = '' Enable the `hijack_directories` feature. Disable this option if you use vim-dirvish or dirbuf.nvim. If `hijack_netrw` and `disable_netrw` are `false`, this feature will be disabled. @@ -174,7 +175,7 @@ in { }; autoOpen = mkOption { - type = types.bool; + type = bool; description = '' Opens the tree if the tree was previously closed. ''; @@ -187,7 +188,7 @@ in { args = mkOption { default = []; description = "Optional argument list."; - type = with types; listOf str; + type = listOf str; }; cmd = mkOption { @@ -198,7 +199,7 @@ in { then "${pkgs.xdg-utils}/bin/xdg-open" else throw "NvimTree: No default system open command for this platform, please set `vim.filetree.nvimTree.systemOpen.cmd`"; description = "The open command itself"; - type = types.str; + type = str; }; }; @@ -210,13 +211,13 @@ in { default = {}; - type = types.submodule { + type = submodule { options = { enable = mkEnableOption "diagnostics view in the signcolumn."; debounceDelay = mkOption { description = "Idle milliseconds between diagnostic event and update."; - type = types.int; + type = int; default = 50; }; @@ -226,7 +227,7 @@ in { }; showOnOpenDirs = mkOption { - type = types.bool; + type = bool; default = true; description = '' Show diagnostics icons on directories that are open. @@ -237,26 +238,26 @@ in { icons = mkOption { description = "Icons for diagnostic severity."; default = {}; - type = types.submodule { + type = submodule { options = { hint = mkOption { description = "Icon used for `hint` diagnostic."; - type = types.str; + type = str; default = ""; }; info = mkOption { description = "Icon used for `info` diagnostic."; - type = types.str; + type = str; default = ""; }; warning = mkOption { description = "Icon used for `warning` diagnostic."; - type = types.str; + type = str; default = ""; }; error = mkOption { description = "Icon used for `error` diagnostic."; - type = types.str; + type = str; default = ""; }; }; @@ -266,17 +267,17 @@ in { severity = mkOption { description = "Severity for which the diagnostics will be displayed. See `:help diagnostic-severity`"; default = {}; - type = types.submodule { + type = submodule { options = { min = mkOption { description = "Minimum severity."; - type = types.enum ["HINT" "INFO" "WARNING" "ERROR"]; + type = enum ["HINT" "INFO" "WARNING" "ERROR"]; default = "HINT"; }; max = mkOption { description = "Maximum severity."; - type = types.enum ["HINT" "INFO" "WARNING" "ERROR"]; + type = enum ["HINT" "INFO" "WARNING" "ERROR"]; default = "ERROR"; }; }; @@ -290,19 +291,19 @@ in { enable = mkEnableOption "Git integration with icons and colors."; showOnDirs = mkOption { - type = types.bool; + type = bool; default = true; description = "Show git icons on parent directories."; }; showOnOpenDirs = mkOption { - type = types.bool; + type = bool; default = true; description = "Show git icons on directories that are open."; }; disableForDirs = mkOption { - type = with types; listOf str; + type = listOf str; default = []; description = '' Disable git integration when git top-level matches these paths. @@ -311,7 +312,7 @@ in { }; timeout = mkOption { - type = types.int; + type = int; default = 400; description = '' Kills the git process after some time if it takes too long. @@ -323,18 +324,18 @@ in { modified = mkOption { description = "Indicate which file have unsaved modification."; default = {}; - type = types.submodule { + type = submodule { options = { enable = mkEnableOption "Modified files with icons and color highlight."; showOnDirs = mkOption { - type = types.bool; + type = bool; description = "Show modified icons on parent directories."; default = true; }; showOnOpenDirs = mkOption { - type = types.bool; + type = bool; description = "Show modified icons on directories that are open."; default = true; }; @@ -351,22 +352,22 @@ in { performance. ''; default = {}; - type = types.submodule { + type = submodule { options = { enable = mkOption { description = "Enable filesystem watchers."; - type = types.bool; + type = bool; default = true; }; debounceDelay = mkOption { description = "Idle milliseconds between filesystem change and action."; - type = types.int; + type = int; default = 50; }; ignoreDirs = mkOption { - type = with types; listOf str; + type = listOf str; default = []; description = '' List of vim regex for absolute directory paths that will not be watched. @@ -385,22 +386,22 @@ in { view = mkOption { description = "Window / buffer setup."; default = {}; - type = types.submodule { + type = submodule { options = { centralizeSelection = mkOption { description = "If true, reposition the view so that the current node is initially centralized when entering nvim-tree."; - type = types.bool; + type = bool; default = false; }; cursorline = mkOption { description = "Enable cursorline in nvim-tree window."; - type = types.bool; + type = bool; default = true; }; debounceDelay = mkOption { - type = types.int; + type = int; default = 15; description = '' Idle milliseconds before some reload / refresh operations. @@ -416,7 +417,7 @@ in { A table (an attribute set in our case, see example) indicates that the view should be dynamically sized based on the longest line. ''; - type = with types; oneOf [int attrs]; + type = oneOf [int attrs]; default = 30; example = literalExpression '' { @@ -429,7 +430,7 @@ in { side = mkOption { description = "Side of the tree."; - type = types.enum ["left" "right"]; + type = enum ["left" "right"]; default = "left"; }; @@ -438,13 +439,13 @@ in { Preserves window proportions when opening a file. If `false`, the height and width of windows other than nvim-tree will be equalized. ''; - type = types.bool; + type = bool; default = false; }; number = mkOption { description = "Print the line number in front of each line."; - type = types.bool; + type = bool; default = false; }; @@ -454,13 +455,13 @@ in { If the option `view.number` is also `true`, the number on the cursor line will be the line number instead of `0`. ''; - type = types.bool; + type = bool; default = false; }; signcolumn = mkOption { description = ''Show diagnostic sign column. Value can be `"yes"`, `"auto"` or`"no"`.''; - type = types.enum ["yes" "auto" "no"]; + type = enum ["yes" "auto" "no"]; default = "yes"; }; @@ -468,23 +469,23 @@ in { description = "Configuration options for floating window."; default = {}; - type = types.submodule { + type = submodule { options = { enable = mkOption { description = "If true, tree window will be floating."; - type = types.bool; + type = bool; default = false; }; quitOnFocusLoss = mkOption { description = "Close the floating tree window when it loses focus."; - type = types.bool; + type = bool; default = true; }; openWinConfig = mkOption { description = "Floating window config. See `:h nvim_open_win()` for more details."; - type = types.attrs; + type = attrs; default = { relative = "editor"; border = "rounded"; @@ -505,23 +506,23 @@ in { addTrailing = mkOption { default = false; description = "Appends a trailing slash to folder names."; - type = types.bool; + type = bool; }; groupEmpty = mkOption { default = false; description = "Compact folders that only contain a single folder into one node in the file tree."; - type = types.bool; + type = bool; }; fullName = mkOption { default = false; description = "Display node whose name length is wider than the width of nvim-tree window in floating window."; - type = types.bool; + type = bool; }; highlightGit = mkOption { - type = types.bool; + type = bool; default = false; description = '' Enable file highlight for git attributes using `NvimTreeGit` highlight groups. @@ -531,7 +532,7 @@ in { }; highlightOpenedFiles = mkOption { - type = types.enum ["none" "icon" "name" "all"]; + type = enum ["none" "icon" "name" "all"]; default = "none"; description = '' Highlight icons and/or names for bufloaded() files using the @@ -540,7 +541,7 @@ in { }; highlightModified = mkOption { - type = types.enum ["none" "icon" "name" "all"]; + type = enum ["none" "icon" "name" "all"]; default = "none"; description = '' Highlight modified files in the tree using `NvimTreeNormal` highlight group. @@ -549,7 +550,7 @@ in { }; rootFolderLabel = mkOption { - type = with types; oneOf [str bool]; + type = oneOf [str bool]; default = false; example = ''"":~:s?$?/..?"''; description = '' @@ -566,7 +567,7 @@ in { }; indentWidth = mkOption { - type = with types; addCheck int (x: x >= 1); + type = addCheck int (x: x >= 1); default = 2; description = "Number of spaces for an each tree nesting level. Minimum 1."; }; @@ -574,17 +575,17 @@ in { indentMarkers = mkOption { description = "Configuration options for tree indent markers."; default = {}; - type = types.submodule { + type = submodule { options = { enable = mkEnableOption "Display indent markers when folders are open."; inlineArrows = mkOption { - type = types.bool; + type = bool; default = true; description = "Display folder arrows in the same column as indent marker when using `renderer.icons.show.folder_arrow`"; }; icons = mkOption { - type = types.attrs; + type = attrs; description = "Individual elements of the indent markers"; default = { corner = "└"; @@ -599,13 +600,13 @@ in { }; specialFiles = mkOption { - type = with types; listOf str; + type = listOf str; default = ["Cargo.toml" "README.md" "readme.md" "Makefile" "MAKEFILE" "flake.nix"]; # ;) description = "A list of filenames that gets highlighted with `NvimTreeSpecialFile"; }; symlinkDestination = mkOption { - type = types.bool; + type = bool; default = true; description = "Whether to show the destination of the symlink."; }; @@ -613,53 +614,53 @@ in { icons = mkOption { description = "Configuration options for icons."; default = {}; - type = types.submodule { + type = submodule { options = { webdevColors = mkOption { - type = types.bool; + type = bool; description = " Use the webdev icon colors, otherwise `NvimTreeFileIcon`"; default = true; }; gitPlacement = mkOption { - type = types.enum ["before" "after" "signcolumn"]; + type = enum ["before" "after" "signcolumn"]; description = "Place where the git icons will be rendered. `signcolumn` requires `view.signcolumn` to be enabled."; default = "before"; }; modifiedPlacement = mkOption { - type = types.enum ["before" "after" "signcolumn"]; + type = enum ["before" "after" "signcolumn"]; description = "Place where the modified icons will be rendered. `signcolumn` requires `view.signcolumn` to be enabled."; default = "after"; }; padding = mkOption { - type = types.str; + type = str; description = "Inserted between icon and filename"; default = " "; }; symlinkArrow = mkOption { - type = types.str; + type = str; description = "Used as a separator between symlinks' source and target."; default = " ➛ "; }; show = { file = mkOption { - type = types.bool; + type = bool; description = "Show an icon before the file name. `nvim-web-devicons` will be used if available."; default = true; }; folder = mkOption { - type = types.bool; + type = bool; description = "Show an icon before the folder name."; default = true; }; folderArrow = mkOption { - type = types.bool; + type = bool; default = true; description = '' Show a small arrow before the folder node. Arrow will be a part of the @@ -668,7 +669,7 @@ in { }; git = mkOption { - type = types.bool; + type = bool; default = false; description = '' Show a git status icon, see `renderer.icons.gitPlacement` @@ -677,7 +678,7 @@ in { }; modified = mkOption { - type = types.bool; + type = bool; default = true; description = '' Show a modified icon, see `renderer.icons.modifiedPlacement` @@ -692,29 +693,29 @@ in { to appear in the signcolumn. ''; default = {}; - type = types.submodule { + type = submodule { options = { default = mkOption { - type = types.str; + type = str; description = "Glyph for files. Will be overridden by `nvim-web-devicons` if available."; default = ""; }; symlink = mkOption { - type = types.str; + type = str; description = "Glyph for symlinks."; default = ""; }; modified = mkOption { - type = types.str; + type = str; description = "Icon to display for modified files."; default = ""; }; # TODO: hardcode each attribute folder = mkOption { - type = types.attrs; + type = attrs; description = "Glyphs for directories. Recommended to use the defaults unless you know what you are doing."; default = { default = ""; @@ -729,7 +730,7 @@ in { }; git = mkOption { - type = types.attrs; + type = attrs; description = "Glyphs for git status."; default = { unstaged = "✗"; @@ -759,22 +760,22 @@ in { noBuffer = false; exclude = []; }; - type = types.submodule { + type = submodule { options = { gitIgnored = mkOption { - type = types.bool; + type = bool; description = "Ignore files based on `.gitignore`. Requires git.enable` to be `true`"; default = false; }; dotfiles = mkOption { - type = types.bool; + type = bool; description = "Do not show dotfiles: files starting with a `.`"; default = false; }; gitClean = mkOption { - type = types.bool; + type = bool; default = false; description = '' @@ -784,13 +785,13 @@ in { }; noBuffer = mkOption { - type = types.bool; + type = bool; default = false; description = "Do not show files that have no `buflisted()` buffer."; }; exclude = mkOption { - type = with types; listOf str; + type = listOf str; default = []; description = "List of directories or files to exclude from filtering: always show them."; }; @@ -804,10 +805,10 @@ in { cmd = "${pkgs.glib}/bin/gio trash"; }; - type = types.submodule { + type = submodule { options = { cmd = mkOption { - type = types.str; + type = str; description = "The command used to trash items"; }; }; @@ -817,10 +818,10 @@ in { actions = mkOption { description = "Configuration for various actions."; default = {}; - type = types.submodule { + type = submodule { options = { useSystemClipboard = mkOption { - type = types.bool; + type = bool; default = true; description = '' A boolean value that toggle the use of system clipboard when copy/paste @@ -833,16 +834,16 @@ in { changeDir = mkOption { description = "vim `change-directory` behaviour"; default = {}; - type = types.submodule { + type = submodule { options = { enable = mkOption { - type = types.bool; + type = bool; default = true; description = "Change the working directory when changing directories in the tree."; }; global = mkOption { - type = types.bool; + type = bool; default = false; description = '' Use `:cd` instead of `:lcd` when changing directories. @@ -851,7 +852,7 @@ in { }; restrictAboveCwd = mkOption { - type = types.bool; + type = bool; default = false; description = '' Restrict changing to a directory above the global current working directory. @@ -865,10 +866,10 @@ in { expandAll = mkOption { description = "Configuration for expand_all behaviour."; default = {}; - type = types.submodule { + type = submodule { options = { maxFolderDiscovery = mkOption { - type = types.int; + type = int; default = 300; description = '' Limit the number of folders being explored when expanding every folders. @@ -876,7 +877,7 @@ in { ''; }; exclude = mkOption { - type = with types; listOf str; + type = listOf str; description = "A list of directories that should not be expanded automatically."; default = [".git" "target" "build" "result"]; }; @@ -888,10 +889,10 @@ in { filePopup = mkOption { description = "Configuration for file_popup behaviour."; default = {}; - type = types.submodule { + type = submodule { options = { openWinConfig = mkOption { - type = types.attrs; + type = attrs; default = { col = 1; row = 1; @@ -909,22 +910,22 @@ in { openFile = mkOption { description = "Configuration options for opening a file from nvim-tree."; default = {}; - type = types.submodule { + type = submodule { options = { quitOnOpen = mkOption { - type = types.bool; + type = bool; description = "Closes the explorer when opening a file."; default = false; }; eject = mkOption { - type = types.bool; + type = bool; description = "Prevent new opened file from opening in the same window as the tree."; default = false; }; resizeWindow = mkOption { - type = types.bool; + type = bool; default = false; description = "Resizes the tree when opening a file. Previously `view.auto_resize`"; @@ -933,16 +934,16 @@ in { windowPicker = mkOption { description = "window_picker"; default = {}; - type = types.submodule { + type = submodule { options = { enable = mkOption { - type = types.bool; + type = bool; description = "Enable the window picker. If this feature is not enabled, files will open in window from which you last opened the tree."; default = false; }; picker = mkOption { - type = types.str; + type = str; default = "default"; description = '' Change the default window picker, can be a string `"default"` or a function. @@ -959,20 +960,20 @@ in { }; chars = mkOption { - type = types.str; + type = str; description = "A string of chars used as identifiers by the window picker."; default = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; }; exclude = { filetype = mkOption { - type = with types; listOf str; + type = listOf str; description = "A list of filetypes to exclude from the window picker."; default = ["notify" "packer" "qf" "diff" "fugitive" "fugitiveblame"]; }; buftype = mkOption { - type = with types; listOf str; + type = listOf str; description = "A list of buftypes to exclude from the window picker."; default = ["nofile" "terminal" "help"]; }; @@ -986,7 +987,7 @@ in { removeFile = { closeWindow = mkOption { - type = types.bool; + type = bool; default = true; description = "Close any window displaying a file when removing the file from the tree"; }; @@ -1004,16 +1005,16 @@ in { The filter can be cleared with the `F` key by default. ''; default = {}; - type = types.submodule { + type = submodule { options = { prefix = mkOption { - type = types.str; + type = str; description = "Prefix of the filter displayed in the buffer."; default = "[FILTER]: "; }; alwaysShowFolders = mkOption { - type = types.bool; + type = bool; description = "Whether to filter folders or not."; default = true; }; @@ -1024,15 +1025,15 @@ in { tab = mkOption { description = "Configuration for tab behaviour."; default = {}; - type = types.submodule { + type = submodule { options = { sync = mkOption { description = "Configuration for syncing nvim-tree across tabs."; default = {}; - type = types.submodule { + type = submodule { options = { open = mkOption { - type = types.bool; + type = bool; default = false; description = '' Opens the tree automatically when switching tabpage or opening a new @@ -1041,7 +1042,7 @@ in { }; close = mkOption { - type = types.bool; + type = bool; default = false; description = '' Closes the tree across all tabpages when the tree is closed. @@ -1049,7 +1050,7 @@ in { }; ignore = mkOption { - type = with types; listOf str; + type = listOf str; default = []; description = '' List of filetypes or buffer names on new tab that will prevent @@ -1066,16 +1067,16 @@ in { notify = mkOption { description = "Configuration for notifications."; default = {}; - type = types.submodule { + type = submodule { options = { threshold = mkOption { - type = types.enum ["ERROR" "WARNING" "INFO" "DEBUG"]; + type = enum ["ERROR" "WARNING" "INFO" "DEBUG"]; description = "Specify minimum notification level, uses the values from `vim.log.levels`"; default = "INFO"; }; absolutePath = mkOption { - type = types.bool; + type = bool; description = "Whether to use absolute paths or item names in fs action notifications."; default = true; }; @@ -1086,17 +1087,17 @@ in { ui = mkOption { description = "General UI configuration."; default = {}; - type = types.submodule { + type = submodule { options = { confirm = { remove = mkOption { - type = types.bool; + type = bool; description = "Prompt before removing."; default = true; }; trash = mkOption { - type = types.bool; + type = bool; description = "Prompt before trash."; default = true; }; @@ -1109,7 +1110,7 @@ in { openOnSetup = mkOption { default = true; description = "Open when vim is started on a directory"; - type = types.bool; + type = bool; }; }; } diff --git a/modules/languages/bash/bash.nix b/modules/languages/bash/bash.nix index 03cce941..7b5de0fa 100644 --- a/modules/languages/bash/bash.nix +++ b/modules/languages/bash/bash.nix @@ -9,6 +9,7 @@ inherit (lib.lists) isList; inherit (lib.types) enum either package listOf str bool; inherit (lib.nvim.lua) expToLua; + inherit (lib.nvim.types) diagnostics mkGrammarOption; cfg = config.vim.languages.bash; @@ -45,8 +46,8 @@ }; }; - defaultDiagnostics = ["shellcheck"]; - diagnostics = { + defaultDiagnosticsProvider = ["shellcheck"]; + diagnosticsProviders = { shellcheck = { package = pkgs.shellcheck; nullConfig = pkg: '' @@ -65,7 +66,7 @@ in { treesitter = { enable = mkEnableOption "Bash treesitter" // {default = config.vim.languages.enableTreesitter;}; - package = lib.nvim.types.mkGrammarOption pkgs "bash"; + package = mkGrammarOption pkgs "bash"; }; lsp = { @@ -106,10 +107,10 @@ in { extraDiagnostics = { enable = mkEnableOption "extra Bash diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;}; - types = lib.nvim.types.diagnostics { + types = diagnostics { langDesc = "Bash"; - inherit diagnostics; - inherit defaultDiagnostics; + inherit diagnosticsProviders; + inherit defaultDiagnosticsProvider; }; }; }; diff --git a/modules/languages/bash/config.nix b/modules/languages/bash/config.nix index e55600b5..7f2a70a5 100644 --- a/modules/languages/bash/config.nix +++ b/modules/languages/bash/config.nix @@ -7,9 +7,10 @@ inherit (lib.lists) isList; inherit (lib.modules) mkIf mkMerge; inherit (lib.nvim.lua) expToLua; + inherit (lib.nvim.languages) diagnosticsToLua; cfg = config.vim.languages.bash; - diagnostics = { + diagnosticsProviders = { shellcheck = { package = pkgs.shellcheck; nullConfig = pkg: '' @@ -72,10 +73,10 @@ in { (mkIf cfg.extraDiagnostics.enable { vim.lsp.null-ls.enable = true; - vim.lsp.null-ls.sources = lib.nvim.languages.diagnosticsToLua { + vim.lsp.null-ls.sources = diagnosticsToLua { lang = "bash"; config = cfg.extraDiagnostics.types; - inherit diagnostics; + inherit diagnosticsProviders; }; }) ]); diff --git a/modules/languages/clang.nix b/modules/languages/clang.nix index ee40edf1..682277d9 100644 --- a/modules/languages/clang.nix +++ b/modules/languages/clang.nix @@ -1,19 +1,27 @@ { - pkgs, config, + pkgs, lib, ... }: let inherit (builtins) attrNames; - inherit (lib) isList nvim optionalString mkEnableOption mkOption types mkIf mkMerge; + inherit (lib.lists) isList; + inherit (lib.strings) optionalString; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) bool enum package either listOf str nullOr; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.lua) expToLua; + inherit (lib.nvim.types) mkGrammarOption; + inherit (lib.nvim.dag) entryAnywhere; + + packageToCmd = package: defaultCmd: + if isList cfg.lsp.package + then expToLua cfg.lsp.package + else ''{ "${cfg.lsp.package}/bin/${defaultCmd}" }''; cfg = config.vim.languages.clang; defaultServer = "ccls"; - packageToCmd = package: defaultCmd: - if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package - else ''{ "${cfg.lsp.package}/bin/${defaultCmd}" }''; servers = { ccls = { package = pkgs.ccls; @@ -79,14 +87,14 @@ in { 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; + type = bool; default = false; }; treesitter = { enable = mkEnableOption "C/C++ treesitter" // {default = config.vim.languages.enableTreesitter;}; - cPackage = nvim.types.mkGrammarOption pkgs "c"; - cppPackage = nvim.types.mkGrammarOption pkgs "cpp"; + cPackage = mkGrammarOption pkgs "c"; + cppPackage = mkGrammarOption pkgs "cpp"; }; lsp = { @@ -94,20 +102,20 @@ in { server = mkOption { description = "The clang LSP server to use"; - type = with types; enum (attrNames servers); + type = enum (attrNames servers); default = defaultServer; }; package = mkOption { description = "clang LSP server package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]''; - type = with types; either package (listOf str); + type = either package (listOf str); default = servers.${cfg.lsp.server}.package; }; opts = mkOption { description = "Options to pass to clang LSP server"; - type = with types; nullOr str; + type = nullOr str; default = null; }; }; @@ -115,17 +123,17 @@ in { dap = { enable = mkOption { description = "Enable clang Debug Adapter"; - type = types.bool; + type = bool; default = config.vim.languages.enableDAP; }; debugger = mkOption { description = "clang debugger to use"; - type = with types; enum (attrNames debuggers); + type = enum (attrNames debuggers); default = defaultDebugger; }; package = mkOption { description = "clang debugger package."; - type = types.package; + type = package; default = debuggers.${cfg.dap.debugger}.package; }; }; @@ -133,7 +141,7 @@ in { config = mkIf cfg.enable (mkMerge [ (mkIf cfg.cHeader { - vim.configRC.c-header = nvim.dag.entryAnywhere "let g:c_syntax_for_h = 1"; + vim.configRC.c-header = entryAnywhere "let g:c_syntax_for_h = 1"; }) (mkIf cfg.treesitter.enable { diff --git a/modules/languages/css.nix b/modules/languages/css.nix index c39ff40c..9646e022 100644 --- a/modules/languages/css.nix +++ b/modules/languages/css.nix @@ -5,7 +5,12 @@ ... }: let inherit (builtins) attrNames; - inherit (lib) mkEnableOption mkOption mkIf mkMerge isList types nvim; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) isList; + inherit (lib.types) enum either listOf package str; + inherit (lib.nvim.types) mkGrammarOption; + inherit (lib.nvim.lua) expToLua; cfg = config.vim.languages.css; @@ -25,7 +30,7 @@ on_attach = default_on_attach; cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else ''{"${cfg.lsp.package}/bin/vscode-css-language-server", "--stdio"}'' } } @@ -39,7 +44,7 @@ in { treesitter = { enable = mkEnableOption "CSS treesitter" // {default = config.vim.languages.enableTreesitter;}; - package = nvim.types.mkGrammarOption pkgs "css"; + package = mkGrammarOption pkgs "css"; }; lsp = { @@ -47,14 +52,14 @@ in { server = mkOption { description = "CSS LSP server to use"; - type = with types; enum (attrNames servers); + type = enum (attrNames servers); default = defaultServer; }; package = mkOption { description = "CSS LSP server package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]''; - type = with types; either package (listOf str); + type = either package (listOf str); default = servers.${cfg.lsp.server}.package; }; }; diff --git a/modules/languages/go.nix b/modules/languages/go.nix index 8e3694c5..055e8edf 100644 --- a/modules/languages/go.nix +++ b/modules/languages/go.nix @@ -1,11 +1,17 @@ { - pkgs, config, + pkgs, lib, ... }: let inherit (builtins) attrNames; - inherit (lib) isList nvim getExe mkEnableOption mkOption types mkMerge mkIf; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.meta) getExe; + inherit (lib.lists) isList; + inherit (lib.types) bool enum either listOf package str; + inherit (lib.nvim.types) mkGrammarOption; + inherit (lib.nvim.lua) expToLua; cfg = config.vim.languages.go; @@ -19,13 +25,14 @@ on_attach = default_on_attach; cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else ''{"${cfg.lsp.package}/bin/gopls", "serve"}'' }, } ''; }; }; + defaultDebugger = "delve"; debuggers = { delve = { @@ -73,7 +80,7 @@ in { treesitter = { enable = mkEnableOption "Go treesitter" // {default = config.vim.languages.enableTreesitter;}; - package = nvim.types.mkGrammarOption pkgs "go"; + package = mkGrammarOption pkgs "go"; }; lsp = { @@ -81,14 +88,14 @@ in { server = mkOption { description = "Go LSP server to use"; - type = with types; enum (attrNames servers); + type = enum (attrNames servers); default = defaultServer; }; package = mkOption { description = "Go LSP server package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]''; - type = with types; either package (listOf str); + type = either package (listOf str); default = servers.${cfg.lsp.server}.package; }; }; @@ -96,17 +103,17 @@ in { dap = { enable = mkOption { description = "Enable Go Debug Adapter"; - type = types.bool; + type = bool; default = config.vim.languages.enableDAP; }; debugger = mkOption { description = "Go debugger to use"; - type = with types; enum (attrNames debuggers); + type = enum (attrNames debuggers); default = defaultDebugger; }; package = mkOption { description = "Go debugger package."; - type = types.package; + type = package; default = debuggers.${cfg.dap.debugger}.package; }; }; diff --git a/modules/languages/html.nix b/modules/languages/html.nix index e2eadaca..a4cf2382 100644 --- a/modules/languages/html.nix +++ b/modules/languages/html.nix @@ -1,27 +1,26 @@ { - pkgs, config, + pkgs, lib, ... }: let - inherit (lib) mkEnableOption mkOption types nvim mkIf mkMerge optional; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.types) bool; + inherit (lib.lists) optional; + inherit (lib.nvim.types) mkGrammarOption; + inherit (lib.nvim.dag) entryAnywhere; 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"; - + enable = mkEnableOption "HTML treesitter support" // {default = config.vim.languages.enableTreesitter;}; + package = mkGrammarOption pkgs "html"; autotagHtml = mkOption { description = "Enable autoclose/autorename of html tags (nvim-ts-autotag)"; - type = types.bool; + type = bool; default = true; }; }; @@ -29,14 +28,18 @@ in { 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.startPlugins = optional cfg.treesitter.autotagHtml "nvim-ts-autotag"; + treesitter = { + enable = true; + grammars = [cfg.treesitter.package]; + }; - vim.luaConfigRC.html-autotag = mkIf cfg.treesitter.autotagHtml (nvim.dag.entryAnywhere '' - require('nvim-ts-autotag').setup() - ''); + luaConfigRC.html-autotag = mkIf cfg.treesitter.autotagHtml (entryAnywhere '' + require('nvim-ts-autotag').setup() + ''); + }; }) ]); } diff --git a/modules/languages/java.nix b/modules/languages/java.nix index fc138ccf..dc46fcfe 100644 --- a/modules/languages/java.nix +++ b/modules/languages/java.nix @@ -1,10 +1,16 @@ { - pkgs, config, + pkgs, lib, ... }: let - inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge getExe; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.meta) getExe; + inherit (lib.lists) isList; + inherit (lib.types) either listOf package str; + inherit (lib.nvim.types) mkGrammarOption; + inherit (lib.nvim.lua) expToLua; cfg = config.vim.languages.java; in { @@ -13,16 +19,15 @@ in { treesitter = { enable = mkEnableOption "Java treesitter" // {default = config.vim.languages.enableTreesitter;}; - package = nvim.types.mkGrammarOption pkgs "java"; + package = mkGrammarOption pkgs "java"; }; lsp = { enable = mkEnableOption "Java LSP support (java-language-server)" // {default = config.vim.languages.enableLSP;}; - package = mkOption { description = "java language server package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]''; - type = with types; either package (listOf str); + type = either package (listOf str); default = pkgs.jdt-language-server; }; }; @@ -37,7 +42,7 @@ in { on_attach = default_on_attach, cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else ''{"${getExe cfg.lsp.package}", "-data", vim.fn.stdpath("cache").."/jdtls/workspace"}'' }, } diff --git a/modules/languages/lua.nix b/modules/languages/lua.nix index 5cfe2032..7cbacb67 100644 --- a/modules/languages/lua.nix +++ b/modules/languages/lua.nix @@ -1,10 +1,18 @@ { - pkgs, config, + pkgs, lib, ... }: let - inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge optionalString getExe; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.meta) getExe; + inherit (lib.lists) isList; + inherit (lib.strings) optionalString; + inherit (lib.types) either listOf package str; + inherit (lib.nvim.types) mkGrammarOption; + inherit (lib.nvim.lua) expToLua; + inherit (lib.nvim.dag) entryBefore; cfg = config.vim.languages.lua; in { @@ -12,14 +20,15 @@ in { enable = mkEnableOption "Lua language support"; treesitter = { enable = mkEnableOption "Lua Treesitter support" // {default = config.vim.languages.enableTreesitter;}; - package = nvim.types.mkGrammarOption pkgs "lua"; + package = mkGrammarOption pkgs "lua"; }; + lsp = { enable = mkEnableOption "Lua LSP support via LuaLS" // {default = config.vim.languages.enableLSP;}; package = mkOption { description = "LuaLS package, or the command to run as a list of strings"; - type = with types; either package (listOf str); + type = either package (listOf str); default = pkgs.lua-language-server; }; @@ -43,7 +52,7 @@ in { ${optionalString cfg.lsp.neodev.enable "before_init = require('neodev.lsp').before_init;"} cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else ''{"${getExe cfg.lsp.package}"}'' }; } @@ -52,7 +61,7 @@ in { (mkIf cfg.lsp.neodev.enable { vim.startPlugins = ["neodev-nvim"]; - vim.luaConfigRC.neodev = nvim.dag.entryBefore ["lua-lsp"] '' + vim.luaConfigRC.neodev = entryBefore ["lua-lsp"] '' require("neodev").setup({}) ''; }) diff --git a/modules/languages/markdown/config.nix b/modules/languages/markdown/config.nix index 964bb698..ccc88368 100644 --- a/modules/languages/markdown/config.nix +++ b/modules/languages/markdown/config.nix @@ -4,7 +4,9 @@ lib, ... }: let - inherit (lib) nvim mkIf mkMerge isList; + inherit (lib.nvim.lua) expToLua; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) isList; cfg = config.vim.languages.markdown; servers = { @@ -16,7 +18,7 @@ on_attach = default_on_attach; cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else ''{"${cfg.lsp.package}/bin/marksman", "server"}'' }, } @@ -27,13 +29,11 @@ in { config = mkIf cfg.enable (mkMerge [ (mkIf cfg.treesitter.enable { vim.treesitter.enable = true; - vim.treesitter.grammars = [cfg.treesitter.mdPackage cfg.treesitter.mdInlinePackage]; }) (mkIf cfg.lsp.enable { vim.lsp.lspconfig.enable = true; - vim.lsp.lspconfig.sources.markdown-lsp = servers.${cfg.lsp.server}.lspConfig; }) ]); diff --git a/modules/languages/markdown/markdown.nix b/modules/languages/markdown/markdown.nix index fe272c10..a58be2a9 100644 --- a/modules/languages/markdown/markdown.nix +++ b/modules/languages/markdown/markdown.nix @@ -1,11 +1,15 @@ { - pkgs, config, + pkgs, lib, ... }: let inherit (builtins) attrNames; - inherit (lib) mkEnableOption mkOption types nvim isList; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.lists) isList; + inherit (lib.types) bool enum either package listOf str; + inherit (lib.nvim.lua) expToLua; + inherit (lib.nvim.types) mkGrammarOption; cfg = config.vim.languages.markdown; defaultServer = "marksman"; @@ -18,7 +22,7 @@ on_attach = default_on_attach; cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else ''{"${cfg.lsp.package}/bin/marksman", "server"}'' }, } @@ -32,11 +36,11 @@ in { treesitter = { enable = mkOption { description = "Enable Markdown treesitter"; - type = types.bool; + type = bool; default = config.vim.languages.enableTreesitter; }; - mdPackage = nvim.types.mkGrammarOption pkgs "markdown"; - mdInlinePackage = nvim.types.mkGrammarOption pkgs "markdown-inline"; + mdPackage = mkGrammarOption pkgs "markdown"; + mdInlinePackage = mkGrammarOption pkgs "markdown-inline"; }; lsp = { @@ -44,14 +48,14 @@ in { server = mkOption { description = "Markdown LSP server to use"; - type = with types; enum (attrNames servers); + type = enum (attrNames servers); default = defaultServer; }; package = mkOption { description = "Markdown LSP server package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]''; - type = with types; either package (listOf str); + type = either package (listOf str); default = servers.${cfg.lsp.server}.package; }; }; diff --git a/modules/languages/nim.nix b/modules/languages/nim.nix index 7297ada9..f218038e 100644 --- a/modules/languages/nim.nix +++ b/modules/languages/nim.nix @@ -1,11 +1,17 @@ { - pkgs, config, + pkgs, lib, ... }: let inherit (builtins) attrNames; - inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) isList; + inherit (lib.types) enum either listOf package str; + inherit (lib.nvim.types) mkGrammarOption; + inherit (lib.nvim.lua) expToLua; + cfg = config.vim.languages.nim; defaultServer = "nimlsp"; @@ -18,7 +24,7 @@ on_attach = default_on_attach; cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else '' {"${cfg.lsp.package}/bin/nimlsp"} '' @@ -47,41 +53,37 @@ in { enable = mkEnableOption "Nim language support"; treesitter = { - enable = mkOption { - description = "Enable Nim treesitter"; - type = types.bool; - default = config.vim.languages.enableTreesitter; - }; - package = nvim.types.mkGrammarOption pkgs "nim"; + enable = mkEnableOption "Nim treesitter" // {default = config.vim.languages.enableTreesitter;}; + package = mkGrammarOption pkgs "nim"; }; lsp = { enable = mkEnableOption "Nim LSP support" // {default = config.vim.languages.enableLSP;}; - server = mkOption { description = "Nim LSP server to use"; - type = types.str; + type = str; default = defaultServer; }; + package = mkOption { description = "Nim LSP server package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.nimlsp]''; - type = with types; either package (listOf str); + type = either package (listOf str); default = servers.${cfg.lsp.server}.package; }; }; format = { enable = mkEnableOption "Nim formatting" // {default = config.vim.languages.enableFormat;}; - type = mkOption { description = "Nim formatter to use"; - type = with types; enum (attrNames formats); + type = enum (attrNames formats); default = defaultFormat; }; + package = mkOption { description = "Nim formatter package"; - type = types.package; + type = package; default = formats.${cfg.format.type}.package; }; }; diff --git a/modules/languages/nix.nix b/modules/languages/nix.nix index e8b55782..2e243ebd 100644 --- a/modules/languages/nix.nix +++ b/modules/languages/nix.nix @@ -1,11 +1,19 @@ { - pkgs, config, + pkgs, lib, ... }: let inherit (builtins) attrNames; - inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge optionalString; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) isList; + inherit (lib.strings) optionalString; + inherit (lib.types) enum either listOf package str; + inherit (lib.nvim.types) mkGrammarOption diagnostics; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.lua) expToLua; + inherit (lib.nvim.languages) diagnosticsToLua; cfg = config.vim.languages.nix; @@ -15,7 +23,7 @@ defaultServer = "nil"; packageToCmd = package: defaultCmd: if isList package - then lib.nvim.lua.expToLua package + then expToLua package else ''{"${package}/bin/${defaultCmd}"}''; servers = { rnix = { @@ -82,14 +90,15 @@ ) ''; }; + nixpkgs-fmt = { package = pkgs.nixpkgs-fmt; # Never need to use null-ls for nixpkgs-fmt }; }; - defaultDiagnostics = ["statix" "deadnix"]; - diagnostics = { + defaultDiagnosticsProvider = ["statix" "deadnix"]; + diagnosticsProviders = { statix = { package = pkgs.statix; nullConfig = pkg: '' @@ -101,6 +110,7 @@ ) ''; }; + deadnix = { package = pkgs.deadnix; nullConfig = pkg: '' @@ -118,26 +128,22 @@ in { enable = mkEnableOption "Nix language support"; treesitter = { - enable = mkOption { - description = "Enable Nix treesitter"; - type = types.bool; - default = config.vim.languages.enableTreesitter; - }; - package = nvim.types.mkGrammarOption pkgs "nix"; + enable = mkEnableOption "Nix treesitter" // {default = config.vim.languages.enableTreesitter;}; + package = mkGrammarOption pkgs "nix"; }; lsp = { enable = mkEnableOption "Nix LSP support" // {default = config.vim.languages.enableLSP;}; - server = mkOption { description = "Nix LSP server to use"; - type = types.str; + type = str; default = defaultServer; }; + package = mkOption { description = "Nix LSP server package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]''; - type = with types; either package (listOf str); + type = either package (listOf str); default = servers.${cfg.lsp.server}.package; }; }; @@ -147,33 +153,30 @@ in { type = mkOption { description = "Nix formatter to use"; - type = with types; enum (attrNames formats); + type = enum (attrNames formats); default = defaultFormat; }; package = mkOption { description = "Nix formatter package"; - type = types.package; + type = package; default = formats.${cfg.format.type}.package; }; }; extraDiagnostics = { - enable = mkOption { - description = "Enable extra Nix diagnostics"; - type = types.bool; - default = config.vim.languages.enableExtraDiagnostics; - }; - types = lib.nvim.types.diagnostics { + enable = mkEnableOption "extra Nix diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;}; + + types = diagnostics { langDesc = "Nix"; - inherit diagnostics; - inherit defaultDiagnostics; + inherit diagnosticsProviders; + inherit defaultDiagnosticsProvider; }; }; }; config = mkIf cfg.enable (mkMerge [ { - vim.configRC.nix = nvim.dag.entryAnywhere '' + vim.configRC.nix = entryAnywhere '' autocmd filetype nix setlocal tabstop=2 shiftwidth=2 softtabstop=2 ''; } @@ -195,10 +198,10 @@ in { (mkIf cfg.extraDiagnostics.enable { vim.lsp.null-ls.enable = true; - vim.lsp.null-ls.sources = lib.nvim.languages.diagnosticsToLua { + vim.lsp.null-ls.sources = diagnosticsToLua { lang = "nix"; config = cfg.extraDiagnostics.types; - inherit diagnostics; + inherit diagnosticsProviders; }; }) ]); diff --git a/modules/languages/php.nix b/modules/languages/php.nix index 6a0071a0..d921b11d 100644 --- a/modules/languages/php.nix +++ b/modules/languages/php.nix @@ -1,11 +1,17 @@ { - pkgs, config, + pkgs, lib, ... }: let inherit (builtins) attrNames; - inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge getExe; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.meta) getExe; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) isList; + inherit (lib.types) enum either listOf package str; + inherit (lib.nvim.types) mkGrammarOption; + inherit (lib.nvim.lua) expToLua; cfg = config.vim.languages.php; @@ -19,7 +25,7 @@ on_attach = default_on_attach, cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else '' { "${getExe cfg.lsp.package}", @@ -39,7 +45,7 @@ on_attach = default_on_attach, cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else '' { "${getExe cfg.lsp.package}", @@ -65,7 +71,7 @@ in { treesitter = { enable = mkEnableOption "PHP treesitter" // {default = config.vim.languages.enableTreesitter;}; - package = nvim.types.mkGrammarOption pkgs "php"; + package = mkGrammarOption pkgs "php"; }; lsp = { @@ -73,14 +79,14 @@ in { server = mkOption { description = "PHP LSP server to use"; - type = with types; enum (attrNames servers); + type = enum (attrNames servers); default = defaultServer; }; package = mkOption { description = "PHP LSP server package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]''; - type = with types; either package (listOf str); + type = either package (listOf str); default = servers.${cfg.lsp.server}.package; }; }; diff --git a/modules/languages/python.nix b/modules/languages/python.nix index 970906fb..d9df6bf8 100644 --- a/modules/languages/python.nix +++ b/modules/languages/python.nix @@ -1,11 +1,16 @@ { - pkgs, config, + pkgs, lib, ... }: let inherit (builtins) attrNames; - inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge getExe literalExpression; + inherit (lib.options) mkEnableOption mkOption literalExpression; + inherit (lib.meta) getExe; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) isList; + inherit (lib.types) enum either listOf package str bool; + inherit (lib.nvim.lua) expToLua; cfg = config.vim.languages.python; @@ -19,7 +24,7 @@ on_attach = default_on_attach; cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else ''{"${cfg.lsp.package}/bin/pyright-langserver", "--stdio"}'' } } @@ -40,6 +45,7 @@ ) ''; }; + isort = { package = pkgs.isort; nullConfig = '' @@ -51,6 +57,7 @@ ) ''; }; + black-and-isort = { package = pkgs.writeShellApplication { name = "black"; @@ -140,7 +147,7 @@ in { enable = mkEnableOption "Python treesitter" // {default = config.vim.languages.enableTreesitter;}; package = mkOption { description = "Python treesitter grammar to use"; - type = types.package; + type = package; default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.python; }; }; @@ -150,14 +157,14 @@ in { server = mkOption { description = "Python LSP server to use"; - type = with types; enum (attrNames servers); + type = enum (attrNames servers); default = defaultServer; }; package = mkOption { description = "python LSP server package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]''; - type = with types; either package (listOf str); + type = either package (listOf str); default = servers.${cfg.lsp.server}.package; }; }; @@ -167,13 +174,13 @@ in { type = mkOption { description = "Python formatter to use"; - type = with types; enum (attrNames formats); + type = enum (attrNames formats); default = defaultFormat; }; package = mkOption { description = "Python formatter package"; - type = types.package; + type = package; default = formats.${cfg.format.type}.package; }; }; @@ -182,25 +189,28 @@ in { dap = { enable = mkOption { description = "Enable Python Debug Adapter"; - type = types.bool; + type = bool; default = config.vim.languages.enableDAP; }; + debugger = mkOption { description = "Python debugger to use"; - type = with types; enum (attrNames debuggers); + type = enum (attrNames debuggers); default = defaultDebugger; }; + package = mkOption { + type = package; + default = debuggers.${cfg.dap.debugger}.package; + example = literalExpression "with pkgs; python39.withPackages (ps: with ps; [debugpy])"; description = '' Python debugger package. This is a python package with debugpy installed, see https://nixos.wiki/wiki/Python#Install_Python_Packages. ''; - example = literalExpression "with pkgs; python39.withPackages (ps: with ps; [debugpy])"; - type = types.package; - default = debuggers.${cfg.dap.debugger}.package; }; }; }; + config = mkIf cfg.enable (mkMerge [ (mkIf cfg.treesitter.enable { vim.treesitter.enable = true; diff --git a/modules/languages/rust.nix b/modules/languages/rust.nix index 1112f7b1..8b4f1b40 100644 --- a/modules/languages/rust.nix +++ b/modules/languages/rust.nix @@ -1,10 +1,18 @@ { - pkgs, config, + pkgs, lib, ... }: let - inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge optionalString boolToString optionals; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.strings) optionalString; + inherit (lib.trivial) boolToString; + inherit (lib.lists) isList optionals; + inherit (lib.types) bool package str listOf either; + inherit (lib.nvim.types) mkGrammarOption; + inherit (lib.nvim.lua) expToLua; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.languages.rust; in { @@ -13,31 +21,30 @@ in { treesitter = { enable = mkEnableOption "Rust treesitter" // {default = config.vim.languages.enableTreesitter;}; - package = nvim.types.mkGrammarOption pkgs "rust"; + package = mkGrammarOption pkgs "rust"; }; crates = { enable = mkEnableOption "crates-nvim, tools for managing dependencies"; codeActions = mkOption { description = "Enable code actions through null-ls"; - type = types.bool; + type = bool; default = true; }; }; lsp = { enable = mkEnableOption "Rust LSP support (rust-analyzer with extra tools)" // {default = config.vim.languages.enableLSP;}; - package = mkOption { description = "rust-analyzer package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]''; - type = with types; either package (listOf str); + type = either package (listOf str); default = pkgs.rust-analyzer; }; opts = mkOption { description = "Options to pass to rust analyzer"; - type = types.str; + type = str; default = ""; }; }; @@ -45,12 +52,13 @@ in { dap = { enable = mkOption { description = "Rust Debug Adapter support"; - type = types.bool; + type = bool; default = config.vim.languages.enableDAP; }; + package = mkOption { description = "lldb pacakge"; - type = types.package; + type = package; default = pkgs.lldb; }; }; @@ -58,89 +66,95 @@ in { 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" = "[Crates]";}; - vim.luaConfigRC.rust-crates = nvim.dag.entryAnywhere '' - require('crates').setup { - null_ls = { - enabled = ${boolToString cfg.crates.codeActions}, - name = "crates.nvim", + vim = { + startPlugins = ["crates-nvim"]; + lsp.null-ls.enable = mkIf cfg.crates.codeActions true; + autocomplete.sources = {"crates" = "[Crates]";}; + luaConfigRC.rust-crates = 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 || cfg.dap.enable) { - vim.startPlugins = ["rust-tools"] ++ optionals cfg.dap.enable [cfg.dap.package]; + vim = { + startPlugins = ["rust-tools"] ++ optionals cfg.dap.enable [cfg.dap.package]; - 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) - ${optionalString cfg.dap.enable '' - vim.keymap.set("n", "rd", ":RustDebuggables", opts) - vim.keymap.set( - "n", "${config.vim.debugger.nvim-dap.mappings.continue}", - function() - local dap = require("dap") - if dap.status() == "" then - vim.cmd "RustDebuggables" - else - dap.continue() - end - 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 = ${ - if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package - else ''{"${cfg.lsp.package}/bin/rust-analyzer"}'' - }, - settings = { - ${cfg.lsp.opts} - } - }, - - ${optionalString cfg.dap.enable '' - dap = { - adapter = { - type = "executable", - command = "${cfg.dap.package}/bin/lldb-vscode", - name = "rt_lldb", + lsp.lspconfig = { + enable = true; + 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) + ${optionalString cfg.dap.enable '' + vim.keymap.set("n", "rd", ":RustDebuggables", opts) + vim.keymap.set( + "n", "${config.vim.debugger.nvim-dap.mappings.continue}", + function() + local dap = require("dap") + if dap.status() == "" then + vim.cmd "RustDebuggables" + else + dap.continue() + end + 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 = ${ + if isList cfg.lsp.package + then expToLua cfg.lsp.package + else ''{"${cfg.lsp.package}/bin/rust-analyzer"}'' }, - }, - ''} - } - rt.setup(rustopts) - ''; + settings = { + ${cfg.lsp.opts} + } + }, + + ${optionalString cfg.dap.enable '' + dap = { + adapter = { + type = "executable", + command = "${cfg.dap.package}/bin/lldb-vscode", + name = "rt_lldb", + }, + }, + ''} + } + rt.setup(rustopts) + ''; + }; + }; }) ]); } diff --git a/modules/languages/sql.nix b/modules/languages/sql.nix index 83415bad..ed08ee72 100644 --- a/modules/languages/sql.nix +++ b/modules/languages/sql.nix @@ -1,11 +1,17 @@ { - pkgs, config, + pkgs, lib, ... }: let inherit (builtins) attrNames; - inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) isList; + inherit (lib.types) enum either listOf package str; + inherit (lib.nvim.lua) expToLua; + inherit (lib.nvim.languages) diagnosticsToLua; + inherit (lib.nvim.types) diagnostics; cfg = config.vim.languages.sql; sqlfluffDefault = pkgs.sqlfluff; @@ -23,7 +29,7 @@ end, cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else ''{ "${cfg.lsp.package}/bin/sqls", "-config", string.format("%s/config.yml", vim.fn.getcwd()) }'' } } @@ -47,8 +53,8 @@ }; }; - defaultDiagnostics = ["sqlfluff"]; - diagnostics = { + defaultDiagnosticsProvider = ["sqlfluff"]; + diagnosticsProviders = { sqlfluff = { package = sqlfluffDefault; nullConfig = pkg: '' @@ -68,7 +74,7 @@ in { dialect = mkOption { description = "SQL dialect for sqlfluff (if used)"; - type = types.str; + type = str; default = "ansi"; }; @@ -77,7 +83,7 @@ in { package = mkOption { description = "SQL treesitter grammar to use"; - type = types.package; + type = package; default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.sql; }; }; @@ -87,14 +93,14 @@ in { server = mkOption { description = "SQL LSP server to use"; - type = with types; enum (attrNames servers); + type = enum (attrNames servers); default = defaultServer; }; package = mkOption { description = "SQL LSP server package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]''; - type = with types; either package (listOf str); + type = either package (listOf str); default = servers.${cfg.lsp.server}.package; }; }; @@ -104,13 +110,13 @@ in { type = mkOption { description = "SQL formatter to use"; - type = with types; enum (attrNames formats); + type = enum (attrNames formats); default = defaultFormat; }; package = mkOption { description = "SQL formatter package"; - type = types.package; + type = package; default = formats.${cfg.format.type}.package; }; }; @@ -118,10 +124,10 @@ in { extraDiagnostics = { enable = mkEnableOption "extra SQL diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;}; - types = lib.nvim.types.diagnostics { + types = diagnostics { langDesc = "SQL"; - inherit diagnostics; - inherit defaultDiagnostics; + inherit diagnosticsProviders; + inherit defaultDiagnosticsProvider; }; }; }; @@ -133,10 +139,14 @@ in { }) (mkIf cfg.lsp.enable { - vim.startPlugins = ["sqls-nvim"]; + vim = { + startPlugins = ["sqls-nvim"]; - vim.lsp.lspconfig.enable = true; - vim.lsp.lspconfig.sources.sql-lsp = servers.${cfg.lsp.server}.lspConfig; + lsp.lspconfig = { + enable = true; + sources.sql-lsp = servers.${cfg.lsp.server}.lspConfig; + }; + }; }) (mkIf cfg.format.enable { @@ -146,10 +156,10 @@ in { (mkIf cfg.extraDiagnostics.enable { vim.lsp.null-ls.enable = true; - vim.lsp.null-ls.sources = lib.nvim.languages.diagnosticsToLua { + vim.lsp.null-ls.sources = diagnosticsToLua { lang = "sql"; config = cfg.extraDiagnostics.types; - inherit diagnostics; + inherit diagnosticsProviders; }; }) ]); diff --git a/modules/languages/svelte.nix b/modules/languages/svelte.nix index 2c0d40eb..599686ee 100644 --- a/modules/languages/svelte.nix +++ b/modules/languages/svelte.nix @@ -1,11 +1,18 @@ { - pkgs, config, + pkgs, lib, ... }: let inherit (builtins) attrNames; - inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) isList; + inherit (lib.meta) getExe; + inherit (lib.types) enum either listOf package str; + inherit (lib.nvim.lua) expToLua; + inherit (lib.nvim.languages) diagnosticsToLua; + inherit (lib.nvim.types) mkGrammarOption diagnostics; cfg = config.vim.languages.svelte; @@ -19,7 +26,7 @@ on_attach = attach_keymaps, cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else ''{"${cfg.lsp.package}/bin/svelteserver", "--stdio"}'' } } @@ -44,15 +51,15 @@ }; # TODO: specify packages - defaultDiagnostics = ["eslint_d"]; - diagnostics = { + defaultDiagnosticsProvider = ["eslint_d"]; + diagnosticsProviders = { eslint_d = { package = pkgs.nodePackages.eslint_d; nullConfig = pkg: '' table.insert( ls_sources, null_ls.builtins.diagnostics.eslint_d.with({ - command = "${lib.getExe pkg}", + command = "${getExe pkg}", }) ) ''; @@ -65,7 +72,7 @@ in { treesitter = { enable = mkEnableOption "Svelte treesitter" // {default = config.vim.languages.enableTreesitter;}; - sveltePackage = nvim.types.mkGrammarOption pkgs "svelte"; + sveltePackage = mkGrammarOption pkgs "svelte"; }; lsp = { @@ -73,14 +80,14 @@ in { server = mkOption { description = "Svelte LSP server to use"; - type = with types; enum (attrNames servers); + type = enum (attrNames servers); default = defaultServer; }; package = mkOption { description = "Svelte LSP server package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]''; - type = with types; either package (listOf str); + type = either package (listOf str); default = servers.${cfg.lsp.server}.package; }; }; @@ -90,13 +97,13 @@ in { type = mkOption { description = "Svelte formatter to use"; - type = with types; enum (attrNames formats); + type = enum (attrNames formats); default = defaultFormat; }; package = mkOption { description = "Svelte formatter package"; - type = types.package; + type = package; default = formats.${cfg.format.type}.package; }; }; @@ -104,10 +111,10 @@ in { extraDiagnostics = { enable = mkEnableOption "extra Svelte diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;}; - types = lib.nvim.types.diagnostics { + types = diagnostics { langDesc = "Svelte"; - inherit diagnostics; - inherit defaultDiagnostics; + inherit diagnosticsProviders; + inherit defaultDiagnosticsProvider; }; }; }; @@ -130,10 +137,10 @@ in { (mkIf cfg.extraDiagnostics.enable { vim.lsp.null-ls.enable = true; - vim.lsp.null-ls.sources = lib.nvim.languages.diagnosticsToLua { + vim.lsp.null-ls.sources = diagnosticsToLua { lang = "svelte"; config = cfg.extraDiagnostics.types; - inherit diagnostics; + inherit diagnosticsProviders; }; }) ]); diff --git a/modules/languages/tailwind.nix b/modules/languages/tailwind.nix index 543eac84..d641b7e9 100644 --- a/modules/languages/tailwind.nix +++ b/modules/languages/tailwind.nix @@ -5,7 +5,11 @@ ... }: let inherit (builtins) attrNames; - inherit (lib) mkEnableOption mkOption mkIf mkMerge isList types nvim; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) isList; + inherit (lib.types) enum either listOf package str; + inherit (lib.nvim.lua) expToLua; cfg = config.vim.languages.tailwind; @@ -19,7 +23,7 @@ on_attach = default_on_attach; cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else ''{"${cfg.lsp.package}/bin/tailwindcss-language-server", "--stdio"}'' } } @@ -35,14 +39,14 @@ in { server = mkOption { description = "Tailwindcss LSP server to use"; - type = with types; enum (attrNames servers); + type = enum (attrNames servers); default = defaultServer; }; package = mkOption { description = "Tailwindcss LSP server package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]''; - type = with types; either package (listOf str); + type = either package (listOf str); default = servers.${cfg.lsp.server}.package; }; }; diff --git a/modules/languages/terraform.nix b/modules/languages/terraform.nix index db2e525e..33bb9357 100644 --- a/modules/languages/terraform.nix +++ b/modules/languages/terraform.nix @@ -1,10 +1,13 @@ { - pkgs, config, + pkgs, lib, ... }: let - inherit (lib) nvim mkEnableOption mkOption types mkIf mkMerge; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.types) package; + inherit (lib.nvim.types) mkGrammarOption; cfg = config.vim.languages.terraform; in { @@ -13,7 +16,7 @@ in { treesitter = { enable = mkEnableOption "Terraform treesitter" // {default = config.vim.languages.enableTreesitter;}; - package = nvim.types.mkGrammarOption pkgs "terraform"; + package = mkGrammarOption pkgs "terraform"; }; lsp = { @@ -21,7 +24,7 @@ in { package = mkOption { description = "terraform-ls package"; - type = with types; package; + type = package; default = pkgs.terraform-ls; }; }; diff --git a/modules/languages/tidal/config.nix b/modules/languages/tidal/config.nix index c659d06a..344c1a77 100644 --- a/modules/languages/tidal/config.nix +++ b/modules/languages/tidal/config.nix @@ -4,7 +4,7 @@ lib, ... }: let - inherit (lib) mkIf; + inherit (lib.modules) mkIf; cfg = config.vim.tidal; in { diff --git a/modules/languages/tidal/tidal.nix b/modules/languages/tidal/tidal.nix index e5ec413f..ebfe4a0f 100644 --- a/modules/languages/tidal/tidal.nix +++ b/modules/languages/tidal/tidal.nix @@ -3,20 +3,21 @@ lib, ... }: let - inherit (lib) mkEnableOption mkOption types; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) int bool; in { options.vim.tidal = { enable = mkEnableOption "tidalcycles tools and plugins"; flash = mkOption { description = ''When sending a paragraph or a single line, vim-tidal will "flash" the selection for some milliseconds''; - type = types.int; + type = int; default = 150; }; openSC = mkOption { description = "Automatically run the supercollider CLI, sclang, alongside the Tidal GHCI terminal."; - type = types.bool; + type = bool; default = true; }; }; diff --git a/modules/languages/ts.nix b/modules/languages/ts.nix index 7fc1a24f..ac77f540 100644 --- a/modules/languages/ts.nix +++ b/modules/languages/ts.nix @@ -1,11 +1,18 @@ { - pkgs, config, + pkgs, lib, ... }: let inherit (builtins) attrNames; - inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) isList; + inherit (lib.meta) getExe; + inherit (lib.types) enum either listOf package str; + inherit (lib.nvim.lua) expToLua; + inherit (lib.nvim.types) mkGrammarOption diagnostics; + inherit (lib.nvim.languages) diagnosticsToLua; cfg = config.vim.languages.ts; @@ -19,7 +26,7 @@ on_attach = attach_keymaps, cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else ''{"${cfg.lsp.package}/bin/typescript-language-server", "--stdio"}'' } } @@ -34,7 +41,7 @@ on_attach = attach_keymaps, cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else ''{"${cfg.lsp.package}/bin/deno", "lsp"}'' } } @@ -70,15 +77,15 @@ }; # TODO: specify packages - defaultDiagnostics = ["eslint_d"]; - diagnostics = { + defaultDiagnosticsProvider = ["eslint_d"]; + diagnosticsProviders = { eslint_d = { package = pkgs.nodePackages.eslint_d; nullConfig = pkg: '' table.insert( ls_sources, null_ls.builtins.diagnostics.eslint_d.with({ - command = "${lib.getExe pkg}", + command = "${getExe pkg}", }) ) ''; @@ -90,8 +97,8 @@ in { treesitter = { enable = mkEnableOption "Typescript/Javascript treesitter" // {default = config.vim.languages.enableTreesitter;}; - tsPackage = nvim.types.mkGrammarOption pkgs "tsx"; - jsPackage = nvim.types.mkGrammarOption pkgs "javascript"; + tsPackage = mkGrammarOption pkgs "tsx"; + jsPackage = mkGrammarOption pkgs "javascript"; }; lsp = { @@ -99,14 +106,14 @@ in { server = mkOption { description = "Typescript/Javascript LSP server to use"; - type = with types; enum (attrNames servers); + type = enum (attrNames servers); default = defaultServer; }; package = mkOption { description = "Typescript/Javascript LSP server package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]''; - type = with types; either package (listOf str); + type = either package (listOf str); default = servers.${cfg.lsp.server}.package; }; }; @@ -116,13 +123,13 @@ in { type = mkOption { description = "Typescript/Javascript formatter to use"; - type = with types; enum (attrNames formats); + type = enum (attrNames formats); default = defaultFormat; }; package = mkOption { description = "Typescript/Javascript formatter package"; - type = types.package; + type = package; default = formats.${cfg.format.type}.package; }; }; @@ -130,10 +137,10 @@ in { extraDiagnostics = { enable = mkEnableOption "extra Typescript/Javascript diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;}; - types = lib.nvim.types.diagnostics { + types = diagnostics { langDesc = "Typescript/Javascript"; - inherit diagnostics; - inherit defaultDiagnostics; + inherit diagnosticsProviders; + inherit defaultDiagnosticsProvider; }; }; }; @@ -156,10 +163,10 @@ in { (mkIf cfg.extraDiagnostics.enable { vim.lsp.null-ls.enable = true; - vim.lsp.null-ls.sources = lib.nvim.languages.diagnosticsToLua { + vim.lsp.null-ls.sources = diagnosticsToLua { lang = "ts"; config = cfg.extraDiagnostics.types; - inherit diagnostics; + inherit diagnosticsProviders; }; }) ]); diff --git a/modules/languages/zig.nix b/modules/languages/zig.nix index bb4f2786..b0217b9f 100644 --- a/modules/languages/zig.nix +++ b/modules/languages/zig.nix @@ -1,10 +1,15 @@ { - pkgs, config, + pkgs, lib, ... }: let - inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) isList; + inherit (lib.types) either listOf package str; + inherit (lib.nvim.lua) expToLua; + inherit (lib.nvim.types) mkGrammarOption; cfg = config.vim.languages.zig; in { @@ -13,7 +18,7 @@ in { treesitter = { enable = mkEnableOption "Zig treesitter" // {default = config.vim.languages.enableTreesitter;}; - package = nvim.types.mkGrammarOption pkgs "zig"; + package = mkGrammarOption pkgs "zig"; }; lsp = { @@ -22,13 +27,13 @@ in { package = mkOption { description = "ZLS package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]''; - type = with types; either package (listOf str); + type = either package (listOf str); default = pkgs.zls; }; zigPackage = mkOption { description = "Zig package used by ZLS"; - type = types.package; + type = package; default = pkgs.zig; }; }; @@ -47,7 +52,7 @@ in { on_attach=default_on_attach, cmd = ${ if isList cfg.lsp.package - then nvim.lua.expToLua cfg.lsp.package + then expToLua cfg.lsp.package else ''{"${cfg.lsp.package}/bin/zls"}'' }, settings = { diff --git a/modules/lsp/config.nix b/modules/lsp/config.nix index 1d44ea7a..ba93b287 100644 --- a/modules/lsp/config.nix +++ b/modules/lsp/config.nix @@ -4,7 +4,11 @@ pkgs, ... }: let - inherit (lib) addDescriptionsToMappings mkIf optional boolToString optionalString; + inherit (lib.modules) mkIf; + inherit (lib.lists) optional; + inherit (lib.strings) optionalString; + inherit (lib.trivial) boolToString; + inherit (lib.nvim.binds) addDescriptionsToMappings; cfg = config.vim.lsp; usingNvimCmp = config.vim.autocomplete.enable && config.vim.autocomplete.type == "nvim-cmp"; @@ -15,99 +19,102 @@ mkBinding = binding: action: "vim.api.nvim_buf_set_keymap(bufnr, 'n', '${binding.value}', 'lua ${action}', {noremap=true, silent=true, desc='${binding.description}'})"; in { config = mkIf cfg.enable { - vim.startPlugins = optional usingNvimCmp "cmp-nvim-lsp"; + vim = { + startPlugins = optional usingNvimCmp "cmp-nvim-lsp"; - vim.autocomplete.sources = {"nvim_lsp" = "[LSP]";}; - vim.luaConfigRC.lsp-setup = '' - vim.g.formatsave = ${boolToString cfg.formatOnSave}; + autocomplete.sources = {"nvim_lsp" = "[LSP]";}; - local attach_keymaps = function(client, bufnr) - ${mkBinding mappings.goToDeclaration "vim.lsp.buf.declaration()"} - ${mkBinding mappings.goToDefinition "vim.lsp.buf.definition()"} - ${mkBinding mappings.goToType "vim.lsp.buf.type_definition()"} - ${mkBinding mappings.listImplementations "vim.lsp.buf.implementation()"} - ${mkBinding mappings.listReferences "vim.lsp.buf.references()"} - ${mkBinding mappings.nextDiagnostic "vim.diagnostic.goto_next()"} - ${mkBinding mappings.previousDiagnostic "vim.diagnostic.goto_prev()"} - ${mkBinding mappings.openDiagnosticFloat "vim.diagnostic.open_float()"} - ${mkBinding mappings.documentHighlight "vim.lsp.buf.document_highlight()"} - ${mkBinding mappings.listDocumentSymbols "vim.lsp.buf.document_symbol()"} - ${mkBinding mappings.addWorkspaceFolder "vim.lsp.buf.add_workspace_folder()"} - ${mkBinding mappings.removeWorkspaceFolder "vim.lsp.buf.remove_workspace_folder()"} - ${mkBinding mappings.listWorkspaceFolders "print(vim.inspect(vim.lsp.buf.list_workspace_folders()))"} - ${mkBinding mappings.listWorkspaceSymbols "vim.lsp.buf.workspace_symbol()"} - ${mkBinding mappings.hover "vim.lsp.buf.hover()"} - ${mkBinding mappings.signatureHelp "vim.lsp.buf.signature_help()"} - ${mkBinding mappings.renameSymbol "vim.lsp.buf.rename()"} - ${mkBinding mappings.codeAction "vim.lsp.buf.code_action()"} - ${mkBinding mappings.format "vim.lsp.buf.format()"} - ${mkBinding mappings.toggleFormatOnSave "vim.b.disableFormatSave = not vim.b.disableFormatSave"} - end + luaConfigRC.lsp-setup = '' + vim.g.formatsave = ${boolToString cfg.formatOnSave}; - -- Enable formatting - local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + local attach_keymaps = function(client, bufnr) + ${mkBinding mappings.goToDeclaration "vim.lsp.buf.declaration()"} + ${mkBinding mappings.goToDefinition "vim.lsp.buf.definition()"} + ${mkBinding mappings.goToType "vim.lsp.buf.type_definition()"} + ${mkBinding mappings.listImplementations "vim.lsp.buf.implementation()"} + ${mkBinding mappings.listReferences "vim.lsp.buf.references()"} + ${mkBinding mappings.nextDiagnostic "vim.diagnostic.goto_next()"} + ${mkBinding mappings.previousDiagnostic "vim.diagnostic.goto_prev()"} + ${mkBinding mappings.openDiagnosticFloat "vim.diagnostic.open_float()"} + ${mkBinding mappings.documentHighlight "vim.lsp.buf.document_highlight()"} + ${mkBinding mappings.listDocumentSymbols "vim.lsp.buf.document_symbol()"} + ${mkBinding mappings.addWorkspaceFolder "vim.lsp.buf.add_workspace_folder()"} + ${mkBinding mappings.removeWorkspaceFolder "vim.lsp.buf.remove_workspace_folder()"} + ${mkBinding mappings.listWorkspaceFolders "print(vim.inspect(vim.lsp.buf.list_workspace_folders()))"} + ${mkBinding mappings.listWorkspaceSymbols "vim.lsp.buf.workspace_symbol()"} + ${mkBinding mappings.hover "vim.lsp.buf.hover()"} + ${mkBinding mappings.signatureHelp "vim.lsp.buf.signature_help()"} + ${mkBinding mappings.renameSymbol "vim.lsp.buf.rename()"} + ${mkBinding mappings.codeAction "vim.lsp.buf.code_action()"} + ${mkBinding mappings.format "vim.lsp.buf.format()"} + ${mkBinding mappings.toggleFormatOnSave "vim.b.disableFormatSave = not vim.b.disableFormatSave"} + end - format_callback = function(client, bufnr) - if vim.g.formatsave then - vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = function() - ${ - if config.vim.lsp.null-ls.enable - then '' - if vim.b.disableFormatSave then - return - end + -- Enable formatting + local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) - local function is_null_ls_formatting_enabled(bufnr) - local file_type = vim.api.nvim_buf_get_option(bufnr, "filetype") - local generators = require("null-ls.generators").get_available( - file_type, - require("null-ls.methods").internal.FORMATTING - ) - return #generators > 0 - end + format_callback = function(client, bufnr) + if vim.g.formatsave then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + ${ + if config.vim.lsp.null-ls.enable + then '' + if vim.b.disableFormatSave then + return + end - if is_null_ls_formatting_enabled(bufnr) then - vim.lsp.buf.format({ - bufnr = bufnr, - filter = function(client) - return client.name == "null-ls" - end - }) - else - vim.lsp.buf.format({ - bufnr = bufnr, - }) - end - '' - else " + local function is_null_ls_formatting_enabled(bufnr) + local file_type = vim.api.nvim_buf_get_option(bufnr, "filetype") + local generators = require("null-ls.generators").get_available( + file_type, + require("null-ls.methods").internal.FORMATTING + ) + return #generators > 0 + end + + if is_null_ls_formatting_enabled(bufnr) then + vim.lsp.buf.format({ + bufnr = bufnr, + filter = function(client) + return client.name == "null-ls" + end + }) + else + vim.lsp.buf.format({ + bufnr = bufnr, + }) + end + '' + else " vim.lsp.buf.format({ bufnr = bufnr, }) " - } - end, - }) + } + end, + }) + end end - end - ${optionalString (config.vim.ui.breadcrumbs.enable) ''local navic = require("nvim-navic")''} - default_on_attach = function(client, bufnr) - attach_keymaps(client, bufnr) - format_callback(client, bufnr) - ${optionalString (config.vim.ui.breadcrumbs.enable) '' - -- let navic attach to buffers - if client.server_capabilities.documentSymbolProvider then - navic.attach(client, bufnr) + ${optionalString (config.vim.ui.breadcrumbs.enable) ''local navic = require("nvim-navic")''} + default_on_attach = function(client, bufnr) + attach_keymaps(client, bufnr) + format_callback(client, bufnr) + ${optionalString (config.vim.ui.breadcrumbs.enable) '' + -- let navic attach to buffers + if client.server_capabilities.documentSymbolProvider then + navic.attach(client, bufnr) + end + ''} end - ''} - end - local capabilities = vim.lsp.protocol.make_client_capabilities() - ${optionalString usingNvimCmp "capabilities = require('cmp_nvim_lsp').default_capabilities()"} - ''; + 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 9a70efc6..f8408aab 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/lsp/lightbulb/config.nix b/modules/lsp/lightbulb/config.nix index 3a13f684..ef2239f0 100644 --- a/modules/lsp/lightbulb/config.nix +++ b/modules/lsp/lightbulb/config.nix @@ -3,20 +3,21 @@ lib, ... }: let - inherit (lib) mkIf nvim; + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.lsp; in { config = mkIf (cfg.enable && cfg.lightbulb.enable) { - vim.startPlugins = ["nvim-lightbulb"]; + vim = { + startPlugins = ["nvim-lightbulb"]; - vim.configRC.lightbulb = nvim.dag.entryAnywhere '' - autocmd CursorHold,CursorHoldI * lua require'nvim-lightbulb'.update_lightbulb() - ''; + luaConfigRC.lightbulb = entryAnywhere '' + vim.api.nvim_command('autocmd CursorHold,CursorHoldI * lua require\'nvim-lightbulb\'.update_lightbulb()') - vim.luaConfigRC.lightbulb = nvim.dag.entryAnywhere '' - -- Enable trouble diagnostics viewer - require'nvim-lightbulb'.setup() - ''; + -- Enable trouble diagnostics viewer + require'nvim-lightbulb'.setup() + ''; + }; }; } diff --git a/modules/lsp/lightbulb/default.nix b/modules/lsp/lightbulb/default.nix index 883944a8..3e6e8a34 100644 --- a/modules/lsp/lightbulb/default.nix +++ b/modules/lsp/lightbulb/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./lightbulb.nix ./config.nix diff --git a/modules/lsp/lightbulb/lightbulb.nix b/modules/lsp/lightbulb/lightbulb.nix index 44d0ce08..ef101a0e 100644 --- a/modules/lsp/lightbulb/lightbulb.nix +++ b/modules/lsp/lightbulb/lightbulb.nix @@ -1,9 +1,5 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkEnableOption; +{lib, ...}: let + inherit (lib.options) mkEnableOption; in { options.vim.lsp = { lightbulb = { diff --git a/modules/lsp/lsp-signature/config.nix b/modules/lsp/lsp-signature/config.nix index 18ac5d1e..5b231bdd 100644 --- a/modules/lsp/lsp-signature/config.nix +++ b/modules/lsp/lsp-signature/config.nix @@ -3,25 +3,29 @@ lib, ... }: let - inherit (lib) mkIf nvim optionalString; + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.strings) optionalString; cfg = config.vim.lsp; in { config = mkIf (cfg.enable && cfg.lspSignature.enable) { - vim.startPlugins = [ - "lsp-signature" - ]; + vim = { + startPlugins = [ + "lsp-signature" + ]; - vim.luaConfigRC.lsp-signature = nvim.dag.entryAnywhere '' - -- Enable lsp signature viewer - require("lsp_signature").setup({ - ${optionalString (config.vim.ui.borders.plugins.lsp-signature.enable) '' - bind = true, -- This is mandatory, otherwise border config won't get registered. - handler_opts = { - border = "${config.vim.ui.borders.plugins.lsp-signature.style}" - } - ''} - }) - ''; + luaConfigRC.lsp-signature = entryAnywhere '' + -- Enable lsp signature viewer + require("lsp_signature").setup({ + ${optionalString config.vim.ui.borders.plugins.lsp-signature.enable '' + bind = true, -- This is mandatory, otherwise border config won't get registered. + handler_opts = { + border = "${config.vim.ui.borders.plugins.lsp-signature.style}" + } + ''} + }) + ''; + }; }; } diff --git a/modules/lsp/lsp-signature/default.nix b/modules/lsp/lsp-signature/default.nix index 0449a9e8..d88ec999 100644 --- a/modules/lsp/lsp-signature/default.nix +++ b/modules/lsp/lsp-signature/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./lsp-signature.nix ./config.nix diff --git a/modules/lsp/lsp-signature/lsp-signature.nix b/modules/lsp/lsp-signature/lsp-signature.nix index d05161ec..981526b3 100644 --- a/modules/lsp/lsp-signature/lsp-signature.nix +++ b/modules/lsp/lsp-signature/lsp-signature.nix @@ -1,13 +1,9 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkEnableOption; +{lib, ...}: let + inherit (lib.options) mkEnableOption; in { options.vim.lsp = { lspSignature = { - enable = mkEnableOption "lsp signature viewer"; + enable = mkEnableOption "lsp signature viewer [lsp-signature]"; }; }; } diff --git a/modules/lsp/lspconfig/config.nix b/modules/lsp/lspconfig/config.nix index 527bbeda..1736ce99 100644 --- a/modules/lsp/lspconfig/config.nix +++ b/modules/lsp/lspconfig/config.nix @@ -1,32 +1,35 @@ { - pkgs, config, lib, ... }: let - inherit (lib) mkIf mkMerge nvim optionalString mapAttrs; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.strings) optionalString; + inherit (lib.attrsets) mapAttrs; + inherit (lib.nvim.dag) entryAfter; cfg = config.vim.lsp; in { config = mkIf cfg.lspconfig.enable (mkMerge [ { - vim.lsp.enable = true; + vim = { + lsp.enable = true; - vim.startPlugins = ["nvim-lspconfig"]; + startPlugins = ["nvim-lspconfig"]; - vim.luaConfigRC.lspconfig = nvim.dag.entryAfter ["lsp-setup"] '' - local lspconfig = require('lspconfig') + luaConfigRC.lspconfig = entryAfter ["lsp-setup"] '' + local lspconfig = require('lspconfig') - ${ - # TODO: make border style configurable - optionalString (config.vim.ui.borders.enable) '' - require('lspconfig.ui.windows').default_options.border = '${config.vim.ui.borders.globalStyle}' - '' - } - ''; + ${ + optionalString config.vim.ui.borders.enable '' + require('lspconfig.ui.windows').default_options.border = '${config.vim.ui.borders.globalStyle}' + '' + } + ''; + }; } { - vim.luaConfigRC = mapAttrs (_: v: (nvim.dag.entryAfter ["lspconfig"] v)) cfg.lspconfig.sources; + vim.luaConfigRC = mapAttrs (_: v: (entryAfter ["lspconfig"] v)) cfg.lspconfig.sources; } ]); } diff --git a/modules/lsp/lspconfig/default.nix b/modules/lsp/lspconfig/default.nix index 117e4d44..e6e6c188 100644 --- a/modules/lsp/lspconfig/default.nix +++ b/modules/lsp/lspconfig/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./config.nix ./lspconfig.nix diff --git a/modules/lsp/lspconfig/lspconfig.nix b/modules/lsp/lspconfig/lspconfig.nix index 7dd8ff0b..2f7c7ac4 100644 --- a/modules/lsp/lspconfig/lspconfig.nix +++ b/modules/lsp/lspconfig/lspconfig.nix @@ -1,17 +1,13 @@ -{ - pkgs, - config, - lib, - ... -}: let - inherit (lib) mkEnableOption mkOption types; +{lib, ...}: let + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) attrsOf str; in { options.vim.lsp.lspconfig = { enable = mkEnableOption "nvim-lspconfig, also enabled automatically"; sources = mkOption { description = "nvim-lspconfig sources"; - type = with types; attrsOf str; + type = attrsOf str; default = {}; }; }; diff --git a/modules/lsp/lspkind/config.nix b/modules/lsp/lspkind/config.nix index 2c21c264..a98aeabb 100644 --- a/modules/lsp/lspkind/config.nix +++ b/modules/lsp/lspkind/config.nix @@ -1,16 +1,16 @@ { - pkgs, config, lib, ... }: let - inherit (lib) mkIf nvim; + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.lsp; in { config = mkIf (cfg.enable && cfg.lspkind.enable) { vim.startPlugins = ["lspkind"]; - vim.luaConfigRC.lspkind = nvim.dag.entryAnywhere '' + vim.luaConfigRC.lspkind = 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 index 81f7418b..fbfa5060 100644 --- a/modules/lsp/lspkind/default.nix +++ b/modules/lsp/lspkind/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./config.nix ./lspkind.nix diff --git a/modules/lsp/lspkind/lspkind.nix b/modules/lsp/lspkind/lspkind.nix index 48566883..8ae9f39a 100644 --- a/modules/lsp/lspkind/lspkind.nix +++ b/modules/lsp/lspkind/lspkind.nix @@ -1,12 +1,6 @@ -{ - pkgs, - config, - lib, - ... -}: let - inherit (lib) mkEnableOption mkOption types; - - cfg = config.vim.lsp; +{lib, ...}: let + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) enum; in { options.vim.lsp = { lspkind = { @@ -14,7 +8,7 @@ in { mode = mkOption { description = "Defines how annotations are shown"; - type = with types; enum ["text" "text_symbol" "symbol_text" "symbol"]; + type = enum ["text" "text_symbol" "symbol_text" "symbol"]; default = "symbol_text"; }; }; diff --git a/modules/lsp/lsplines/config.nix b/modules/lsp/lsplines/config.nix index 66eb5ff1..3436f646 100644 --- a/modules/lsp/lsplines/config.nix +++ b/modules/lsp/lsplines/config.nix @@ -3,13 +3,14 @@ lib, ... }: let - inherit (lib) mkIf nvim; + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAfter; cfg = config.vim.lsp; in { config = mkIf (cfg.enable && cfg.lsplines.enable) { vim.startPlugins = ["lsp-lines"]; - vim.luaConfigRC.lsplines = nvim.dag.entryAfter ["lspconfig"] '' + vim.luaConfigRC.lsplines = entryAfter ["lspconfig"] '' require("lsp_lines").setup() vim.diagnostic.config({ diff --git a/modules/lsp/lsplines/default.nix b/modules/lsp/lsplines/default.nix index fa50897f..359cec4f 100644 --- a/modules/lsp/lsplines/default.nix +++ b/modules/lsp/lsplines/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./config.nix ./lsplines.nix diff --git a/modules/lsp/lsplines/lsplines.nix b/modules/lsp/lsplines/lsplines.nix index 9b5f6a63..aac4cbbc 100644 --- a/modules/lsp/lsplines/lsplines.nix +++ b/modules/lsp/lsplines/lsplines.nix @@ -1,9 +1,11 @@ {lib, ...}: let - inherit (lib) mkEnableOption; + inherit (lib.options) mkEnableOption; in { options.vim.lsp = { lsplines = { - enable = mkEnableOption "diagnostics using virtual lines on top of the real line of code. [lsp_lines]"; + enable = mkEnableOption '' + diagnostics using virtual lines on top of the real line of code. [lsp_lines] + ''; }; }; } diff --git a/modules/lsp/lspsaga/config.nix b/modules/lsp/lspsaga/config.nix index 722bdde9..ffacf124 100644 --- a/modules/lsp/lspsaga/config.nix +++ b/modules/lsp/lspsaga/config.nix @@ -3,7 +3,10 @@ lib, ... }: let - inherit (lib) addDescriptionsToMappings mkIf mkSetLuaBinding mkMerge nvim optionalString; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.strings) optionalString; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding; cfg = config.vim.lsp; self = import ./lspsaga.nix {inherit lib;}; @@ -12,38 +15,39 @@ mappings = addDescriptionsToMappings cfg.lspsaga.mappings mappingDefinitions; in { config = mkIf (cfg.enable && cfg.lspsaga.enable) { - vim.startPlugins = ["lspsaga"]; + vim = { + startPlugins = ["lspsaga"]; - vim.maps.visual = mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').range_code_action"; + maps = { + visual = mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').range_code_action"; + normal = mkMerge [ + (mkSetLuaBinding mappings.lspFinder "require('lspsaga.provider').lsp_finder") + (mkSetLuaBinding mappings.renderHoveredDoc "require('lspsaga.hover').render_hover_doc") - vim.maps.normal = mkMerge [ - (mkSetLuaBinding mappings.lspFinder "require('lspsaga.provider').lsp_finder") - (mkSetLuaBinding mappings.renderHoveredDoc "require('lspsaga.hover').render_hover_doc") + (mkSetLuaBinding mappings.smartScrollUp "function() require('lspsaga.action').smart_scroll_with_saga(-1) end") + (mkSetLuaBinding mappings.smartScrollDown "function() require('lspsaga.action').smart_scroll_with_saga(1) end") - (mkSetLuaBinding mappings.smartScrollUp "function() require('lspsaga.action').smart_scroll_with_saga(-1) end") - (mkSetLuaBinding mappings.smartScrollDown "function() require('lspsaga.action').smart_scroll_with_saga(1) end") + (mkSetLuaBinding mappings.rename "require('lspsaga.rename').rename") + (mkSetLuaBinding mappings.previewDefinition "require('lspsaga.provider').preview_definition") - (mkSetLuaBinding mappings.rename "require('lspsaga.rename').rename") - (mkSetLuaBinding mappings.previewDefinition "require('lspsaga.provider').preview_definition") + (mkSetLuaBinding mappings.showLineDiagnostics "require('lspsaga.diagnostic').show_line_diagnostics") + (mkSetLuaBinding mappings.showCursorDiagnostics "require('lspsaga.diagnostic').show_cursor_diagnostics") - (mkSetLuaBinding mappings.showLineDiagnostics "require('lspsaga.diagnostic').show_line_diagnostics") - (mkSetLuaBinding mappings.showCursorDiagnostics "require('lspsaga.diagnostic').show_cursor_diagnostics") + (mkSetLuaBinding mappings.nextDiagnostic "require('lspsaga.diagnostic').navigate('next')") + (mkSetLuaBinding mappings.previousDiagnostic "require('lspsaga.diagnostic').navigate('prev')") - (mkSetLuaBinding mappings.nextDiagnostic "require('lspsaga.diagnostic').navigate('next')") - (mkSetLuaBinding mappings.previousDiagnostic "require('lspsaga.diagnostic').navigate('prev')") + (mkIf (!cfg.nvimCodeActionMenu.enable) (mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action")) + (mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help")) + ]; + }; - (mkIf (!cfg.nvimCodeActionMenu.enable) (mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action")) - (mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help")) - ]; - - vim.luaConfigRC.lspsage = nvim.dag.entryAnywhere '' - -- Enable lspsaga - local saga = require 'lspsaga' - saga.init_lsp_saga({ - ${optionalString (config.vim.ui.borders.plugins.lspsaga.enable) '' - border_style = '${config.vim.ui.borders.plugins.lspsaga.style}', - ''} - }) - ''; + luaConfigRC.lspsaga = entryAnywhere '' + require('lspsaga').init_lsp_saga({ + ${optionalString config.vim.ui.borders.plugins.lspsaga.enable '' + border_style = '${config.vim.ui.borders.plugins.lspsaga.style}', + ''} + }) + ''; + }; }; } diff --git a/modules/lsp/lspsaga/default.nix b/modules/lsp/lspsaga/default.nix index 29cf5807..82c2ed77 100644 --- a/modules/lsp/lspsaga/default.nix +++ b/modules/lsp/lspsaga/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./lspsaga.nix ./config.nix diff --git a/modules/lsp/lspsaga/lspsaga.nix b/modules/lsp/lspsaga/lspsaga.nix index 35e1ecc7..f308aaaa 100644 --- a/modules/lsp/lspsaga/lspsaga.nix +++ b/modules/lsp/lspsaga/lspsaga.nix @@ -1,5 +1,6 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkMappingOption; + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; in { options.vim.lsp.lspsaga = { enable = mkEnableOption "LSP Saga"; diff --git a/modules/lsp/module.nix b/modules/lsp/module.nix index 1a562400..b16f9c13 100644 --- a/modules/lsp/module.nix +++ b/modules/lsp/module.nix @@ -1,5 +1,6 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkMappingOption; + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; in { options.vim.lsp = { enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options"; diff --git a/modules/lsp/null-ls/config.nix b/modules/lsp/null-ls/config.nix index 23a68187..83dada5b 100644 --- a/modules/lsp/null-ls/config.nix +++ b/modules/lsp/null-ls/config.nix @@ -1,37 +1,41 @@ { - pkgs, config, lib, ... }: let - inherit (lib) mkIf mkMerge nvim mapAttrs; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.attrsets) mapAttrs; + inherit (lib.nvim.dag) entryAnywhere entryAfter entryBetween; cfg = config.vim.lsp; in { config = mkIf cfg.null-ls.enable (mkMerge [ { - vim.lsp.enable = true; - vim.startPlugins = ["none-ls"]; + vim = { + lsp.enable = true; + startPlugins = ["none-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({ - debug = false, - diagnostics_format = "[#{m}] #{s} (#{c})", - debounce = 250, - default_timeout = 5000, - sources = ls_sources, - on_attach=default_on_attach - }) - ''; + luaConfigRC.null_ls-setup = entryAnywhere '' + local null_ls = require("null-ls") + local null_helpers = require("null-ls.helpers") + local null_methods = require("null-ls.methods") + local ls_sources = {} + ''; + + luaConfigRC.null_ls = entryAfter ["null_ls-setup" "lsp-setup"] '' + require('null-ls').setup({ + debug = false, + 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; + vim.luaConfigRC = mapAttrs (_: v: (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 index 01e6e59b..d104e683 100644 --- a/modules/lsp/null-ls/default.nix +++ b/modules/lsp/null-ls/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./config.nix ./null-ls.nix diff --git a/modules/lsp/null-ls/null-ls.nix b/modules/lsp/null-ls/null-ls.nix index 3ffb0ca6..8c63df27 100644 --- a/modules/lsp/null-ls/null-ls.nix +++ b/modules/lsp/null-ls/null-ls.nix @@ -1,19 +1,13 @@ -{ - pkgs, - config, - lib, - ... -}: let - inherit (lib) mkEnableOption mkOption types; - - cfg = config.vim.lsp; +{lib, ...}: let + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) attrsOf str; in { options.vim.lsp.null-ls = { enable = mkEnableOption "null-ls, also enabled automatically"; sources = mkOption { description = "null-ls sources"; - type = with types; attrsOf str; + type = attrsOf str; default = {}; }; }; diff --git a/modules/lsp/nvim-code-action-menu/config.nix b/modules/lsp/nvim-code-action-menu/config.nix index 9f8f604a..e55fb4a9 100644 --- a/modules/lsp/nvim-code-action-menu/config.nix +++ b/modules/lsp/nvim-code-action-menu/config.nix @@ -3,32 +3,35 @@ lib, ... }: let - inherit (lib) addDescriptionsToMappings mkIf mkSetBinding nvim pushDownDefault; + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings pushDownDefault; cfg = config.vim.lsp; self = import ./nvim-code-action-menu.nix {inherit lib;}; - mappingDefinitions = self.options.vim.lsp.nvimCodeActionMenu.mappings; mappings = addDescriptionsToMappings cfg.nvimCodeActionMenu.mappings mappingDefinitions; in { config = mkIf (cfg.enable && cfg.nvimCodeActionMenu.enable) { - vim.startPlugins = ["nvim-code-action-menu"]; + vim = { + startPlugins = ["nvim-code-action-menu"]; - vim.maps.normal = mkSetBinding mappings.open ":CodeActionMenu"; + maps.normal = mkSetBinding mappings.open ":CodeActionMenu"; - vim.binds.whichKey.register = pushDownDefault { - "c" = "+CodeAction"; + binds.whichKey.register = pushDownDefault { + "c" = "+CodeAction"; + }; + + luaConfigRC.code-action-menu = entryAnywhere '' + -- border configuration + vim.g.code_action_menu_window_border = '${config.vim.ui.borders.plugins.code-action-menu.style}' + + -- show individual sections of the code action menu + ${lib.optionalString cfg.nvimCodeActionMenu.show.details "vim.g.code_action_menu_show_details = true"} + ${lib.optionalString cfg.nvimCodeActionMenu.show.diff "vim.g.code_action_menu_show_diff = true"} + ${lib.optionalString cfg.nvimCodeActionMenu.show.actionKind "vim.g.code_action_menu_show_action_kind = true"} + ''; }; - - vim.luaConfigRC.code-action-menu = nvim.dag.entryAnywhere '' - -- border configuration - vim.g.code_action_menu_window_border = '${config.vim.ui.borders.plugins.code-action-menu.style}' - - -- show individual sections of the code action menu - ${lib.optionalString (cfg.nvimCodeActionMenu.show.details) "vim.g.code_action_menu_show_details = true"} - ${lib.optionalString (cfg.nvimCodeActionMenu.show.diff) "vim.g.code_action_menu_show_diff = true"} - ${lib.optionalString (cfg.nvimCodeActionMenu.show.actionKind) "vim.g.code_action_menu_show_action_kind = true"} - ''; }; } diff --git a/modules/lsp/nvim-code-action-menu/default.nix b/modules/lsp/nvim-code-action-menu/default.nix index 665cf922..f94dd221 100644 --- a/modules/lsp/nvim-code-action-menu/default.nix +++ b/modules/lsp/nvim-code-action-menu/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./nvim-code-action-menu.nix ./config.nix diff --git a/modules/lsp/nvim-code-action-menu/nvim-code-action-menu.nix b/modules/lsp/nvim-code-action-menu/nvim-code-action-menu.nix index c04bedab..c303f7c7 100644 --- a/modules/lsp/nvim-code-action-menu/nvim-code-action-menu.nix +++ b/modules/lsp/nvim-code-action-menu/nvim-code-action-menu.nix @@ -1,5 +1,6 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkMappingOption; + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; in { options.vim.lsp = { nvimCodeActionMenu = { diff --git a/modules/lsp/nvim-docs-view/config.nix b/modules/lsp/nvim-docs-view/config.nix index d7dc837e..008eee87 100644 --- a/modules/lsp/nvim-docs-view/config.nix +++ b/modules/lsp/nvim-docs-view/config.nix @@ -3,8 +3,10 @@ lib, ... }: let - inherit (lib) mkIf nvim addDescriptionsToMappings mkSetBinding mkMerge; inherit (builtins) toString; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding; cfg = config.vim.lsp.nvim-docs-view; self = import ./nvim-docs-view.nix {inherit lib;}; @@ -17,7 +19,7 @@ in { lsp.enable = true; startPlugins = ["nvim-docs-view"]; - luaConfigRC.nvim-docs-view = nvim.dag.entryAnywhere '' + luaConfigRC.nvim-docs-view = entryAnywhere '' require("docs-view").setup { position = "${cfg.position}", width = ${toString cfg.width}, diff --git a/modules/lsp/nvim-docs-view/default.nix b/modules/lsp/nvim-docs-view/default.nix index 499ec39b..48716d01 100644 --- a/modules/lsp/nvim-docs-view/default.nix +++ b/modules/lsp/nvim-docs-view/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./config.nix ./nvim-docs-view.nix diff --git a/modules/lsp/nvim-docs-view/nvim-docs-view.nix b/modules/lsp/nvim-docs-view/nvim-docs-view.nix index 808613e4..6b59a271 100644 --- a/modules/lsp/nvim-docs-view/nvim-docs-view.nix +++ b/modules/lsp/nvim-docs-view/nvim-docs-view.nix @@ -1,11 +1,13 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkOption types mkMappingOption; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) enum int; + inherit (lib.nvim.binds) mkMappingOption; in { options.vim.lsp.nvim-docs-view = { enable = mkEnableOption "nvim-docs-view, for displaying lsp hover documentation in a side panel."; position = mkOption { - type = types.enum ["left" "right" "top" "bottom"]; + type = enum ["left" "right" "top" "bottom"]; default = "right"; description = '' Where to open the docs view panel @@ -13,7 +15,7 @@ in { }; height = mkOption { - type = types.int; + type = int; default = 10; description = '' Height of the docs view panel if the position is set to either top or bottom @@ -21,7 +23,7 @@ in { }; width = mkOption { - type = types.int; + type = int; default = 60; description = '' Width of the docs view panel if the position is set to either left or right @@ -29,12 +31,14 @@ in { }; updateMode = mkOption { - type = types.enum ["auto" "manual"]; + type = enum ["auto" "manual"]; default = "auto"; description = '' - Determines the mechanism used to update the docs view panel content. - - If auto, the content will update upon cursor move. - - If manual, the content will only update once :DocsViewUpdate is called + Determines the mechanism used to update the docs view panel content + + Possible values: + - auto: the content will update upon cursor move. + - manual: the content will only update once :DocsViewUpdate is called ''; }; diff --git a/modules/lsp/trouble/config.nix b/modules/lsp/trouble/config.nix index bb751c72..72fc1ecf 100644 --- a/modules/lsp/trouble/config.nix +++ b/modules/lsp/trouble/config.nix @@ -3,36 +3,39 @@ lib, ... }: let - inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetBinding nvim pushDownDefault; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding pushDownDefault; cfg = config.vim.lsp; self = import ./trouble.nix {inherit lib;}; - mappingDefinitions = self.options.vim.lsp.trouble.mappings; mappings = addDescriptionsToMappings cfg.trouble.mappings mappingDefinitions; in { config = mkIf (cfg.enable && cfg.trouble.enable) { - vim.startPlugins = ["trouble"]; + vim = { + startPlugins = ["trouble"]; - vim.maps.normal = mkMerge [ - (mkSetBinding mappings.toggle "TroubleToggle") - (mkSetBinding mappings.workspaceDiagnostics "TroubleToggle workspace_diagnostics") - (mkSetBinding mappings.documentDiagnostics "TroubleToggle document_diagnostics") - (mkSetBinding mappings.lspReferences "TroubleToggle lsp_references") - (mkSetBinding mappings.quickfix "TroubleToggle quickfix") - (mkSetBinding mappings.locList "TroubleToggle loclist") - ]; + maps.normal = mkMerge [ + (mkSetBinding mappings.toggle "TroubleToggle") + (mkSetBinding mappings.workspaceDiagnostics "TroubleToggle workspace_diagnostics") + (mkSetBinding mappings.documentDiagnostics "TroubleToggle document_diagnostics") + (mkSetBinding mappings.lspReferences "TroubleToggle lsp_references") + (mkSetBinding mappings.quickfix "TroubleToggle quickfix") + (mkSetBinding mappings.locList "TroubleToggle loclist") + ]; - vim.binds.whichKey.register = pushDownDefault { - "l" = "Trouble"; - "x" = "+Trouble"; - "lw" = "Workspace"; + binds.whichKey.register = pushDownDefault { + "l" = "Trouble"; + "x" = "+Trouble"; + "lw" = "Workspace"; + }; + + luaConfigRC.trouble = entryAnywhere '' + -- Enable trouble diagnostics viewer + require("trouble").setup {} + ''; }; - - vim.luaConfigRC.trouble = nvim.dag.entryAnywhere '' - -- Enable trouble diagnostics viewer - require("trouble").setup {} - ''; }; } diff --git a/modules/lsp/trouble/default.nix b/modules/lsp/trouble/default.nix index 3a5d2cbe..77e93376 100644 --- a/modules/lsp/trouble/default.nix +++ b/modules/lsp/trouble/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./trouble.nix ./config.nix diff --git a/modules/lsp/trouble/trouble.nix b/modules/lsp/trouble/trouble.nix index b8aa0de6..bd16c67e 100644 --- a/modules/lsp/trouble/trouble.nix +++ b/modules/lsp/trouble/trouble.nix @@ -1,5 +1,6 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkMappingOption; + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; in { options.vim.lsp = { trouble = { diff --git a/modules/minimap/codewindow/codewindow.nix b/modules/minimap/codewindow/codewindow.nix index 551dd8e7..381e3102 100644 --- a/modules/minimap/codewindow/codewindow.nix +++ b/modules/minimap/codewindow/codewindow.nix @@ -1,5 +1,6 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkMappingOption; + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; in { options.vim.minimap.codewindow = { enable = mkEnableOption "codewindow plugin for minimap view"; diff --git a/modules/minimap/codewindow/config.nix b/modules/minimap/codewindow/config.nix index b95aca84..11c38c94 100644 --- a/modules/minimap/codewindow/config.nix +++ b/modules/minimap/codewindow/config.nix @@ -3,7 +3,9 @@ lib, ... }: let - inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetLuaBinding nvim pushDownDefault; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding pushDownDefault; cfg = config.vim.minimap.codewindow; @@ -13,26 +15,28 @@ mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions; in { config = mkIf cfg.enable { - vim.startPlugins = [ - "codewindow-nvim" - ]; + vim = { + startPlugins = [ + "codewindow-nvim" + ]; - vim.maps.normal = mkMerge [ - (mkSetLuaBinding mappings.open "require('codewindow').open_minimap") - (mkSetLuaBinding mappings.close "require('codewindow').close_minimap") - (mkSetLuaBinding mappings.toggle "require('codewindow').toggle_minimap") - (mkSetLuaBinding mappings.toggleFocus "require('codewindow').toggle_focus") - ]; + maps.normal = mkMerge [ + (mkSetLuaBinding mappings.open "require('codewindow').open_minimap") + (mkSetLuaBinding mappings.close "require('codewindow').close_minimap") + (mkSetLuaBinding mappings.toggle "require('codewindow').toggle_minimap") + (mkSetLuaBinding mappings.toggleFocus "require('codewindow').toggle_focus") + ]; - vim.binds.whichKey.register = pushDownDefault { - "m" = "+Minimap"; + binds.whichKey.register = pushDownDefault { + "m" = "+Minimap"; + }; + + luaConfigRC.codewindow = entryAnywhere '' + local codewindow = require('codewindow') + codewindow.setup({ + exclude_filetypes = { 'NvimTree', 'orgagenda', 'Alpha'}, + }) + ''; }; - - vim.luaConfigRC.codewindow = nvim.dag.entryAnywhere '' - local codewindow = require('codewindow') - codewindow.setup({ - exclude_filetypes = { 'NvimTree', 'orgagenda', 'Alpha'}, - }) - ''; }; } diff --git a/modules/minimap/codewindow/default.nix b/modules/minimap/codewindow/default.nix index f3f8a9aa..0ce3ad2c 100644 --- a/modules/minimap/codewindow/default.nix +++ b/modules/minimap/codewindow/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./codewindow.nix ./config.nix diff --git a/modules/minimap/default.nix b/modules/minimap/default.nix index 6a03b011..7612ac1f 100644 --- a/modules/minimap/default.nix +++ b/modules/minimap/default.nix @@ -1,4 +1,4 @@ -{...}: { +{ imports = [ ./minimap-vim ./codewindow diff --git a/modules/minimap/minimap-vim/config.nix b/modules/minimap/minimap-vim/config.nix index 6577e8ce..5276a426 100644 --- a/modules/minimap/minimap-vim/config.nix +++ b/modules/minimap/minimap-vim/config.nix @@ -1,10 +1,11 @@ { - pkgs, config, + pkgs, lib, ... }: let - inherit (lib) mkIf pushDownDefault; + inherit (lib.modules) mkIf; + inherit (lib.nvim.binds) pushDownDefault; cfg = config.vim.minimap.minimap-vim; in { diff --git a/modules/minimap/minimap-vim/default.nix b/modules/minimap/minimap-vim/default.nix index 889184ea..bf3aa553 100644 --- a/modules/minimap/minimap-vim/default.nix +++ b/modules/minimap/minimap-vim/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./minimap-vim.nix ./config.nix diff --git a/modules/minimap/minimap-vim/minimap-vim.nix b/modules/minimap/minimap-vim/minimap-vim.nix index 12f7f424..e8f9270c 100644 --- a/modules/minimap/minimap-vim/minimap-vim.nix +++ b/modules/minimap/minimap-vim/minimap-vim.nix @@ -1,11 +1,7 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkEnableOption; +{lib, ...}: let + inherit (lib.options) mkEnableOption; in { options.vim.minimap.minimap-vim = { - enable = mkEnableOption "minimap-vim plugin for minimap view"; + enable = mkEnableOption "minimap view [minimap-vim]"; }; } diff --git a/modules/notes/default.nix b/modules/notes/default.nix index eaf247fc..88a70924 100644 --- a/modules/notes/default.nix +++ b/modules/notes/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./obsidian ./orgmode diff --git a/modules/notes/mind-nvim/config.nix b/modules/notes/mind-nvim/config.nix index 8a609b04..7f7ea9db 100644 --- a/modules/notes/mind-nvim/config.nix +++ b/modules/notes/mind-nvim/config.nix @@ -3,27 +3,31 @@ lib, ... }: let - inherit (lib) mkIf nvim pushDownDefault; + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.binds) pushDownDefault; cfg = config.vim.notes.mind-nvim; in { - config = mkIf (cfg.enable) { - vim.startPlugins = [ - "mind-nvim" - ]; + config = mkIf cfg.enable { + vim = { + startPlugins = [ + "mind-nvim" + ]; - vim.maps.normal = { - "om" = {action = ":MindOpenMain";}; - "op" = {action = ":MindOpenProject";}; - "oc" = {action = ":MindClose";}; + maps.normal = { + "om" = {action = ":MindOpenMain";}; + "op" = {action = ":MindOpenProject";}; + "oc" = {action = ":MindClose";}; + }; + + binds.whichKey.register = pushDownDefault { + "o" = "+Notes"; + }; + + luaConfigRC.mind-nvim = entryAnywhere '' + require'mind'.setup() + ''; }; - - vim.binds.whichKey.register = pushDownDefault { - "o" = "+Notes"; - }; - - vim.luaConfigRC.mind-nvim = nvim.dag.entryAnywhere '' - require'mind'.setup() - ''; }; } diff --git a/modules/notes/mind-nvim/default.nix b/modules/notes/mind-nvim/default.nix index e136b9d0..be25fffe 100644 --- a/modules/notes/mind-nvim/default.nix +++ b/modules/notes/mind-nvim/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./mind-nvim.nix ./config.nix diff --git a/modules/notes/mind-nvim/mind-nvim.nix b/modules/notes/mind-nvim/mind-nvim.nix index f0d43ea0..ad1a395c 100644 --- a/modules/notes/mind-nvim/mind-nvim.nix +++ b/modules/notes/mind-nvim/mind-nvim.nix @@ -1,11 +1,7 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkEnableOption; +{lib, ...}: let + inherit (lib.options) mkEnableOption; in { options.vim.notes.mind-nvim = { - enable = mkEnableOption "organizer tool for Neovim."; + enable = mkEnableOption "note organizer tool for Neovim [mind-nvim]"; }; } diff --git a/modules/notes/obsidian/config.nix b/modules/notes/obsidian/config.nix index f521c620..818d447c 100644 --- a/modules/notes/obsidian/config.nix +++ b/modules/notes/obsidian/config.nix @@ -3,45 +3,49 @@ lib, ... }: let - inherit (lib) mkIf nvim pushDownDefault; + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.binds) pushDownDefault; cfg = config.vim.notes.obsidian; auto = config.vim.autocomplete; in { - config = mkIf (cfg.enable) { - vim.startPlugins = [ - "obsidian-nvim" - "vim-markdown" - "tabular" - ]; + config = mkIf cfg.enable { + vim = { + startPlugins = [ + "obsidian-nvim" + "vim-markdown" + "tabular" + ]; - vim.binds.whichKey.register = pushDownDefault { - "o" = "+Notes"; - }; + binds.whichKey.register = pushDownDefault { + "o" = "+Notes"; + }; - vim.luaConfigRC.obsidian = nvim.dag.entryAnywhere '' - require("obsidian").setup({ - dir = "${cfg.dir}", - completion = { - nvim_cmp = ${ - if (auto.type == "nvim-cmp") - then "true" - else "false" - } - }, - daily_notes = { - folder = ${ - if (cfg.daily-notes.folder == "") - then "nil," - else "'${cfg.daily-notes.folder}'," - } - date_format = ${ - if (cfg.daily-notes.date-format == "") - then "nil," - else "'${cfg.daily-notes.date-format}'," - } + luaConfigRC.obsidian = entryAnywhere '' + require("obsidian").setup({ + dir = "${cfg.dir}", + completion = { + nvim_cmp = ${ + if (auto.type == "nvim-cmp") + then "true" + else "false" } - }) - ''; + }, + daily_notes = { + folder = ${ + if (cfg.daily-notes.folder == "") + then "nil," + else "'${cfg.daily-notes.folder}'," + } + date_format = ${ + if (cfg.daily-notes.date-format == "") + then "nil," + else "'${cfg.daily-notes.date-format}'," + } + } + }) + ''; + }; }; } diff --git a/modules/notes/obsidian/default.nix b/modules/notes/obsidian/default.nix index d73bfc2a..db8c6751 100644 --- a/modules/notes/obsidian/default.nix +++ b/modules/notes/obsidian/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./obsidian.nix ./config.nix diff --git a/modules/notes/obsidian/obsidian.nix b/modules/notes/obsidian/obsidian.nix index cfc0eda5..1b7bae6d 100644 --- a/modules/notes/obsidian/obsidian.nix +++ b/modules/notes/obsidian/obsidian.nix @@ -1,27 +1,24 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkEnableOption mkOption types; +{lib, ...}: let + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) str bool; in { options.vim.notes = { obsidian = { enable = mkEnableOption "complementary neovim plugins for Obsidian editor"; dir = mkOption { - type = types.str; + type = str; default = "~/my-vault"; description = "Obsidian vault directory"; }; daily-notes = { folder = mkOption { - type = types.str; + type = str; default = ""; description = "Directory in which daily notes should be created"; }; date-format = mkOption { - type = types.str; + type = str; default = ""; description = "Date format used for creating daily notes"; }; @@ -29,8 +26,7 @@ in { completion = { nvim_cmp = mkOption { - # if using nvim-cmp, otherwise set to false - type = types.bool; + type = bool; description = "If using nvim-cmp, otherwise set to false"; }; }; diff --git a/modules/notes/orgmode/config.nix b/modules/notes/orgmode/config.nix index 08df2de0..635f0f15 100644 --- a/modules/notes/orgmode/config.nix +++ b/modules/notes/orgmode/config.nix @@ -3,42 +3,46 @@ lib, ... }: let - inherit (lib) mkIf mkMerge nvim pushDownDefault; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.binds) pushDownDefault; cfg = config.vim.notes.orgmode; in { config = mkIf cfg.enable (mkMerge [ { - vim.startPlugins = [ - "orgmode-nvim" - ]; + vim = { + startPlugins = [ + "orgmode-nvim" + ]; - vim.binds.whichKey.register = pushDownDefault { - "o" = "+Notes"; + binds.whichKey.register = pushDownDefault { + "o" = "+Notes"; + }; + + luaConfigRC.orgmode = entryAnywhere '' + -- Load custom treesitter grammar for org filetype + require('orgmode').setup_ts_grammar() + + -- Treesitter configuration + require('nvim-treesitter.configs').setup { + + -- If TS highlights are not enabled at all, or disabled via `disable` prop, + -- highlighting will fallback to default Vim syntax highlighting + highlight = { + enable = true, + -- Required for spellcheck, some LaTex highlights and + -- code block highlights that do not have ts grammar + additional_vim_regex_highlighting = {'org'}, + }, + } + + require('orgmode').setup({ + org_agenda_files = ${cfg.orgAgendaFiles}, + org_default_notes_file = '${cfg.orgDefaultNotesFile}', + }) + ''; }; - - vim.luaConfigRC.orgmode = nvim.dag.entryAnywhere '' - -- Load custom treesitter grammar for org filetype - require('orgmode').setup_ts_grammar() - - -- Treesitter configuration - require('nvim-treesitter.configs').setup { - - -- If TS highlights are not enabled at all, or disabled via `disable` prop, - -- highlighting will fallback to default Vim syntax highlighting - highlight = { - enable = true, - -- Required for spellcheck, some LaTex highlights and - -- code block highlights that do not have ts grammar - additional_vim_regex_highlighting = {'org'}, - }, - } - - require('orgmode').setup({ - org_agenda_files = ${cfg.orgAgendaFiles}, - org_default_notes_file = '${cfg.orgDefaultNotesFile}', - }) - ''; } (mkIf cfg.treesitter.enable { diff --git a/modules/notes/orgmode/default.nix b/modules/notes/orgmode/default.nix index 299c7543..c4f5a1a8 100644 --- a/modules/notes/orgmode/default.nix +++ b/modules/notes/orgmode/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./orgmode.nix ./config.nix diff --git a/modules/notes/orgmode/orgmode.nix b/modules/notes/orgmode/orgmode.nix index d7fce126..2a066052 100644 --- a/modules/notes/orgmode/orgmode.nix +++ b/modules/notes/orgmode/orgmode.nix @@ -4,27 +4,28 @@ pkgs, ... }: let - inherit (lib) mkEnableOption types mkOption nvim; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) str; + inherit (lib.nvim.types) mkGrammarOption; in { options.vim.notes.orgmode = { enable = mkEnableOption "nvim-orgmode: Neovim plugin for Emac Orgmode. Get the best of both worlds"; orgAgendaFiles = mkOption { - type = types.str; + type = str; default = "{'~/Documents/org/*', '~/my-orgs/**/*'}"; description = "List of org files to be used as agenda files."; }; orgDefaultNotesFile = mkOption { - type = types.str; + type = str; default = "~/Documents/org/refile.org"; description = "Default org file to be used for notes."; }; treesitter = { enable = mkEnableOption "Orgmode treesitter" // {default = config.vim.languages.enableTreesitter;}; - - orgPackage = nvim.types.mkGrammarOption pkgs "org"; + orgPackage = mkGrammarOption pkgs "org"; }; }; } diff --git a/modules/notes/todo-comments/config.nix b/modules/notes/todo-comments/config.nix index f1ced600..8db653fb 100644 --- a/modules/notes/todo-comments/config.nix +++ b/modules/notes/todo-comments/config.nix @@ -4,46 +4,49 @@ lib, ... }: let - inherit (lib) mkMerge mkBinding mkIf; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.binds) mkBinding; cfg = config.vim.notes.todo-comments; self = import ./todo-comments.nix {inherit lib;}; - mappings = self.options.vim.notes.todo-comments.mappings; + inherit (self.options.vim.notes.todo-comments) mappings; in { - config = mkIf (cfg.enable) { - vim.startPlugins = [ - "todo-comments" - ]; + config = mkIf cfg.enable { + vim = { + startPlugins = [ + "todo-comments" + ]; - vim.maps.normal = mkMerge [ - (mkBinding cfg.mappings.quickFix ":TodoQuickFix" mappings.quickFix.description) - (mkIf config.vim.telescope.enable (mkBinding cfg.mappings.telescope ":TodoTelescope" mappings.telescope.description)) - (mkIf config.vim.lsp.trouble.enable (mkBinding cfg.mappings.trouble ":TodoTrouble" mappings.trouble.description)) - ]; + maps.normal = mkMerge [ + (mkBinding cfg.mappings.quickFix ":TodoQuickFix" mappings.quickFix.description) + (mkIf config.vim.telescope.enable (mkBinding cfg.mappings.telescope ":TodoTelescope" mappings.telescope.description)) + (mkIf config.vim.lsp.trouble.enable (mkBinding cfg.mappings.trouble ":TodoTrouble" mappings.trouble.description)) + ]; - vim.luaConfigRC.todo-comments = '' - require('todo-comments').setup { - highlight = { - before = "", -- "fg" or "bg" or empty - keyword = "bg", -- "fg", "bg", "wide" or empty - after = "fg", -- "fg" or "bg" or empty - pattern = ${cfg.patterns.highlight}, - comments_only = true, -- uses treesitter to match keywords in comments only - max_line_len = 400, -- ignore lines longer than this - exclude = {}, -- list of file types to exclude highlighting - }, - search = { - command = "${pkgs.ripgrep}/bin/rg", - args = { - "--color=never", - "--no-heading", - "--with-filename", - "--line-number", - "--column", + luaConfigRC.todo-comments = '' + require('todo-comments').setup { + highlight = { + before = "", -- "fg" or "bg" or empty + keyword = "bg", -- "fg", "bg", "wide" or empty + after = "fg", -- "fg" or "bg" or empty + pattern = ${cfg.patterns.highlight}, + comments_only = true, -- uses treesitter to match keywords in comments only + max_line_len = 400, -- ignore lines longer than this + exclude = {}, -- list of file types to exclude highlighting }, - pattern = ${cfg.patterns.search}, - }, - } - ''; + search = { + command = "${pkgs.ripgrep}/bin/rg", + args = { + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + }, + pattern = ${cfg.patterns.search}, + }, + } + ''; + }; }; } diff --git a/modules/notes/todo-comments/default.nix b/modules/notes/todo-comments/default.nix index ac730fe6..6030067a 100644 --- a/modules/notes/todo-comments/default.nix +++ b/modules/notes/todo-comments/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./todo-comments.nix ./config.nix diff --git a/modules/notes/todo-comments/todo-comments.nix b/modules/notes/todo-comments/todo-comments.nix index 6fbc71ba..ca4e4be1 100644 --- a/modules/notes/todo-comments/todo-comments.nix +++ b/modules/notes/todo-comments/todo-comments.nix @@ -1,18 +1,20 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkOption types mkMappingOption; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) str; + inherit (lib.nvim.binds) mkMappingOption; in { options.vim.notes.todo-comments = { enable = mkEnableOption "todo-comments: highlight and search for todo comments like TODO, HACK, BUG in your code base"; patterns = { highlight = mkOption { - type = types.str; + type = str; default = ''[[.*<(KEYWORDS)(\([^\)]*\))?:]]''; description = "vim regex pattern used for highlighting comments"; }; search = mkOption { - type = types.str; + type = str; default = ''[[\b(KEYWORDS)(\([^\)]*\))?:]]''; description = "ripgrep regex pattern used for searching comments"; }; diff --git a/modules/projects/default.nix b/modules/projects/default.nix index aa04d039..6b6c1127 100644 --- a/modules/projects/default.nix +++ b/modules/projects/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./project-nvim ]; diff --git a/modules/projects/project-nvim/config.nix b/modules/projects/project-nvim/config.nix index 6fc78e41..5c036ef8 100644 --- a/modules/projects/project-nvim/config.nix +++ b/modules/projects/project-nvim/config.nix @@ -3,7 +3,10 @@ lib, ... }: let - inherit (lib) mkIf nvim boolToString concatStringsSep; + inherit (lib.modules) mkIf; + inherit (lib.trivial) boolToString; + inherit (lib.strings) concatStringsSep; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.projects.project-nvim; in { @@ -12,7 +15,7 @@ in { "project-nvim" ]; - vim.luaConfigRC.project-nvim = nvim.dag.entryAnywhere '' + vim.luaConfigRC.project-nvim = entryAnywhere '' require('project_nvim').setup({ manual_mode = ${boolToString cfg.manualMode}, detection_methods = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.detectionMethods)} }, diff --git a/modules/projects/project-nvim/default.nix b/modules/projects/project-nvim/default.nix index db404ae0..1e7b91a3 100644 --- a/modules/projects/project-nvim/default.nix +++ b/modules/projects/project-nvim/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./config.nix ./project-nvim.nix diff --git a/modules/projects/project-nvim/project-nvim.nix b/modules/projects/project-nvim/project-nvim.nix index 5811f96e..9331f371 100644 --- a/modules/projects/project-nvim/project-nvim.nix +++ b/modules/projects/project-nvim/project-nvim.nix @@ -1,60 +1,57 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkEnableOption mkOption types; +{lib, ...}: let + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) enum bool listOf str; in { options.vim.projects.project-nvim = { enable = mkEnableOption "project-nvim for project management"; manualMode = mkOption { - type = types.bool; + type = bool; default = true; description = "don't automatically change the root directory so the user has the option to manually do so using `:ProjectRoot` command"; }; # detection methods should accept one or more strings from a list detectionMethods = mkOption { - type = types.listOf types.str; + type = listOf str; default = ["lsp" "pattern"]; description = "Detection methods to use"; }; # patterns patterns = mkOption { - type = types.listOf types.str; + type = listOf str; default = [".git" "_darcs" ".hg" ".bzr" ".svn" "Makefile" "package.json" "flake.nix" "cargo.toml"]; description = "Patterns to use for pattern detection method"; }; # table of lsp servers to ignore by name lspIgnored = mkOption { - type = types.listOf types.str; + type = listOf str; default = []; description = "LSP servers no ignore by name"; }; excludeDirs = mkOption { - type = types.listOf types.str; + type = listOf str; default = []; description = "Directories to exclude from project root search"; }; showHidden = mkOption { - type = types.bool; + type = bool; default = false; description = "Show hidden files in telescope picker"; }; silentChdir = mkOption { - type = types.bool; + type = bool; default = true; description = "Silently change directory when changing project"; }; scopeChdir = mkOption { - type = types.enum ["global" "tab" "win"]; + type = enum ["global" "tab" "win"]; default = "global"; description = "What scope to change the directory"; }; diff --git a/modules/rich-presence/neocord/config.nix b/modules/rich-presence/neocord/config.nix index 0ff38903..3856db18 100644 --- a/modules/rich-presence/neocord/config.nix +++ b/modules/rich-presence/neocord/config.nix @@ -3,17 +3,19 @@ lib, ... }: let - inherit (lib) mkIf nvim boolToString; - inherit (lib.nvim.lua) listToLuaTable; - inherit (lib.strings) escapeNixString; inherit (builtins) toString; + inherit (lib.modules) mkIf; + inherit (lib.trivial) boolToString; + inherit (lib.strings) escapeNixString; + inherit (lib.nvim.lua) listToLuaTable; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.presence.neocord; in { config = mkIf cfg.enable { vim.startPlugins = ["neocord"]; - vim.luaConfigRC.neocord = nvim.dag.entryAnywhere '' + vim.luaConfigRC.neocord = entryAnywhere '' -- Description of each option can be found in https://github.com/IogaMaster/neocord#lua require("neocord").setup({ -- General options diff --git a/modules/rich-presence/neocord/neocord.nix b/modules/rich-presence/neocord/neocord.nix index 514c7ffd..c962d2dc 100644 --- a/modules/rich-presence/neocord/neocord.nix +++ b/modules/rich-presence/neocord/neocord.nix @@ -1,5 +1,7 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkOption types literalExpression mkRemovedOptionModule; + inherit (lib.modules) mkRemovedOptionModule; + inherit (lib.options) mkEnableOption mkOption literalExpression; + inherit (lib.types) bool int str enum nullOr listOf; in { imports = [ (mkRemovedOptionModule ["vim" "presence" "presence-nvim"] '' @@ -14,7 +16,7 @@ in { enable = mkEnableOption "neocord plugin for discord rich presence"; logo = mkOption { - type = types.str; # TODO: can the default be documented better, maybe with an enum? + type = str; # TODO: can the default be documented better, maybe with an enum? default = "auto"; description = '' Logo to be displayed on the RPC item @@ -24,55 +26,55 @@ in { }; logo_tooltip = mkOption { - type = types.str; + type = str; default = "The One True Text Editor"; description = "Text displayed when hovering over the Neovim image"; }; main_image = mkOption { - type = types.enum ["language" "logo"]; + type = enum ["language" "logo"]; default = "language"; description = "Main image to be displayed"; }; client_id = mkOption { - type = types.str; + type = str; default = "1157438221865717891"; description = "Client ID of the application"; }; log_level = mkOption { - type = with types; nullOr (enum ["debug" "info" "warn" "error"]); + type = nullOr (enum ["debug" "info" "warn" "error"]); default = null; description = "Log level to be used by the plugin"; }; debounce_timeout = mkOption { - type = types.int; + type = int; default = 10; description = "Number of seconds to debounce events"; }; auto_update = mkOption { - type = types.bool; + type = bool; default = true; description = "Automatically update the presence"; }; enable_line_number = mkOption { - type = types.bool; + type = bool; default = false; description = "Show line number on the RPC item"; }; show_time = mkOption { - type = types.bool; + type = bool; default = true; description = "Show time on the RPC item"; }; blacklist = mkOption { - type = with types; listOf str; + type = listOf str; default = []; example = literalExpression ''["Alpha"]''; description = "List of filetypes to ignore"; @@ -80,49 +82,49 @@ in { rich_presence = { editing_text = mkOption { - type = types.str; + type = str; default = "Editing %s"; description = "Text displayed when editing a file"; }; file_explorer_text = mkOption { - type = types.str; + type = str; default = "Browsing %s"; description = "Text displayed when browsing files"; }; git_commit_text = mkOption { - type = types.str; + type = str; default = "Committing changes"; description = "Text displayed when committing changes"; }; plugin_manager_text = mkOption { - type = types.str; + type = str; default = "Managing plugins"; description = "Text displayed when managing plugins"; }; reading_text = mkOption { - type = types.str; + type = str; default = "Reading %s"; description = "Text displayed when reading a file"; }; workspace_text = mkOption { - type = types.str; + type = str; default = "Working on %s"; description = "Text displayed when working on a project"; }; line_number_text = mkOption { - type = types.str; + type = str; default = "Line %s out of %s"; description = "Text displayed when showing line number"; }; terminal_text = mkOption { - type = types.str; + type = str; default = "Working on the terminal"; description = "Text displayed when working on the terminal"; }; diff --git a/modules/session/default.nix b/modules/session/default.nix index b984f72d..54e7ef94 100644 --- a/modules/session/default.nix +++ b/modules/session/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./nvim-session-manager ]; diff --git a/modules/session/nvim-session-manager/config.nix b/modules/session/nvim-session-manager/config.nix index 70ed26bd..91072f1c 100644 --- a/modules/session/nvim-session-manager/config.nix +++ b/modules/session/nvim-session-manager/config.nix @@ -3,51 +3,58 @@ lib, ... }: let - inherit (lib) mkIf optionals mkMerge mkBinding nvim concatStringsSep boolToString; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) optionals; + inherit (lib.strings) concatStringsSep; + inherit (lib.trivial) boolToString; + inherit (lib.nvim.binds) mkBinding; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.session.nvim-session-manager; in { config = mkIf cfg.enable { - vim.startPlugins = - [ - "nvim-session-manager" - "plenary-nvim" - ] - ++ optionals (cfg.usePicker) ["dressing-nvim"]; + vim = { + startPlugins = + [ + "nvim-session-manager" + "plenary-nvim" + ] + ++ optionals (cfg.usePicker) ["dressing-nvim"]; - vim.maps.normal = mkMerge [ - (mkBinding cfg.mappings.loadSession ":SessionManager load_session" "Load session") - (mkBinding cfg.mappings.deleteSession ":SessionManager delete_session" "Delete session") - (mkBinding cfg.mappings.saveCurrentSession ":SessionManager save_current_session" "Save current session") - (mkBinding cfg.mappings.loadLastSession ":SessionManager load_last_session" "Load last session") - # TODO: load_current_dir_session - ]; + maps.normal = mkMerge [ + (mkBinding cfg.mappings.loadSession ":SessionManager load_session" "Load session") + (mkBinding cfg.mappings.deleteSession ":SessionManager delete_session" "Delete session") + (mkBinding cfg.mappings.saveCurrentSession ":SessionManager save_current_session" "Save current session") + (mkBinding cfg.mappings.loadLastSession ":SessionManager load_last_session" "Load last session") + # TODO: load_current_dir_session + ]; - vim.luaConfigRC.nvim-session-manager = nvim.dag.entryAnywhere '' - local Path = require('plenary.path') - local sm = require('session_manager.config') - require('session_manager').setup({ - sessions_dir = Path:new(vim.fn.stdpath('data'), 'sessions'), + luaConfigRC.nvim-session-manager = entryAnywhere '' + local Path = require('plenary.path') + local sm = require('session_manager.config') + require('session_manager').setup({ + sessions_dir = Path:new(vim.fn.stdpath('data'), 'sessions'), - path_replacer = '${toString cfg.pathReplacer}', + path_replacer = '${toString cfg.pathReplacer}', - colon_replacer = '${toString cfg.colonReplacer}', + colon_replacer = '${toString cfg.colonReplacer}', - autoload_mode = sm.AutoloadMode.${toString cfg.autoloadMode}, + autoload_mode = sm.AutoloadMode.${toString cfg.autoloadMode}, - autosave_last_session = ${boolToString cfg.autoSave.lastSession}, + autosave_last_session = ${boolToString cfg.autoSave.lastSession}, - autosave_ignore_not_normal = ${boolToString cfg.autoSave.ignoreNotNormal}, + autosave_ignore_not_normal = ${boolToString cfg.autoSave.ignoreNotNormal}, - autosave_ignore_dirs = {${concatStringsSep ", " (map (x: "\'" + x + "\'") cfg.autoSave.ignoreDirs)}}, + autosave_ignore_dirs = {${concatStringsSep ", " (map (x: "\'" + x + "\'") cfg.autoSave.ignoreDirs)}}, - autosave_ignore_filetypes = {${concatStringsSep ", " (map (x: "\'" + x + "\'") cfg.autoSave.ignoreFiletypes)}}, + autosave_ignore_filetypes = {${concatStringsSep ", " (map (x: "\'" + x + "\'") cfg.autoSave.ignoreFiletypes)}}, - autosave_ignore_buftypes = {${concatStringsSep ", " (map (x: "\'" + x + "\'") cfg.autoSave.ignoreBufTypes)}}, + autosave_ignore_buftypes = {${concatStringsSep ", " (map (x: "\'" + x + "\'") cfg.autoSave.ignoreBufTypes)}}, - autosave_only_in_session = ${boolToString cfg.autoSave.onlyInSession}, - max_path_length = ${toString cfg.maxPathLength}, - }) - ''; + autosave_only_in_session = ${boolToString cfg.autoSave.onlyInSession}, + max_path_length = ${toString cfg.maxPathLength}, + }) + ''; + }; }; } diff --git a/modules/session/nvim-session-manager/default.nix b/modules/session/nvim-session-manager/default.nix index 607c453c..2a990590 100644 --- a/modules/session/nvim-session-manager/default.nix +++ b/modules/session/nvim-session-manager/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./nvim-session-manager.nix ./config.nix diff --git a/modules/session/nvim-session-manager/nvim-session-manager.nix b/modules/session/nvim-session-manager/nvim-session-manager.nix index a5395a01..2182db38 100644 --- a/modules/session/nvim-session-manager/nvim-session-manager.nix +++ b/modules/session/nvim-session-manager/nvim-session-manager.nix @@ -1,99 +1,99 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkEnableOption mkOption types; +{lib, ...}: let + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) nullOr str bool int listOf enum; in { options.vim.session.nvim-session-manager = { enable = mkEnableOption "nvim-session-manager: manage sessions like folders in VSCode"; mappings = { loadSession = mkOption { - type = types.nullOr types.str; + type = nullOr str; description = "Load session"; default = "sl"; }; + deleteSession = mkOption { - type = types.nullOr types.str; + type = nullOr str; description = "Delete session"; default = "sd"; }; + saveCurrentSession = mkOption { - type = types.nullOr types.str; + type = nullOr str; description = "Save current session"; default = "sc"; }; + loadLastSession = mkOption { - type = types.nullOr types.str; + type = nullOr str; description = "Load last session"; default = "slt"; }; }; usePicker = mkOption { - type = types.bool; + type = bool; default = true; description = "Whether or not we should use dressing.nvim to build a session picker UI"; }; pathReplacer = mkOption { - type = types.str; + type = str; default = "__"; description = "The character to which the path separator will be replaced for session files"; }; colonReplacer = mkOption { - type = types.str; + type = str; default = "++"; description = "The character to which the colon symbol will be replaced for session files"; }; autoloadMode = mkOption { - type = types.enum ["Disabled" "CurrentDir" "LastSession"]; + type = enum ["Disabled" "CurrentDir" "LastSession"]; default = "LastSession"; description = "Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession"; }; maxPathLength = mkOption { - type = types.nullOr types.int; + type = nullOr int; default = 80; description = "Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all"; }; autoSave = { lastSession = mkOption { - type = types.bool; + type = bool; default = true; description = "Automatically save last session on exit and on session switch"; }; ignoreNotNormal = mkOption { - type = types.bool; + type = bool; default = true; description = "Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed"; }; ignoreDirs = mkOption { - type = types.listOf types.str; + type = listOf str; default = []; description = "A list of directories where the session will not be autosaved"; }; ignoreFiletypes = mkOption { - type = types.listOf types.str; + type = listOf str; default = ["gitcommit"]; description = "All buffers of these file types will be closed before the session is saved"; }; ignoreBufTypes = mkOption { - type = types.listOf types.str; + type = listOf str; default = []; description = "All buffers of these bufer types will be closed before the session is saved"; }; onlyInSession = mkOption { - type = types.bool; + type = bool; default = false; description = "Always autosaves session. If true, only autosaves after a session is active"; }; diff --git a/modules/snippets/default.nix b/modules/snippets/default.nix index cde3f7c5..3f9758a1 100644 --- a/modules/snippets/default.nix +++ b/modules/snippets/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./vsnip ]; diff --git a/modules/snippets/vsnip/config.nix b/modules/snippets/vsnip/config.nix index fd4bf503..5c6ba75f 100644 --- a/modules/snippets/vsnip/config.nix +++ b/modules/snippets/vsnip/config.nix @@ -3,7 +3,7 @@ lib, ... }: let - inherit (lib) mkIf; + inherit (lib.modules) mkIf; cfg = config.vim.snippets.vsnip; in { diff --git a/modules/snippets/vsnip/default.nix b/modules/snippets/vsnip/default.nix index fee36eba..87ef29e0 100644 --- a/modules/snippets/vsnip/default.nix +++ b/modules/snippets/vsnip/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./vsnip.nix ]; diff --git a/modules/snippets/vsnip/vsnip.nix b/modules/snippets/vsnip/vsnip.nix index 2d423cb5..5d3b6d97 100644 --- a/modules/snippets/vsnip/vsnip.nix +++ b/modules/snippets/vsnip/vsnip.nix @@ -1,5 +1,5 @@ {lib, ...}: let - inherit (lib) mkEnableOption; + inherit (lib.options) mkEnableOption; in { options.vim.snippets.vsnip = { enable = mkEnableOption "vim-vsnip: snippet LSP/VSCode's format"; diff --git a/modules/statusline/default.nix b/modules/statusline/default.nix index 82e3dd2f..4f433985 100644 --- a/modules/statusline/default.nix +++ b/modules/statusline/default.nix @@ -1,4 +1,4 @@ -{...}: { +{ imports = [ ./lualine ]; diff --git a/modules/statusline/lualine/config.nix b/modules/statusline/lualine/config.nix index d73e0f6a..04f123dd 100644 --- a/modules/statusline/lualine/config.nix +++ b/modules/statusline/lualine/config.nix @@ -3,16 +3,21 @@ lib, ... }: let + inherit (lib.modules) mkIf; + inherit (lib.trivial) boolToString; + inherit (lib.strings) optionalString; + inherit (lib.nvim.lua) luaTable listToLuaTable; + inherit (lib.nvim.dag) entryAnywhere; + cfg = config.vim.statusline.lualine; breadcrumbsCfg = config.vim.ui.breadcrumbs; - inherit (lib) mkIf nvim boolToString optionalString; in { config = (mkIf cfg.enable) { vim.startPlugins = [ "lualine" ]; - vim.luaConfigRC.lualine = nvim.dag.entryAnywhere '' + vim.luaConfigRC.lualine = entryAnywhere '' local lualine = require('lualine') lualine.setup { options = { @@ -20,10 +25,10 @@ in { theme = "${cfg.theme}", component_separators = {"${cfg.componentSeparator.left}","${cfg.componentSeparator.right}"}, section_separators = {"${cfg.sectionSeparator.left}","${cfg.sectionSeparator.right}"}, - disabled_filetypes = ${nvim.lua.listToLuaTable cfg.disabledFiletypes}, + disabled_filetypes = ${listToLuaTable cfg.disabledFiletypes}, always_divide_middle = ${boolToString cfg.alwaysDivideMiddle}, globalstatus = ${boolToString cfg.globalStatus}, - ignore_focus = ${nvim.lua.listToLuaTable cfg.ignoreFocus}, + ignore_focus = ${listToLuaTable cfg.ignoreFocus}, extensions = {${optionalString config.vim.filetree.nvimTree.enable "'nvim-tree'"}}, refresh = { statusline = ${toString cfg.refresh.statusline}, @@ -34,22 +39,22 @@ in { -- active sections sections = { - lualine_a = ${nvim.lua.luaTable (cfg.activeSection.a ++ cfg.extraActiveSection.a)}, - lualine_b = ${nvim.lua.luaTable (cfg.activeSection.b ++ cfg.extraActiveSection.b)}, - lualine_c = ${nvim.lua.luaTable (cfg.activeSection.c ++ cfg.extraActiveSection.c)}, - lualine_x = ${nvim.lua.luaTable (cfg.activeSection.x ++ cfg.extraActiveSection.x)}, - lualine_y = ${nvim.lua.luaTable (cfg.activeSection.y ++ cfg.extraActiveSection.y)}, - lualine_z = ${nvim.lua.luaTable (cfg.activeSection.z ++ cfg.extraActiveSection.z)}, + lualine_a = ${luaTable (cfg.activeSection.a ++ cfg.extraActiveSection.a)}, + lualine_b = ${luaTable (cfg.activeSection.b ++ cfg.extraActiveSection.b)}, + lualine_c = ${luaTable (cfg.activeSection.c ++ cfg.extraActiveSection.c)}, + lualine_x = ${luaTable (cfg.activeSection.x ++ cfg.extraActiveSection.x)}, + lualine_y = ${luaTable (cfg.activeSection.y ++ cfg.extraActiveSection.y)}, + lualine_z = ${luaTable (cfg.activeSection.z ++ cfg.extraActiveSection.z)}, }, -- inactive sections inactive_sections = { - lualine_a = ${nvim.lua.luaTable (cfg.inactiveSection.a ++ cfg.extraInactiveSection.a)}, - lualine_b = ${nvim.lua.luaTable (cfg.inactiveSection.b ++ cfg.extraInactiveSection.b)}, - lualine_c = ${nvim.lua.luaTable (cfg.inactiveSection.c ++ cfg.extraInactiveSection.c)}, - lualine_x = ${nvim.lua.luaTable (cfg.inactiveSection.x ++ cfg.extraInactiveSection.x)}, - lualine_y = ${nvim.lua.luaTable (cfg.inactiveSection.y ++ cfg.extraInactiveSection.y)}, - lualine_z = ${nvim.lua.luaTable (cfg.inactiveSection.z ++ cfg.extraInactiveSection.z)}, + lualine_a = ${luaTable (cfg.inactiveSection.a ++ cfg.extraInactiveSection.a)}, + lualine_b = ${luaTable (cfg.inactiveSection.b ++ cfg.extraInactiveSection.b)}, + lualine_c = ${luaTable (cfg.inactiveSection.c ++ cfg.extraInactiveSection.c)}, + lualine_x = ${luaTable (cfg.inactiveSection.x ++ cfg.extraInactiveSection.x)}, + lualine_y = ${luaTable (cfg.inactiveSection.y ++ cfg.extraInactiveSection.y)}, + lualine_z = ${luaTable (cfg.inactiveSection.z ++ cfg.extraInactiveSection.z)}, }, -- tabline (currently unsupported) diff --git a/modules/statusline/lualine/default.nix b/modules/statusline/lualine/default.nix index 879e72f1..56d92078 100644 --- a/modules/statusline/lualine/default.nix +++ b/modules/statusline/lualine/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./lualine.nix ./config.nix diff --git a/modules/statusline/lualine/lualine.nix b/modules/statusline/lualine/lualine.nix index 8f9d7260..9f5b5835 100644 --- a/modules/statusline/lualine/lualine.nix +++ b/modules/statusline/lualine/lualine.nix @@ -3,7 +3,10 @@ lib, ... }: let - inherit (lib) mkEnableOption mkOption types elem optional; + inherit (builtins) elem; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) int bool str listOf enum; + inherit (lib.lists) optional; supported_themes = import ./supported_themes.nix; colorPuccin = @@ -20,44 +23,44 @@ in { refresh = { statusline = mkOption { - type = types.int; + type = int; description = "Refresh rate for lualine"; default = 1000; }; tabline = mkOption { - type = types.int; + type = int; description = "Refresh rate for tabline"; default = 1000; }; winbar = mkOption { - type = types.int; + type = int; description = "Refresh rate for winbar"; default = 1000; }; }; globalStatus = mkOption { - type = types.bool; + type = bool; description = "Enable global status for lualine"; default = true; }; alwaysDivideMiddle = mkOption { - type = types.bool; + type = bool; description = "Always divide middle section"; default = true; }; disabledFiletypes = mkOption { - type = with types; listOf str; + type = listOf str; description = "Filetypes to disable lualine on"; default = ["alpha"]; }; ignoreFocus = mkOption { - type = with types; listOf str; + type = listOf str; default = ["NvimTree"]; description = '' If current filetype is in this list it'll always be drawn as inactive statusline @@ -70,7 +73,7 @@ in { in mkOption { description = "Theme for lualine"; - type = types.enum ([ + type = enum ([ "auto" "16color" "gruvbox" @@ -112,13 +115,13 @@ in { sectionSeparator = { left = mkOption { - type = types.str; + type = str; description = "Section separator for left side"; default = ""; }; right = mkOption { - type = types.str; + type = str; description = "Section separator for right side"; default = ""; }; @@ -126,13 +129,13 @@ in { componentSeparator = { left = mkOption { - type = types.str; + type = str; description = "Component separator for left side"; default = ""; }; right = mkOption { - type = types.str; + type = str; description = "Component separator for right side"; default = ""; }; @@ -140,7 +143,7 @@ in { activeSection = { a = mkOption { - type = with types; listOf str; + type = listOf str; description = "active config for: | (A) | B | C X | Y | Z |"; default = [ '' @@ -157,7 +160,7 @@ in { }; b = mkOption { - type = with types; listOf str; + type = listOf str; description = "active config for: | A | (B) | C X | Y | Z |"; default = [ '' @@ -180,7 +183,7 @@ in { }; c = mkOption { - type = with types; listOf str; + type = listOf str; description = "active config for: | A | B | (C) X | Y | Z |"; default = [ '' @@ -207,7 +210,7 @@ in { }; x = mkOption { - type = with types; listOf str; + type = listOf str; description = "active config for: | A | B | C (X) | Y | Z |"; default = [ '' @@ -268,7 +271,7 @@ in { }; y = mkOption { - type = with types; listOf str; + type = listOf str; description = "active config for: | A | B | C X | (Y) | Z |"; default = [ '' @@ -290,7 +293,7 @@ in { }; z = mkOption { - type = with types; listOf str; + type = listOf str; description = "active config for: | A | B | C X | Y | (Z) |"; default = [ '' @@ -322,32 +325,32 @@ in { }; extraActiveSection = { a = mkOption { - type = with types; listOf str; + type = listOf str; description = "Extra entries for activeSection.a"; default = []; }; b = mkOption { - type = with types; listOf str; + type = listOf str; description = "Extra entries for activeSection.b"; default = []; }; c = mkOption { - type = with types; listOf str; + type = listOf str; description = "Extra entries for activeSection.c"; default = []; }; x = mkOption { - type = with types; listOf str; + type = listOf str; description = "Extra entries for activeSection.x"; default = []; }; y = mkOption { - type = with types; listOf str; + type = listOf str; description = "Extra entries for activeSection.y"; default = []; }; z = mkOption { - type = with types; listOf str; + type = listOf str; description = "Extra entries for activeSection.z"; default = []; }; @@ -355,69 +358,69 @@ in { inactiveSection = { a = mkOption { - type = with types; listOf str; + type = listOf str; description = "inactive config for: | (A) | B | C X | Y | Z |"; default = []; }; b = mkOption { - type = with types; listOf str; + type = listOf str; description = "inactive config for: | A | (B) | C X | Y | Z |"; default = []; }; c = mkOption { - type = with types; listOf str; + type = listOf str; description = "inactive config for: | A | B | (C) X | Y | Z |"; default = ["'filename'"]; }; x = mkOption { - type = with types; listOf str; + type = listOf str; description = "inactive config for: | A | B | C (X) | Y | Z |"; default = ["'location'"]; }; y = mkOption { - type = with types; listOf str; + type = listOf str; description = "inactive config for: | A | B | C X | (Y) | Z |"; default = []; }; z = mkOption { - type = with types; listOf str; + type = listOf str; description = "inactive config for: | A | B | C X | Y | (Z) |"; default = []; }; }; extraInactiveSection = { a = mkOption { - type = with types; listOf str; + type = listOf str; description = "Extra entries for inactiveSection.a"; default = []; }; b = mkOption { - type = with types; listOf str; + type = listOf str; description = "Extra entries for inactiveSection.b"; default = []; }; c = mkOption { - type = with types; listOf str; + type = listOf str; description = "Extra entries for inactiveSection.c"; default = []; }; x = mkOption { - type = with types; listOf str; + type = listOf str; description = "Extra entries for inactiveSection.x"; default = []; }; y = mkOption { - type = with types; listOf str; + type = listOf str; description = "Extra entries for inactiveSection.y"; default = []; }; z = mkOption { - type = with types; listOf str; + type = listOf str; description = "Extra entries for inactiveSection.z"; default = []; }; diff --git a/modules/tabline/default.nix b/modules/tabline/default.nix index 539302e2..5730dbab 100644 --- a/modules/tabline/default.nix +++ b/modules/tabline/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./nvim-bufferline ]; diff --git a/modules/tabline/nvim-bufferline/config.nix b/modules/tabline/nvim-bufferline/config.nix index befafcd6..93b0f58f 100644 --- a/modules/tabline/nvim-bufferline/config.nix +++ b/modules/tabline/nvim-bufferline/config.nix @@ -3,13 +3,14 @@ lib, ... }: let - inherit (lib) mkIf mkMerge mkLuaBinding mkBinding nvim pushDownDefault; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.binds) mkLuaBinding mkBinding pushDownDefault; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.tabline.nvimBufferline; - self = import ./nvim-bufferline.nix { - inherit lib; - }; - mappings = self.options.vim.tabline.nvimBufferline.mappings; + + self = import ./nvim-bufferline.nix {inherit lib;}; + inherit (self.options.vim.tabline.nvimBufferline) mappings; in { config = mkIf cfg.enable ( let @@ -22,82 +23,84 @@ in { ''; }; in { - vim.startPlugins = [ - (assert config.vim.visuals.nvimWebDevicons.enable == true; "nvim-bufferline-lua") - "bufdelete-nvim" - ]; + vim = { + startPlugins = [ + (assert config.vim.visuals.nvimWebDevicons.enable; "nvim-bufferline-lua") + "bufdelete-nvim" + ]; - vim.maps.normal = mkMerge [ - (mkLuaBinding cfg.mappings.closeCurrent "require(\"bufdelete\").bufdelete" mappings.closeCurrent.description) - (mkBinding cfg.mappings.cycleNext ":BufferLineCycleNext" mappings.cycleNext.description) - (mkBinding cfg.mappings.cycleNext ":BufferLineCycleNext" mappings.cycleNext.description) - (mkBinding cfg.mappings.cyclePrevious ":BufferLineCyclePrev" mappings.cyclePrevious.description) - (mkBinding cfg.mappings.pick ":BufferLinePick" mappings.pick.description) - (mkBinding cfg.mappings.sortByExtension ":BufferLineSortByExtension" mappings.sortByExtension.description) - (mkBinding cfg.mappings.sortByDirectory ":BufferLineSortByDirectory" mappings.sortByDirectory.description) - (mkLuaBinding cfg.mappings.sortById "function() require(\"bufferline\").sort_buffers_by(function (buf_a, buf_b) return buf_a.id < buf_b.id end) end" mappings.sortById.description) - (mkBinding cfg.mappings.moveNext ":BufferLineMoveNext" mappings.moveNext.description) - (mkBinding cfg.mappings.movePrevious ":BufferLineMovePrev" mappings.movePrevious.description) - ]; + maps.normal = mkMerge [ + (mkLuaBinding cfg.mappings.closeCurrent "require(\"bufdelete\").bufdelete" mappings.closeCurrent.description) + (mkBinding cfg.mappings.cycleNext ":BufferLineCycleNext" mappings.cycleNext.description) + (mkBinding cfg.mappings.cycleNext ":BufferLineCycleNext" mappings.cycleNext.description) + (mkBinding cfg.mappings.cyclePrevious ":BufferLineCyclePrev" mappings.cyclePrevious.description) + (mkBinding cfg.mappings.pick ":BufferLinePick" mappings.pick.description) + (mkBinding cfg.mappings.sortByExtension ":BufferLineSortByExtension" mappings.sortByExtension.description) + (mkBinding cfg.mappings.sortByDirectory ":BufferLineSortByDirectory" mappings.sortByDirectory.description) + (mkLuaBinding cfg.mappings.sortById "function() require(\"bufferline\").sort_buffers_by(function (buf_a, buf_b) return buf_a.id < buf_b.id end) end" mappings.sortById.description) + (mkBinding cfg.mappings.moveNext ":BufferLineMoveNext" mappings.moveNext.description) + (mkBinding cfg.mappings.movePrevious ":BufferLineMovePrev" mappings.movePrevious.description) + ]; - vim.binds.whichKey.register = pushDownDefault { - "b" = "+Buffer"; - "bm" = "BufferLineMove"; - "bs" = "BufferLineSort"; - "bsi" = "BufferLineSortById"; + binds.whichKey.register = pushDownDefault { + "b" = "+Buffer"; + "bm" = "BufferLineMove"; + "bs" = "BufferLineSort"; + "bsi" = "BufferLineSortById"; + }; + + luaConfigRC.nvimBufferline = entryAnywhere '' + require("bufferline").setup{ + options = { + mode = "buffers", + numbers = "both", + close_command = ${mouse.close}, + right_mouse_command = ${mouse.right}, + indicator = { + style = 'icon', + indicator_icon = '▎', + }, + buffer_close_icon = '󰅖', + modified_icon = '●', + close_icon = '', + left_trunc_marker = '', + right_trunc_marker = '', + max_name_length = 18, + max_prefix_length = 15, + tab_size = 18, + show_buffer_icons = true, + show_buffer_close_icons = true, + show_close_icon = true, + show_tab_indicators = true, + persist_buffer_sort = true, + --separator_style = "thin", + separator_style = { " ", " " }, + enforce_regular_tabs = true, + always_show_bufferline = true, + offsets = { + {filetype = "NvimTree", text = "File Explorer", text_align = "center"} + }, + sort_by = 'extension', + diagnostics = "nvim_lsp", -- TODO: use coc if it's enabled + diagnostics_update_in_insert = true, + diagnostics_indicator = function(count, level, diagnostics_dict, context) + local s = "" + for e, n in pairs(diagnostics_dict) do + local sym = e == "error" and "" + or (e == "warning" and "" or "" ) + if(sym ~= "") then + s = s .. " " .. n .. sym + end + end + return s + end, + numbers = function(opts) + return string.format('%s·%s', opts.raise(opts.id), opts.lower(opts.ordinal)) + end, + } + } + ''; }; - - vim.luaConfigRC.nvimBufferline = nvim.dag.entryAnywhere '' - require("bufferline").setup{ - options = { - mode = "buffers", - numbers = "both", - close_command = ${mouse.close}, - right_mouse_command = ${mouse.right}, - indicator = { - style = 'icon', - indicator_icon = '▎', - }, - buffer_close_icon = '󰅖', - modified_icon = '●', - close_icon = '', - left_trunc_marker = '', - right_trunc_marker = '', - max_name_length = 18, - max_prefix_length = 15, - tab_size = 18, - show_buffer_icons = true, - show_buffer_close_icons = true, - show_close_icon = true, - show_tab_indicators = true, - persist_buffer_sort = true, - --separator_style = "thin", - separator_style = { " ", " " }, - enforce_regular_tabs = true, - always_show_bufferline = true, - offsets = { - {filetype = "NvimTree", text = "File Explorer", text_align = "center"} - }, - sort_by = 'extension', - diagnostics = "nvim_lsp", -- TODO: use coc if it's enabled - diagnostics_update_in_insert = true, - diagnostics_indicator = function(count, level, diagnostics_dict, context) - local s = "" - for e, n in pairs(diagnostics_dict) do - local sym = e == "error" and "" - or (e == "warning" and "" or "" ) - if(sym ~= "") then - s = s .. " " .. n .. sym - end - end - return s - end, - numbers = function(opts) - return string.format('%s·%s', opts.raise(opts.id), opts.lower(opts.ordinal)) - end, - } - } - ''; } ); } diff --git a/modules/tabline/nvim-bufferline/default.nix b/modules/tabline/nvim-bufferline/default.nix index 8fe4868c..9f31874e 100644 --- a/modules/tabline/nvim-bufferline/default.nix +++ b/modules/tabline/nvim-bufferline/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./nvim-bufferline.nix ./config.nix diff --git a/modules/tabline/nvim-bufferline/nvim-bufferline.nix b/modules/tabline/nvim-bufferline/nvim-bufferline.nix index 1ca3ff01..6e2b87e3 100644 --- a/modules/tabline/nvim-bufferline/nvim-bufferline.nix +++ b/modules/tabline/nvim-bufferline/nvim-bufferline.nix @@ -1,8 +1,9 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkMappingOption; + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; in { options.vim.tabline.nvimBufferline = { - enable = mkEnableOption "nvim-bufferline-lua as a bufferline"; + enable = mkEnableOption "neovim bufferline"; mappings = { closeCurrent = mkMappingOption "Close buffer" null; diff --git a/modules/terminal/default.nix b/modules/terminal/default.nix index c8bbc222..a268e8b1 100644 --- a/modules/terminal/default.nix +++ b/modules/terminal/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./toggleterm ]; diff --git a/modules/terminal/toggleterm/config.nix b/modules/terminal/toggleterm/config.nix index eca6e60a..1ffec588 100644 --- a/modules/terminal/toggleterm/config.nix +++ b/modules/terminal/toggleterm/config.nix @@ -4,48 +4,54 @@ ... }: let inherit (builtins) toJSON; - inherit (lib) mkMerge mkIf mkBinding nvim getExe; + inherit (lib.lists) optionals; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.meta) getExe; + inherit (lib.nvim.binds) mkBinding; + inherit (lib.nvim.dag) entryAnywhere entryAfter; cfg = config.vim.terminal.toggleterm; in { config = mkMerge [ ( mkIf cfg.enable { - vim.startPlugins = [ - "toggleterm-nvim" - ]; + vim = { + startPlugins = [ + "toggleterm-nvim" + ]; - vim.maps.normal = mkBinding cfg.mappings.open "execute v:count . \"ToggleTerm\"" "Toggle terminal"; + maps.normal = mkBinding cfg.mappings.open "execute v:count . \"ToggleTerm\"" "Toggle terminal"; - vim.luaConfigRC.toggleterm = nvim.dag.entryAnywhere '' - require("toggleterm").setup({ - open_mapping = null, - direction = '${toString cfg.direction}', - -- TODO: this should probably be turned into a module that uses the lua function if and only if the user has not set it - size = function(term) - if term.direction == "horizontal" then - return 15 - elseif term.direction == "vertical" then - return vim.o.columns * 0.4 - end - end, - winbar = { - enabled = '${toString cfg.enable_winbar}', - name_formatter = function(term) -- term: Terminal - return term.name - end - }, - }) - ''; + luaConfigRC.toggleterm = entryAnywhere '' + require("toggleterm").setup({ + open_mapping = null, + direction = '${toString cfg.direction}', + -- TODO: this should probably be turned into a module that uses the lua function if and only if the user has not set it + size = function(term) + if term.direction == "horizontal" then + return 15 + elseif term.direction == "vertical" then + return vim.o.columns * 0.4 + end + end, + winbar = { + enabled = '${toString cfg.enable_winbar}', + name_formatter = function(term) -- term: Terminal + return term.name + end + }, + }) + ''; + }; } ) ( mkIf (cfg.enable && cfg.lazygit.enable) { - vim.startPlugins = lib.optionals (cfg.lazygit.package != null) [ + vim.startPlugins = optionals (cfg.lazygit.package != null) [ cfg.lazygit.package ]; - vim.luaConfigRC.toggleterm-lazygit = nvim.dag.entryAfter ["toggleterm"] '' + vim.luaConfigRC.toggleterm-lazygit = entryAfter ["toggleterm"] '' local terminal = require 'toggleterm.terminal' local lazygit = terminal.Terminal:new({ cmd = '${ diff --git a/modules/terminal/toggleterm/default.nix b/modules/terminal/toggleterm/default.nix index a540f3fb..093dc0d8 100644 --- a/modules/terminal/toggleterm/default.nix +++ b/modules/terminal/toggleterm/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./toggleterm.nix ./config.nix diff --git a/modules/terminal/toggleterm/toggleterm.nix b/modules/terminal/toggleterm/toggleterm.nix index 35790635..dbc8e541 100644 --- a/modules/terminal/toggleterm/toggleterm.nix +++ b/modules/terminal/toggleterm/toggleterm.nix @@ -1,29 +1,30 @@ { pkgs, - config, lib, ... }: let - inherit (lib) mkEnableOption mkOption types mkMappingOption; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; + inherit (lib.types) nullOr str enum bool package; in { options.vim.terminal.toggleterm = { enable = mkEnableOption "toggleterm as a replacement to built-in terminal command"; mappings = { open = mkOption { - type = types.nullOr types.str; + type = nullOr str; description = "The keymapping to open toggleterm"; default = ""; }; }; direction = mkOption { - type = types.enum ["horizontal" "vertical" "tab" "float"]; + type = enum ["horizontal" "vertical" "tab" "float"]; default = "horizontal"; description = "Direction of the terminal"; }; enable_winbar = mkOption { - type = types.bool; + type = bool; default = false; description = "Enable winbar"; }; @@ -31,13 +32,13 @@ in { lazygit = { enable = mkEnableOption "LazyGit integration"; direction = mkOption { - type = types.enum ["horizontal" "vertical" "tab" "float"]; + type = enum ["horizontal" "vertical" "tab" "float"]; default = "float"; description = "Direction of the lazygit window"; }; package = mkOption { - type = with types; nullOr package; + type = nullOr package; default = pkgs.lazygit; description = "The package that should be used for lazygit. Setting it to null will attempt to use lazygit from your PATH"; }; diff --git a/modules/theme/config.nix b/modules/theme/config.nix index 01be14cc..f6544b33 100644 --- a/modules/theme/config.nix +++ b/modules/theme/config.nix @@ -1,9 +1,5 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkDefault; +{lib, ...}: let + inherit (lib.modules) mkDefault; in { config = { vim.theme = { diff --git a/modules/theme/default.nix b/modules/theme/default.nix index 02f4f37f..3b379287 100644 --- a/modules/theme/default.nix +++ b/modules/theme/default.nix @@ -1,4 +1,4 @@ -{...}: { +{ imports = [ ./theme.nix ./config.nix diff --git a/modules/theme/theme.nix b/modules/theme/theme.nix index 094a56ca..2ae3e453 100644 --- a/modules/theme/theme.nix +++ b/modules/theme/theme.nix @@ -3,44 +3,50 @@ lib, ... }: let - inherit (lib) mkOption types attrNames mkIf nvim; + inherit (lib.options) mkOption; + inherit (lib.attrsets) attrNames; + inherit (lib.types) bool lines enum; + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryBefore; cfg = config.vim.theme; supported_themes = import ./supported_themes.nix {inherit lib;}; in { options.vim.theme = { enable = mkOption { - type = types.bool; + type = bool; description = "Enable theming"; }; name = mkOption { - type = types.enum (attrNames supported_themes); + type = enum (attrNames supported_themes); description = "Supported themes can be found in `supported_themes.nix`"; }; style = mkOption { - type = with types; enum supported_themes.${cfg.name}.styles; + type = enum supported_themes.${cfg.name}.styles; description = "Specific style for theme if it supports it"; }; transparent = mkOption { - type = with types; bool; + type = bool; default = false; description = "Whether or not transparency should be enabled. Has no effect for themes that do not support transparency"; }; extraConfig = mkOption { - type = with types; lines; + type = lines; description = "Additional lua configuration to add before setup"; }; }; config = mkIf cfg.enable { - vim.startPlugins = [cfg.name]; - vim.luaConfigRC.themeSetup = nvim.dag.entryBefore ["theme"] cfg.extraConfig; - vim.luaConfigRC.theme = supported_themes.${cfg.name}.setup (with cfg; { - inherit style transparent; - }); + vim = { + startPlugins = [cfg.name]; + luaConfigRC = { + themeSetup = entryBefore ["theme"] cfg.extraConfig; + theme = supported_themes.${cfg.name}.setup (with cfg; {inherit style transparent;}); + }; + }; }; } diff --git a/modules/treesitter/config.nix b/modules/treesitter/config.nix index d197129f..92802a85 100644 --- a/modules/treesitter/config.nix +++ b/modules/treesitter/config.nix @@ -3,60 +3,64 @@ lib, ... }: let - inherit (lib) addDescriptionsToMappings mkIf optional mkSetBinding mkMerge nvim; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) optional; + inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings; + inherit (lib.nvim.dag) entryBefore entryAnywhere; cfg = config.vim.treesitter; usingNvimCmp = config.vim.autocomplete.enable && config.vim.autocomplete.type == "nvim-cmp"; self = import ./treesitter.nix {inherit lib;}; - mappingDefinitions = self.options.vim.treesitter.mappings; mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions; in { config = mkIf cfg.enable { - vim.startPlugins = - ["nvim-treesitter"] - ++ optional usingNvimCmp "cmp-treesitter"; + vim = { + startPlugins = ["nvim-treesitter"] ++ optional usingNvimCmp "cmp-treesitter"; - vim.autocomplete.sources = {"treesitter" = "[Treesitter]";}; + autocomplete.sources = {"treesitter" = "[Treesitter]";}; - # For some reason, using mkSetLuaBinding and putting the lua code does not work. It just selects the whole file. - # This works though, and if it ain't broke, don't fix it. - vim.maps.normal = mkSetBinding mappings.incrementalSelection.init ":lua require('nvim-treesitter.incremental_selection').init_selection()"; + maps = { + # HACK: Using mkSetLuaBinding and putting the lua code does not work for some reason: It just selects the whole file. + # This works though, and if it ain't broke, don't fix it. + normal = mkSetBinding mappings.incrementalSelection.init ":lua require('nvim-treesitter.incremental_selection').init_selection()"; - vim.maps.visualOnly = mkMerge [ - (mkSetBinding mappings.incrementalSelection.incrementByNode ":lua require('nvim-treesitter.incremental_selection').node_incremental()") - (mkSetBinding mappings.incrementalSelection.incrementByScope ":lua require('nvim-treesitter.incremental_selection').scope_incremental()") - (mkSetBinding mappings.incrementalSelection.decrementByNode ":lua require('nvim-treesitter.incremental_selection').node_decremental()") - ]; + visualOnly = mkMerge [ + (mkSetBinding mappings.incrementalSelection.incrementByNode ":lua require('nvim-treesitter.incremental_selection').node_incremental()") + (mkSetBinding mappings.incrementalSelection.incrementByScope ":lua require('nvim-treesitter.incremental_selection').scope_incremental()") + (mkSetBinding mappings.incrementalSelection.decrementByNode ":lua require('nvim-treesitter.incremental_selection').node_decremental()") + ]; + }; - # 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 - ''); + # For some reason treesitter highlighting does not work on start if this is set before syntax on + configRC.treesitter-fold = mkIf cfg.fold (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 = false, - node_incremental = false, - scope_incremental = false, - node_decremental = false, + luaConfigRC.treesitter = entryAnywhere '' + require'nvim-treesitter.configs'.setup { + highlight = { + enable = true, + disable = {}, }, - }, - } - ''; + + auto_install = false, + ensure_installed = {}, + + incremental_selection = { + enable = true, + keymaps = { + init_selection = false, + node_incremental = false, + scope_incremental = false, + node_decremental = false, + }, + }, + } + ''; + }; }; } diff --git a/modules/treesitter/context.nix b/modules/treesitter/context.nix index d6859d4a..8bb65b5d 100644 --- a/modules/treesitter/context.nix +++ b/modules/treesitter/context.nix @@ -1,12 +1,16 @@ { - pkgs, config, lib, ... }: let - inherit (lib) mkEnableOption mkOption types mkIf nvim boolToString; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) int bool str nullOr enum; + inherit (lib.modules) mkIf; + inherit (lib.trivial) boolToString; + inherit (lib.nvim.lua) nullString; + inherit (lib.nvim.dag) entryAnywhere; - treesitter = config.vim.treesitter; + inherit (config.vim) treesitter; cfg = treesitter.context; in { options.vim.treesitter.context = { @@ -14,37 +18,37 @@ in { maxLines = mkOption { description = "How many lines the window should span. Values <=0 mean no limit."; - type = types.int; + type = int; default = 0; }; minWindowHeight = mkOption { description = "Minimum editor window height to enable context. Values <= 0 mean no limit."; - type = types.int; + type = int; default = 0; }; lineNumbers = mkOption { description = ""; - type = types.bool; + type = bool; default = true; }; multilineThreshold = mkOption { description = "Maximum number of lines to collapse for a single context line."; - type = types.int; + type = int; default = 20; }; trimScope = mkOption { description = "Which context lines to discard if [](#opt-vim.treesitter.context.maxLines) is exceeded."; - type = types.enum ["inner" "outer"]; + type = enum ["inner" "outer"]; default = "outer"; }; mode = mkOption { description = "Line used to calculate context."; - type = types.enum ["cursor" "topline"]; + type = enum ["cursor" "topline"]; default = "cursor"; }; @@ -54,13 +58,13 @@ in { When separator is set, the context will only show up when there are at least 2 lines above cursorline. ''; - type = with types; nullOr str; + type = nullOr str; default = null; }; zindex = mkOption { description = "The Z-index of the context window."; - type = types.int; + type = int; default = 20; }; }; @@ -68,7 +72,7 @@ in { config = mkIf (treesitter.enable && cfg.enable) { vim.startPlugins = ["nvim-treesitter-context"]; - vim.luaConfigRC.treesitter-context = nvim.dag.entryAnywhere '' + vim.luaConfigRC.treesitter-context = entryAnywhere '' require'treesitter-context'.setup { enable = true, max_lines = ${toString cfg.maxLines}, @@ -77,7 +81,7 @@ in { multiline_threshold = ${toString cfg.multilineThreshold}, trim_scope = '${cfg.trimScope}', mode = '${cfg.mode}', - separator = ${nvim.lua.nullString cfg.separator}, + separator = ${nullString cfg.separator}, max_lines = ${toString cfg.zindex}, } ''; diff --git a/modules/treesitter/default.nix b/modules/treesitter/default.nix index 30d51d5b..5520cfea 100644 --- a/modules/treesitter/default.nix +++ b/modules/treesitter/default.nix @@ -1,4 +1,4 @@ -{...}: { +{ imports = [ ./treesitter.nix ./context.nix diff --git a/modules/treesitter/treesitter.nix b/modules/treesitter/treesitter.nix index 413f3034..feae8d7e 100644 --- a/modules/treesitter/treesitter.nix +++ b/modules/treesitter/treesitter.nix @@ -1,29 +1,26 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkMappingOption mkOption types; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; + inherit (lib.types) listOf package; in { options.vim.treesitter = { enable = mkEnableOption "treesitter, also enabled automatically through language options"; - fold = mkEnableOption "fold with treesitter"; - autotagHtml = mkEnableOption "autoclose and rename html tag"; - - mappings = { - incrementalSelection = { - init = mkMappingOption "Init selection [treesitter]" "gnn"; - incrementByNode = mkMappingOption "Increment selection by node [treesitter]" "grn"; - incrementByScope = mkMappingOption "Increment selection by scope [treesitter]" "grc"; - decrementByNode = mkMappingOption "Decrement selection by node [treesitter]" "grm"; - }; - }; - grammars = mkOption { - type = with types; listOf package; + type = listOf package; default = []; description = '' List of treesitter grammars to install. For supported languages use the `vim.language..treesitter` option ''; }; + + mappings.incrementalSelection = { + init = mkMappingOption "Init selection [treesitter]" "gnn"; + incrementByNode = mkMappingOption "Increment selection by node [treesitter]" "grn"; + incrementByScope = mkMappingOption "Increment selection by scope [treesitter]" "grc"; + decrementByNode = mkMappingOption "Decrement selection by node [treesitter]" "grm"; + }; }; } diff --git a/modules/ui/borders/borders.nix b/modules/ui/borders/borders.nix index 69d1ccd3..37589dca 100644 --- a/modules/ui/borders/borders.nix +++ b/modules/ui/borders/borders.nix @@ -3,7 +3,9 @@ lib, ... }: let - inherit (lib) mkOption mkEnableOption types; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.lists) optionals; + inherit (lib.types) enum; cfg = config.vim.ui.borders; @@ -13,10 +15,10 @@ in { enable = mkEnableOption "visible borders for most windows"; globalStyle = mkOption { - type = types.enum defaultStyles; + type = enum defaultStyles; default = "rounded"; description = '' - global border style to use + The global border style to use. ''; }; @@ -26,14 +28,14 @@ in { enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;}; style = mkOption { - type = types.enum (defaultStyles ++ lib.optionals (name != "which-key") ["shadow"]); + type = enum (defaultStyles ++ optionals (name != "which-key") ["shadow"]); default = cfg.globalStyle; - description = "border style to use for the ${name} plugin"; + description = "The border style to use for the ${name} plugin"; }; }; in { # despite not having it listed in example configuration, which-key does support the rounded type - # additionall, it supports a "shadow" type that is similar to none but is of higher contrast + # additionally, it supports a "shadow" type that is similar to none but is of higher contrast which-key = mkPluginStyleOption "which-key"; lspsaga = mkPluginStyleOption "lspsaga"; nvim-cmp = mkPluginStyleOption "nvim-cmp"; diff --git a/modules/ui/borders/default.nix b/modules/ui/borders/default.nix index 526ac4e5..38b02b89 100644 --- a/modules/ui/borders/default.nix +++ b/modules/ui/borders/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./borders.nix ]; diff --git a/modules/ui/breadcrumbs/breadcrumbs.nix b/modules/ui/breadcrumbs/breadcrumbs.nix index c979e39a..f56223b1 100644 --- a/modules/ui/breadcrumbs/breadcrumbs.nix +++ b/modules/ui/breadcrumbs/breadcrumbs.nix @@ -1,14 +1,15 @@ { - lib, config, + lib, ... }: let - inherit (lib) mkEnableOption mkOption types; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) nullOr listOf enum bool str int; in { options.vim.ui.breadcrumbs = { - enable = lib.mkEnableOption "breadcrumbs"; + enable = mkEnableOption "breadcrumbs"; source = mkOption { - type = with types; nullOr (enum ["nvim-navic"]); # TODO: lspsaga and dropbar + type = nullOr (enum ["nvim-navic"]); # TODO: lspsaga and dropbar default = "nvim-navic"; description = '' The source to be used for breadcrumbs component. Null means no breadcrumbs. @@ -18,7 +19,7 @@ in { # maybe this should be an option to *disable* alwaysRender optionally but oh well # too late alwaysRender = mkOption { - type = types.bool; + type = bool; default = true; description = "Whether to always display the breadcrumbs component on winbar (always renders winbar)"; }; @@ -28,152 +29,152 @@ in { # this option is interpreted as null if mkEnableOption is used, and therefore cannot be converted to a string in config.nix useDefaultMappings = mkOption { - type = types.bool; + type = bool; default = true; description = "use default Navbuddy keybindings (disables user-specified keybinds)"; }; mappings = { close = mkOption { - type = types.str; + type = str; default = ""; description = "keybinding to close Navbuddy UI"; }; nextSibling = mkOption { - type = types.str; + type = str; default = "j"; description = "keybinding to navigate to the next sibling node"; }; previousSibling = mkOption { - type = types.str; + type = str; default = "k"; description = "keybinding to navigate to the previous sibling node"; }; parent = mkOption { - type = types.str; + type = str; default = "h"; description = "keybinding to navigate to the parent node"; }; children = mkOption { - type = types.str; + type = str; default = "h"; description = "keybinding to navigate to the child node"; }; root = mkOption { - type = types.str; + type = str; default = "0"; description = "keybinding to navigate to the root node"; }; visualName = mkOption { - type = types.str; + type = str; default = "v"; description = "visual selection of name"; }; visualScope = mkOption { - type = types.str; + type = str; default = "V"; description = "visual selection of scope"; }; yankName = mkOption { - type = types.str; + type = str; default = "y"; description = "yank the name to system clipboard"; }; yankScope = mkOption { - type = types.str; + type = str; default = "Y"; description = "yank the scope to system clipboard"; }; insertName = mkOption { - type = types.str; + type = str; default = "i"; description = "insert at start of name"; }; insertScope = mkOption { - type = types.str; + type = str; default = "I"; description = "insert at start of scope"; }; appendName = mkOption { - type = types.str; + type = str; default = "a"; description = "insert at end of name"; }; appendScope = mkOption { - type = types.str; + type = str; default = "A"; description = "insert at end of scope"; }; rename = mkOption { - type = types.str; + type = str; default = "r"; description = "rename the node"; }; delete = mkOption { - type = types.str; + type = str; default = "d"; description = "delete the node"; }; foldCreate = mkOption { - type = types.str; + type = str; default = "f"; description = "create a new fold"; }; foldDelete = mkOption { - type = types.str; + type = str; default = "F"; description = "delete the current fold"; }; comment = mkOption { - type = types.str; + type = str; default = "c"; description = "comment the node"; }; select = mkOption { - type = types.str; + type = str; default = ""; description = "goto selected symbol"; }; moveDown = mkOption { - type = types.str; + type = str; default = "J"; description = "move focused node down"; }; moveUp = mkOption { - type = types.str; + type = str; default = "K"; description = "move focused node up"; }; telescope = mkOption { - type = types.str; + type = str; default = "t"; description = "fuzzy finder at current level"; }; help = mkOption { - type = types.str; + type = str; default = "g?"; description = "open mapping help window"; }; @@ -185,13 +186,13 @@ in { border = mkOption { # TODO: let this type accept a custom string - type = types.enum ["single" "rounded" "double" "solid" "none"]; + type = enum ["single" "rounded" "double" "solid" "none"]; default = config.vim.ui.borders.globalStyle; description = "border style to use"; }; scrolloff = mkOption { - type = with types; nullOr int; + type = nullOr int; default = null; description = "Scrolloff value within navbuddy window"; }; @@ -209,7 +210,7 @@ in { border = mkOption { # TODO: let this type accept a custom string - type = with types; nullOr (enum ["single" "rounded" "double" "solid" "none"]); + type = nullOr (enum ["single" "rounded" "double" "solid" "none"]); default = config.vim.ui.borders.globalStyle; description = "border style to use for the left section of Navbuddy UI"; }; @@ -227,7 +228,7 @@ in { border = mkOption { # TODO: let this type accept a custom string - type = with types; nullOr (enum ["single" "rounded" "double" "solid" "none"]); + type = nullOr (enum ["single" "rounded" "double" "solid" "none"]); default = config.vim.ui.borders.globalStyle; description = "border style to use for the middle section of Navbuddy UI"; }; @@ -238,13 +239,13 @@ in { right = { border = mkOption { # TODO: let this type accept a custom string - type = with types; nullOr (enum ["single" "rounded" "double" "solid" "none"]); + type = nullOr (enum ["single" "rounded" "double" "solid" "none"]); default = config.vim.ui.borders.globalStyle; description = "border style to use for the right section of Navbuddy UI"; }; preview = mkOption { - type = types.enum ["leaf" "always" "never"]; + type = enum ["leaf" "always" "never"]; default = "leaf"; description = "display mode of the preview on the right section"; }; @@ -256,19 +257,19 @@ in { enable = mkEnableOption "node markers"; icons = { leaf = mkOption { - type = types.str; + type = str; default = " "; description = ""; }; leafSelected = mkOption { - type = types.str; + type = str; default = " → "; description = ""; }; branch = mkOption { - type = types.str; + type = str; default = " "; description = ""; }; @@ -277,13 +278,13 @@ in { lsp = { autoAttach = mkOption { - type = types.bool; + type = bool; default = true; description = "Whether to attach to LSP server manually"; }; preference = mkOption { - type = with types; nullOr (listOf str); + type = nullOr (listOf str); default = null; description = "list of lsp server names in order of preference"; }; @@ -291,25 +292,25 @@ in { sourceBuffer = { followNode = mkOption { - type = types.bool; + type = bool; default = true; description = "keep the current node in focus on the source buffer"; }; highlight = mkOption { - type = types.bool; + type = bool; default = true; description = "highlight the currently focused node"; }; reorient = mkOption { - type = types.enum ["smart" "top" "mid" "none"]; + type = enum ["smart" "top" "mid" "none"]; default = "smart"; description = "reorient buffer after changing nodes"; }; scrolloff = mkOption { - type = with types; nullOr int; + type = nullOr int; default = null; description = "scrolloff value when navbuddy is open"; }; @@ -319,159 +320,159 @@ in { # alas, I am not a nix wizard icons = { file = mkOption { - type = types.str; + type = str; default = "󰈙 "; - description = ""; + description = "File icon"; }; module = mkOption { - type = types.str; + type = str; default = " "; - description = ""; + description = "Module icon"; }; namespace = mkOption { - type = types.str; + type = str; default = "󰌗 "; - description = ""; + description = "Namespace icon"; }; package = mkOption { - type = types.str; + type = str; default = " "; description = ""; }; class = mkOption { - type = types.str; + type = str; default = "󰌗 "; - description = ""; + description = "Class icon"; }; property = mkOption { - type = types.str; + type = str; default = " "; description = ""; }; field = mkOption { - type = types.str; + type = str; default = " "; - description = ""; + description = "Field icon"; }; constructor = mkOption { - type = types.str; + type = str; default = " "; - description = ""; + description = "Constructor icon"; }; enum = mkOption { - type = types.str; + type = str; default = "󰕘"; - description = ""; + description = "Enum icon"; }; interface = mkOption { - type = types.str; + type = str; default = "󰕘"; - description = ""; + description = "Interface icon"; }; function = mkOption { - type = types.str; + type = str; default = "󰊕 "; - description = ""; + description = "Function icon"; }; variable = mkOption { - type = types.str; + type = str; default = "󰆧 "; description = ""; }; constant = mkOption { - type = types.str; + type = str; default = "󰏿 "; - description = ""; + description = "Constant icon"; }; string = mkOption { - type = types.str; + type = str; default = " "; description = ""; }; number = mkOption { - type = types.str; + type = str; default = "󰎠 "; - description = ""; + description = "Number icon"; }; boolean = mkOption { - type = types.str; + type = str; default = "◩ "; description = ""; }; array = mkOption { - type = types.str; + type = str; default = "󰅪 "; - description = ""; + description = "Array icon"; }; object = mkOption { - type = types.str; + type = str; default = "󰅩 "; - description = ""; + description = "Object icon"; }; method = mkOption { - type = types.str; + type = str; default = "󰆧 "; - description = ""; + description = "Method icon"; }; key = mkOption { - type = types.str; + type = str; default = "󰌋 "; - description = ""; + description = "Key icon"; }; null = mkOption { - type = types.str; + type = str; default = "󰟢 "; - description = ""; + description = "Null icon"; }; enumMember = mkOption { - type = types.str; + type = str; default = "󰕘 "; - description = ""; + description = "Enum member icon"; }; struct = mkOption { - type = types.str; + type = str; default = "󰌗 "; - description = ""; + description = "Struct icon"; }; event = mkOption { - type = types.str; + type = str; default = " "; - description = ""; + description = "Event icon"; }; operator = mkOption { - type = types.str; + type = str; default = "󰆕 "; - description = ""; + description = "Operator icon"; }; typeParameter = mkOption { - type = types.str; + type = str; default = "󰊄 "; - description = ""; + description = "Type parameter icon"; }; }; }; diff --git a/modules/ui/breadcrumbs/config.nix b/modules/ui/breadcrumbs/config.nix index 22de56d7..3dc3713b 100644 --- a/modules/ui/breadcrumbs/config.nix +++ b/modules/ui/breadcrumbs/config.nix @@ -3,11 +3,15 @@ lib, ... }: let - inherit (lib) optionalString boolToString mkIf optionals; + inherit (lib.strings) optionalString; + inherit (lib.trivial) boolToString; + inherit (lib.modules) mkIf; + inherit (lib.lists) optionals; inherit (lib.nvim.lua) nullString; + inherit (lib.nvim.dag) entryAfter; cfg = config.vim.ui.breadcrumbs; - nb = cfg.navbuddy; + nbcfg = cfg.navbuddy; in { config = mkIf cfg.enable { vim.startPlugins = @@ -26,7 +30,7 @@ in { "nvim-navic" ]; - vim.luaConfigRC.breadcrumbs = lib.nvim.dag.entryAfter ["lspconfig"] '' + vim.luaConfigRC.breadcrumbs = entryAfter ["lspconfig"] '' ${optionalString (cfg.source == "nvim-navic") '' local navic = require("nvim-navic") @@ -40,46 +44,46 @@ in { local actions = require("nvim-navbuddy.actions") navbuddy.setup { window = { - border = "${nb.window.border}", -- "rounded", "double", "solid", "none" + border = "${nbcfg.window.border}", -- "rounded", "double", "solid", "none" size = "60%", position = "50%", - scrolloff = ${(nullString nb.window.scrolloff)}, + scrolloff = ${(nullString nbcfg.window.scrolloff)}, sections = { left = { size = "20%", - border = ${(nullString nb.window.sections.left.border)}, + border = ${(nullString nbcfg.window.sections.left.border)}, }, mid = { size = "40%", - border = ${(nullString nb.window.sections.mid.border)}, + border = ${(nullString nbcfg.window.sections.mid.border)}, }, right = { - border = ${(nullString nb.window.sections.right.border)}, + border = ${(nullString nbcfg.window.sections.right.border)}, preview = "leaf", } }, }, node_markers = { - enabled = ${boolToString nb.nodeMarkers.enable}, + enabled = ${boolToString nbcfg.nodeMarkers.enable}, icons = { - leaf = "${nb.nodeMarkers.icons.leaf}", - leaf_selected = "${nb.nodeMarkers.icons.leafSelected}", - branch = "${nb.nodeMarkers.icons.branch}", + leaf = "${nbcfg.nodeMarkers.icons.leaf}", + leaf_selected = "${nbcfg.nodeMarkers.icons.leafSelected}", + branch = "${nbcfg.nodeMarkers.icons.branch}", }, }, lsp = { - auto_attach = ${boolToString nb.lsp.autoAttach}, + auto_attach = ${boolToString nbcfg.lsp.autoAttach}, -- preference = nil, -- TODO: convert list to lua table if not null }, source_buffer = { - follow_node = ${boolToString nb.sourceBuffer.followNode}, - highlight = ${boolToString nb.sourceBuffer.highlight}, - reorient = "${nb.sourceBuffer.reorient}", - scrolloff = ${nullString nb.sourceBuffer.scrolloff} + follow_node = ${boolToString nbcfg.sourceBuffer.followNode}, + highlight = ${boolToString nbcfg.sourceBuffer.highlight}, + reorient = "${nbcfg.sourceBuffer.reorient}", + scrolloff = ${nullString nbcfg.sourceBuffer.scrolloff} }, icons = { diff --git a/modules/ui/breadcrumbs/default.nix b/modules/ui/breadcrumbs/default.nix index 02c63515..50feefc6 100644 --- a/modules/ui/breadcrumbs/default.nix +++ b/modules/ui/breadcrumbs/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./config.nix ./breadcrumbs.nix diff --git a/modules/ui/colorizer/colorizer.nix b/modules/ui/colorizer/colorizer.nix index 8497e043..de3281cc 100644 --- a/modules/ui/colorizer/colorizer.nix +++ b/modules/ui/colorizer/colorizer.nix @@ -1,15 +1,12 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkEnableOption mkOption types; +{lib, ...}: let + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) attrsOf attrs bool enum; in { options.vim.ui.colorizer = { - enable = mkEnableOption "nvim-colorizer.lua for color highlighting"; + enable = mkEnableOption "color highlighting [nvim-colorizer.lua]"; filetypes = mkOption { - type = with types; attrsOf attrs; + type = attrsOf attrs; default = { css = {}; scss = {}; @@ -18,77 +15,54 @@ in { }; options = { + alwaysUpdate = mkEnableOption "updating color values even if buffer is not focused, like when using cmp_menu, cmp_docs"; + rgb = mkOption { - type = types.bool; + type = bool; default = true; description = "#RGB hex codes"; }; rrggbb = mkOption { - type = types.bool; + type = bool; default = true; description = "#RRGGBB hex codes"; }; names = mkOption { - type = types.bool; + type = bool; default = true; description = ''"Name" codes such as "Blue"''; }; rgb_fn = mkOption { - type = types.bool; + type = bool; default = false; description = "CSS rgb() and rgba() functions"; }; rrggbbaa = mkOption { - type = types.bool; + type = bool; default = false; description = "#RRGGBBAA hex codes"; }; hsl_fn = mkOption { - type = types.bool; + type = bool; default = false; description = "CSS hsl() and hsla() functions"; }; - css = mkOption { - type = types.bool; - default = false; - description = "Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB"; - }; - - css_fn = mkOption { - type = types.bool; - default = false; - description = "Enable all CSS *functions*: rgb_fn, hsl_fn"; - }; - mode = mkOption { - type = types.enum ["foreground" "background"]; + type = enum ["foreground" "background"]; default = "background"; description = "Set the display mode"; }; - tailwind = mkOption { - type = types.bool; - default = false; - description = "Enable tailwind colors"; - }; - - sass = mkOption { - type = types.bool; - default = false; - description = "Enable sass colors"; - }; - - alwaysUpdate = mkOption { - type = types.bool; - default = false; - description = "Update color values even if buffer is not focused, like when using cmp_menu, cmp_docs"; - }; + tailwind = mkEnableOption "tailwind colors"; + sass = mkEnableOption "sass colors"; + css = mkEnableOption "all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB"; + css_fn = mkEnableOption "all CSS *functions*: rgb_fn, hsl_fn"; }; }; } diff --git a/modules/ui/colorizer/config.nix b/modules/ui/colorizer/config.nix index 2706499f..a21644fa 100644 --- a/modules/ui/colorizer/config.nix +++ b/modules/ui/colorizer/config.nix @@ -1,10 +1,12 @@ { - pkgs, config, lib, ... }: let - inherit (lib) mkIf nvim boolToString; + inherit (lib.modules) mkIf; + inherit (lib.trivial) boolToString; + inherit (lib.nvim.lua) attrsetToLuaTable; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.ui.colorizer; in { @@ -13,14 +15,14 @@ in { "nvim-colorizer-lua" ]; - vim.luaConfigRC.colorizer = nvim.dag.entryAnywhere '' + vim.luaConfigRC.colorizer = entryAnywhere '' require('colorizer').setup({ - filetypes = ${nvim.lua.attrsetToLuaTable cfg.filetypes}, + filetypes = ${attrsetToLuaTable cfg.filetypes}, user_default_options = { RGB = ${boolToString cfg.options.rgb}; RRGGBB = ${boolToString cfg.options.rrggbb}; - names = ${boolToString cfg.options.names}; RRGGBBAA = ${boolToString cfg.options.rrggbbaa}; + names = ${boolToString cfg.options.names}; rgb_fn = ${boolToString cfg.options.rgb_fn}; hsl_fn = ${boolToString cfg.options.hsl_fn}; css = ${boolToString cfg.options.css}; diff --git a/modules/ui/colorizer/default.nix b/modules/ui/colorizer/default.nix index 3b5b4914..ef88180f 100644 --- a/modules/ui/colorizer/default.nix +++ b/modules/ui/colorizer/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./colorizer.nix ./config.nix diff --git a/modules/ui/default.nix b/modules/ui/default.nix index bbcb9d20..262cdbbf 100644 --- a/modules/ui/default.nix +++ b/modules/ui/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./noice ./modes diff --git a/modules/ui/illuminate/config.nix b/modules/ui/illuminate/config.nix index 4377622f..6d08c762 100644 --- a/modules/ui/illuminate/config.nix +++ b/modules/ui/illuminate/config.nix @@ -3,14 +3,15 @@ lib, ... }: let - inherit (lib) mkIf nvim; + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.ui.illuminate; in { config = mkIf cfg.enable { vim.startPlugins = ["vim-illuminate"]; - vim.luaConfigRC.vim-illuminate = nvim.dag.entryAnywhere '' + vim.luaConfigRC.vim-illuminate = entryAnywhere '' require('illuminate').configure({ filetypes_denylist = { 'dirvish', diff --git a/modules/ui/illuminate/default.nix b/modules/ui/illuminate/default.nix index 366bb7b2..03efe4cd 100644 --- a/modules/ui/illuminate/default.nix +++ b/modules/ui/illuminate/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./config.nix ./illuminate.nix diff --git a/modules/ui/illuminate/illuminate.nix b/modules/ui/illuminate/illuminate.nix index 29426f90..c9c5d2f8 100644 --- a/modules/ui/illuminate/illuminate.nix +++ b/modules/ui/illuminate/illuminate.nix @@ -1,11 +1,7 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkEnableOption; +{lib, ...}: let + inherit (lib.options) mkEnableOption; in { options.vim.ui.illuminate = { - enable = mkEnableOption "vim-illuminate: automatically highlight other uses of the word under the cursor"; + enable = mkEnableOption "automatically highlight other uses of the word under the cursor [vim-illuminate]"; }; } diff --git a/modules/ui/modes/config.nix b/modules/ui/modes/config.nix index d8483afa..25ee3377 100644 --- a/modules/ui/modes/config.nix +++ b/modules/ui/modes/config.nix @@ -3,7 +3,9 @@ lib, ... }: let - inherit (lib) mkIf nvim boolToString; + inherit (lib.modules) mkIf; + inherit (lib.trivial) boolToString; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.ui.modes-nvim; in { @@ -12,7 +14,7 @@ in { "modes-nvim" ]; - vim.luaConfigRC.modes-nvim = nvim.dag.entryAnywhere '' + vim.luaConfigRC.modes-nvim = entryAnywhere '' require('modes').setup({ set_cursorline = ${boolToString cfg.setCursorline}, line_opacity = { diff --git a/modules/ui/modes/default.nix b/modules/ui/modes/default.nix index 8c668dee..4fb96527 100644 --- a/modules/ui/modes/default.nix +++ b/modules/ui/modes/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./modes.nix ./config.nix diff --git a/modules/ui/modes/modes.nix b/modules/ui/modes/modes.nix index bfa80b0c..af45d30b 100644 --- a/modules/ui/modes/modes.nix +++ b/modules/ui/modes/modes.nix @@ -1,35 +1,39 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkOption types; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) str; in { options.vim.ui.modes-nvim = { enable = mkEnableOption "modes.nvim's prismatic line decorations"; setCursorline = mkOption { - type = types.bool; + type = bool; description = "Set a colored cursorline on current line"; default = false; # looks ugly, disabled by default }; colors = { copy = mkOption { - type = types.str; - description = "The #RRGGBB color code for the visual mode highlights"; + type = str; default = "#f5c359"; + description = "The #RRGGBB color code for the visual mode highlights"; }; + delete = mkOption { - type = types.str; - description = "The #RRGGBB color code for the visual mode highlights"; + type = str; default = "#c75c6a"; + description = "The #RRGGBB color code for the visual mode highlights"; }; + insert = mkOption { - type = types.str; - description = "The #RRGGBB color code for the visual mode highlights"; + type = str; default = "#78ccc5"; - }; - visual = mkOption { - type = types.str; description = "The #RRGGBB color code for the visual mode highlights"; + }; + + visual = mkOption { + type = str; default = "#9745be"; + description = "The #RRGGBB color code for the visual mode highlights"; }; }; }; diff --git a/modules/ui/noice/config.nix b/modules/ui/noice/config.nix index 2355497b..63c4f2b6 100644 --- a/modules/ui/noice/config.nix +++ b/modules/ui/noice/config.nix @@ -3,7 +3,9 @@ lib, ... }: let - inherit (lib) mkIf nvim boolToString; + inherit (lib.modules) mkIf; + inherit (lib.trivial) boolToString; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.ui.noice; in { @@ -13,7 +15,7 @@ in { "nui-nvim" ]; - vim.luaConfigRC.noice-nvim = nvim.dag.entryAnywhere '' + vim.luaConfigRC.noice-nvim = entryAnywhere '' require("noice").setup({ lsp = { override = { diff --git a/modules/ui/noice/default.nix b/modules/ui/noice/default.nix index e8087385..24f0ab66 100644 --- a/modules/ui/noice/default.nix +++ b/modules/ui/noice/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./noice.nix ./config.nix diff --git a/modules/ui/noice/noice.nix b/modules/ui/noice/noice.nix index 7afe82ce..b361d452 100644 --- a/modules/ui/noice/noice.nix +++ b/modules/ui/noice/noice.nix @@ -1,11 +1,7 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkEnableOption; +{lib, ...}: let + inherit (lib.options) mkEnableOption; in { options.vim.ui.noice = { - enable = mkEnableOption "noice-nvim UI modification library"; + enable = mkEnableOption "noice.nvim UI modification library"; }; } diff --git a/modules/ui/notifications/default.nix b/modules/ui/notifications/default.nix index aa5a73bf..d1bd989a 100644 --- a/modules/ui/notifications/default.nix +++ b/modules/ui/notifications/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./nvim-notify ]; diff --git a/modules/ui/notifications/nvim-notify/config.nix b/modules/ui/notifications/nvim-notify/config.nix index d2913660..852b94d3 100644 --- a/modules/ui/notifications/nvim-notify/config.nix +++ b/modules/ui/notifications/nvim-notify/config.nix @@ -3,37 +3,39 @@ lib, ... }: let - inherit (lib) mkIf nvim; + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.notify.nvim-notify; in { config = mkIf cfg.enable { - vim.startPlugins = ["nvim-notify"]; + vim = { + startPlugins = ["nvim-notify"]; + luaConfigRC.nvim-notify = entryAnywhere '' + require('notify').setup { + stages = "${cfg.stages}", + timeout = ${toString cfg.timeout}, + background_colour = "${cfg.background_colour}", + position = "${cfg.position}", + icons = { + ERROR = "${cfg.icons.ERROR}", + WARN = "${cfg.icons.WARN}", + INFO = "${cfg.icons.INFO}", + DEBUG = "${cfg.icons.DEBUG}", + TRACE = "${cfg.icons.TRACE}", + }, + } - vim.luaConfigRC.nvim-notify = nvim.dag.entryAnywhere '' - require('notify').setup { - stages = "${cfg.stages}", - timeout = ${toString cfg.timeout}, - background_colour = "${cfg.background_colour}", - position = "${cfg.position}", - icons = { - ERROR = "${cfg.icons.ERROR}", - WARN = "${cfg.icons.WARN}", - INFO = "${cfg.icons.INFO}", - DEBUG = "${cfg.icons.DEBUG}", - TRACE = "${cfg.icons.TRACE}", - }, - } + -- required to fix offset_encoding errors + local notify = vim.notify + vim.notify = function(msg, ...) + if msg:match("warning: multiple different client offset_encodings") then + return + end - -- required to fix offset_encoding errors - local notify = vim.notify - vim.notify = function(msg, ...) - if msg:match("warning: multiple different client offset_encodings") then - return + notify(msg, ...) end - - notify(msg, ...) - end - ''; + ''; + }; }; } diff --git a/modules/ui/notifications/nvim-notify/default.nix b/modules/ui/notifications/nvim-notify/default.nix index 0d4c39d2..d14648b8 100644 --- a/modules/ui/notifications/nvim-notify/default.nix +++ b/modules/ui/notifications/nvim-notify/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./config.nix ./nvim-notify.nix diff --git a/modules/ui/notifications/nvim-notify/nvim-notify.nix b/modules/ui/notifications/nvim-notify/nvim-notify.nix index 03741143..57683a41 100644 --- a/modules/ui/notifications/nvim-notify/nvim-notify.nix +++ b/modules/ui/notifications/nvim-notify/nvim-notify.nix @@ -1,38 +1,35 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkEnableOption mkOption types; +{lib, ...}: let + inherit (lib) mkOption mkEnableOption; + inherit (lib.types) enum int str attrsOf; in { options.vim.notify.nvim-notify = { enable = mkEnableOption "nvim-notify notifications"; stages = mkOption { - type = types.enum ["fade_in_slide_out" "fade_in" "slide_out" "none"]; + type = enum ["fade_in_slide_out" "fade_in" "slide_out" "none"]; default = "fade_in_slide_out"; description = "The stages of the notification"; }; timeout = mkOption { - type = types.int; + type = int; default = 1000; description = "The timeout of the notification"; }; background_colour = mkOption { - type = types.str; + type = str; default = "#000000"; description = "The background colour of the notification"; }; position = mkOption { - type = types.enum ["top_left" "top_right" "bottom_left" "bottom_right"]; + type = enum ["top_left" "top_right" "bottom_left" "bottom_right"]; default = "top_right"; description = "The position of the notification"; }; icons = mkOption { - type = types.attrsOf types.str; + type = attrsOf str; description = "The icons of the notification"; default = { ERROR = ""; diff --git a/modules/ui/smartcolumn/config.nix b/modules/ui/smartcolumn/config.nix index 5cf7b74c..48b47d2d 100644 --- a/modules/ui/smartcolumn/config.nix +++ b/modules/ui/smartcolumn/config.nix @@ -1,24 +1,25 @@ { - pkgs, config, lib, ... }: let - inherit (lib) mkIf nvim concatStringsSep; + inherit (lib.modules) mkIf; + inherit (lib.strings) concatStringsSep; + inherit (lib.nvim.lua) attrsetToLuaTable; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.ui.smartcolumn; in { config = mkIf cfg.enable { - vim.startPlugins = [ - "smartcolumn" - ]; + vim = { + startPlugins = ["smartcolumn"]; - vim.luaConfigRC.smartcolumn = nvim.dag.entryAnywhere '' + vim.luaConfigRC.smartcolumn = entryAnywhere '' require("smartcolumn").setup({ colorcolumn = "${toString cfg.showColumnAt}", -- { "help", "text", "markdown", "NvimTree", "alpha"}, disabled_filetypes = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.disabledFiletypes)} }, - custom_colorcolumn = ${nvim.lua.attrsetToLuaTable cfg.columnAt.languages}, + custom_colorcolumn = ${attrsetToLuaTable cfg.columnAt.languages}, scope = "file", }) ''; diff --git a/modules/ui/smartcolumn/default.nix b/modules/ui/smartcolumn/default.nix index 2169b22b..baa85bac 100644 --- a/modules/ui/smartcolumn/default.nix +++ b/modules/ui/smartcolumn/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./smartcolumn.nix ./config.nix diff --git a/modules/ui/smartcolumn/smartcolumn.nix b/modules/ui/smartcolumn/smartcolumn.nix index a1054639..bac4c7da 100644 --- a/modules/ui/smartcolumn/smartcolumn.nix +++ b/modules/ui/smartcolumn/smartcolumn.nix @@ -1,17 +1,18 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkOption types literalExpression; + inherit (lib.options) mkOption mkEnableOption literalExpression; + inherit (lib.types) nullOr int str submodule attrsOf either listOf; in { options.vim.ui.smartcolumn = { enable = mkEnableOption "line length indicator"; showColumnAt = mkOption { - type = types.nullOr types.int; + type = nullOr int; default = 120; description = "The position at which the column will be displayed. Set to null to disable"; }; disabledFiletypes = mkOption { - type = types.listOf types.str; + type = listOf str; default = ["help" "text" "markdown" "NvimTree" "alpha"]; description = "The filetypes smartcolumn will be disabled for."; }; @@ -19,8 +20,8 @@ in { columnAt = { languages = mkOption { description = "The position at which smart column should be displayed for each individual buffer type"; - type = types.submodule { - freeformType = with types; attrsOf (either int (listOf int)); + type = submodule { + freeformType = attrsOf (either int (listOf int)); }; example = literalExpression '' diff --git a/modules/utility/binds/cheatsheet/cheatsheet.nix b/modules/utility/binds/cheatsheet/cheatsheet.nix index 667fafac..cddc6a52 100644 --- a/modules/utility/binds/cheatsheet/cheatsheet.nix +++ b/modules/utility/binds/cheatsheet/cheatsheet.nix @@ -3,7 +3,7 @@ lib, ... }: let - inherit (lib) mkEnableOption; + inherit (lib.options) mkEnableOption; in { options.vim.binds.cheatsheet = { enable = mkEnableOption "cheatsheet-nvim: searchable cheatsheet for nvim using telescope"; diff --git a/modules/utility/binds/cheatsheet/config.nix b/modules/utility/binds/cheatsheet/config.nix index b5439a9f..d0edf100 100644 --- a/modules/utility/binds/cheatsheet/config.nix +++ b/modules/utility/binds/cheatsheet/config.nix @@ -3,14 +3,15 @@ lib, ... }: let - inherit (lib) mkIf nvim; + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.binds.cheatsheet; in { config = mkIf (cfg.enable) { vim.startPlugins = ["cheatsheet-nvim"]; - vim.luaConfigRC.cheaetsheet-nvim = nvim.dag.entryAnywhere '' + vim.luaConfigRC.cheaetsheet-nvim = entryAnywhere '' require('cheatsheet').setup({}) ''; }; diff --git a/modules/utility/ccc/ccc.nix b/modules/utility/ccc/ccc.nix index dab4ec98..f900b531 100644 --- a/modules/utility/ccc/ccc.nix +++ b/modules/utility/ccc/ccc.nix @@ -1,5 +1,6 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkMappingOption; + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; in { options.vim.utility.ccc = { enable = mkEnableOption "ccc color picker for neovim"; diff --git a/modules/utility/ccc/config.nix b/modules/utility/ccc/config.nix index 5318d02a..a9589bb7 100644 --- a/modules/utility/ccc/config.nix +++ b/modules/utility/ccc/config.nix @@ -3,20 +3,17 @@ lib, ... }: let - inherit (lib) addDescriptionsToMappings mkIf nvim; + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.utility.ccc; - self = import ./ccc.nix {inherit lib;}; - - mappingDefinitions = self.options.vim.utility.ccc.mappings; - mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions; in { config = mkIf (cfg.enable) { vim.startPlugins = [ "ccc" ]; - vim.luaConfigRC.ccc = nvim.dag.entryAnywhere '' + vim.luaConfigRC.ccc = entryAnywhere '' local ccc = require("ccc") ccc.setup { highlighter = { diff --git a/modules/utility/diffview/config.nix b/modules/utility/diffview/config.nix index a5728053..ffe8a580 100644 --- a/modules/utility/diffview/config.nix +++ b/modules/utility/diffview/config.nix @@ -3,7 +3,7 @@ lib, ... }: let - inherit (lib) mkIf nvim; + inherit (lib.modules) mkIf; cfg = config.vim.utility.diffview-nvim; in { @@ -12,9 +12,5 @@ in { "diffview-nvim" "plenary-nvim" ]; - - vim.luaConfigRC.diffview-nvim = - nvim.dag.entryAnywhere '' - ''; }; } diff --git a/modules/utility/diffview/diffview.nix b/modules/utility/diffview/diffview.nix index 4830aba1..74ddd574 100644 --- a/modules/utility/diffview/diffview.nix +++ b/modules/utility/diffview/diffview.nix @@ -1,5 +1,5 @@ {lib, ...}: let - inherit (lib) mkEnableOption; + inherit (lib.options) mkEnableOption; in { options.vim.utility.diffview-nvim = { enable = mkEnableOption "diffview-nvim: cycle through diffs for all modified files for any git rev"; diff --git a/modules/utility/gestures/gesture-nvim/config.nix b/modules/utility/gestures/gesture-nvim/config.nix index a9260512..62a89ce9 100644 --- a/modules/utility/gestures/gesture-nvim/config.nix +++ b/modules/utility/gestures/gesture-nvim/config.nix @@ -3,7 +3,9 @@ lib, ... }: let - inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetLuaBinding nvim; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.gestures.gesture-nvim; @@ -23,7 +25,7 @@ in { }) ]; - vim.luaConfigRC.gesture-nvim = nvim.dag.entryAnywhere '' + vim.luaConfigRC.gesture-nvim = entryAnywhere '' vim.opt.mouse = "a" local gesture = require("gesture") diff --git a/modules/utility/gestures/gesture-nvim/gesture-nvim.nix b/modules/utility/gestures/gesture-nvim/gesture-nvim.nix index bd963b3e..aad51dc8 100644 --- a/modules/utility/gestures/gesture-nvim/gesture-nvim.nix +++ b/modules/utility/gestures/gesture-nvim/gesture-nvim.nix @@ -1,5 +1,6 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkMappingOption; + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; in { options.vim.gestures.gesture-nvim = { enable = mkEnableOption "gesture-nvim: mouse gestures"; diff --git a/modules/utility/icon-picker/config.nix b/modules/utility/icon-picker/config.nix index 642c9a48..79cd3769 100644 --- a/modules/utility/icon-picker/config.nix +++ b/modules/utility/icon-picker/config.nix @@ -3,7 +3,8 @@ lib, ... }: let - inherit (lib) mkIf nvim; + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.utility.icon-picker; in { @@ -13,7 +14,7 @@ in { "dressing-nvim" ]; - vim.luaConfigRC.icon-picker = nvim.dag.entryAnywhere '' + vim.luaConfigRC.icon-picker = entryAnywhere '' require("icon-picker").setup({ disable_legacy_commands = true }) diff --git a/modules/utility/icon-picker/icon-picker.nix b/modules/utility/icon-picker/icon-picker.nix index 94e16be7..e91a4a6d 100644 --- a/modules/utility/icon-picker/icon-picker.nix +++ b/modules/utility/icon-picker/icon-picker.nix @@ -1,5 +1,5 @@ {lib, ...}: let - inherit (lib) mkEnableOption; + inherit (lib.options) mkEnableOption; in { options.vim.utility.icon-picker = { enable = mkEnableOption "nerdfonts icon picker for nvim"; diff --git a/modules/utility/motion/hop/config.nix b/modules/utility/motion/hop/config.nix index 34015dc5..94c4a8c7 100644 --- a/modules/utility/motion/hop/config.nix +++ b/modules/utility/motion/hop/config.nix @@ -3,7 +3,9 @@ lib, ... }: let - inherit (lib) addDescriptionsToMappings mkIf mkSetBinding nvim; + inherit (lib.modules) mkIf; + inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.utility.motion.hop; @@ -17,7 +19,7 @@ in { vim.maps.normal = mkSetBinding mappings.hop " HopPattern"; - vim.luaConfigRC.hop-nvim = nvim.dag.entryAnywhere '' + vim.luaConfigRC.hop-nvim = entryAnywhere '' require('hop').setup() ''; }; diff --git a/modules/utility/motion/hop/hop.nix b/modules/utility/motion/hop/hop.nix index ada8bc3f..6947ffc0 100644 --- a/modules/utility/motion/hop/hop.nix +++ b/modules/utility/motion/hop/hop.nix @@ -1,5 +1,6 @@ {lib, ...}: let - inherit (lib) mkMappingOption mkEnableOption; + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; in { options.vim.utility.motion.hop = { mappings = { diff --git a/modules/utility/motion/leap/config.nix b/modules/utility/motion/leap/config.nix index 4bfa3e89..f9a96553 100644 --- a/modules/utility/motion/leap/config.nix +++ b/modules/utility/motion/leap/config.nix @@ -3,7 +3,9 @@ lib, ... }: let - inherit (lib) mkIf mkMerge mkBinding nvim; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.binds) mkBinding; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.utility.motion.leap; in { @@ -35,7 +37,7 @@ in { (mkBinding cfg.mappings.leapFromWindow "(leap-from-window)" "Leap from window") ]; - vim.luaConfigRC.leap-nvim = nvim.dag.entryAnywhere '' + vim.luaConfigRC.leap-nvim = entryAnywhere '' require('leap').opts = { max_phase_one_targets = nil, highlight_unlabeled_phase_one_targets = false, diff --git a/modules/utility/motion/leap/leap.nix b/modules/utility/motion/leap/leap.nix index 6f00822d..a5d72432 100644 --- a/modules/utility/motion/leap/leap.nix +++ b/modules/utility/motion/leap/leap.nix @@ -1,32 +1,33 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkOption types; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) nullOr str; in { options.vim.utility.motion.leap = { enable = mkEnableOption "leap.nvim plugin (easy motion)"; mappings = { leapForwardTo = mkOption { - type = types.nullOr types.str; + type = nullOr str; description = "Leap forward to"; default = "s"; }; leapBackwardTo = mkOption { - type = types.nullOr types.str; + type = nullOr str; description = "Leap backward to"; default = "S"; }; leapForwardTill = mkOption { - type = types.nullOr types.str; + type = nullOr str; description = "Leap forward till"; default = "x"; }; leapBackwardTill = mkOption { - type = types.nullOr types.str; + type = nullOr str; description = "Leap backward till"; default = "X"; }; leapFromWindow = mkOption { - type = types.nullOr types.str; + type = nullOr str; description = "Leap from window"; default = "gs"; }; diff --git a/modules/utility/preview/glow/config.nix b/modules/utility/preview/glow/config.nix index aca57f02..cf1e4603 100644 --- a/modules/utility/preview/glow/config.nix +++ b/modules/utility/preview/glow/config.nix @@ -4,7 +4,11 @@ lib, ... }: let - inherit (lib) nvim mkIf mkMerge mkBinding pushDownDefault; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.binds) mkBinding; + inherit (lib.nvim.dag) entryAnywhere; + # TODO: move this to its own module + inherit (lib) pushDownDefault; cfg = config.vim.utility.preview.glow; self = import ./glow.nix { @@ -23,7 +27,7 @@ in { "pm" = "+Preview Markdown"; }; - vim.luaConfigRC.glow = nvim.dag.entryAnywhere '' + vim.luaConfigRC.glow = entryAnywhere '' require('glow').setup({ glow_path = "${pkgs.glow}/bin/glow" }); diff --git a/modules/utility/preview/glow/glow.nix b/modules/utility/preview/glow/glow.nix index 48434217..69f9f93d 100644 --- a/modules/utility/preview/glow/glow.nix +++ b/modules/utility/preview/glow/glow.nix @@ -1,5 +1,7 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkMappingOption mkRenamedOptionModule; + inherit (lib.modules) mkRenamedOptionModule; + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; in { imports = [ (mkRenamedOptionModule ["vim" "languages" "markdown" "glow" "enable"] ["vim" "utility" "preview" "glow" "enable"]) diff --git a/modules/utility/preview/markdown-preview/config.nix b/modules/utility/preview/markdown-preview/config.nix index b60f612b..750cf7e8 100644 --- a/modules/utility/preview/markdown-preview/config.nix +++ b/modules/utility/preview/markdown-preview/config.nix @@ -4,15 +4,17 @@ lib, ... }: let - inherit (lib) nvim mkIf concatMapStringsSep optionalString stringLength; - inherit (nvim.vim) mkVimBool; + inherit (lib.strings) optionalString stringLength concatMapStringsSep; + inherit (lib.modules) mkIf; + inherit (lib.nvim.vim) mkVimBool; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.utility.preview.markdownPreview; in { config = mkIf cfg.enable { vim.startPlugins = [pkgs.vimPlugins.markdown-preview-nvim]; - vim.configRC.markdown-preview = nvim.dag.entryAnywhere '' + vim.configRC.markdown-preview = entryAnywhere '' let g:mkdp_auto_start = ${mkVimBool cfg.autoStart} let g:mkdp_auto_close = ${mkVimBool cfg.autoClose} let g:mkdp_refresh_slow = ${mkVimBool cfg.lazyRefresh} diff --git a/modules/utility/preview/markdown-preview/markdown-preview.nix b/modules/utility/preview/markdown-preview/markdown-preview.nix index c3244b02..1d3b3939 100644 --- a/modules/utility/preview/markdown-preview/markdown-preview.nix +++ b/modules/utility/preview/markdown-preview/markdown-preview.nix @@ -1,54 +1,55 @@ {lib, ...}: let - inherit (lib) types mkEnableOption mkOption; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) bool str listOf; in { options.vim.utility.preview = { markdownPreview = { enable = mkEnableOption "Markdown preview in neovim with markdown-preview.nvim"; autoStart = mkOption { - type = types.bool; + type = bool; default = false; description = "Automatically open the preview window after entering a Markdown buffer"; }; autoClose = mkOption { - type = types.bool; + type = bool; default = true; description = "Automatically close the preview window after leaving a Markdown buffer"; }; lazyRefresh = mkOption { - type = types.bool; + type = bool; default = false; description = "Only update preview when saving or leaving insert mode"; }; filetypes = mkOption { - type = with types; listOf str; + type = listOf str; default = ["markdown"]; description = "Allowed filetypes"; }; alwaysAllowPreview = mkOption { - type = types.bool; + type = bool; default = false; description = "Allow preview on all filetypes"; }; broadcastServer = mkOption { - type = types.bool; + type = bool; default = false; description = "Allow for outside and network wide connections"; }; customIP = mkOption { - type = types.str; + type = str; default = ""; description = "IP-address to use"; }; customPort = mkOption { - type = types.str; + type = str; default = ""; description = "Port to use"; }; diff --git a/modules/utility/surround/config.nix b/modules/utility/surround/config.nix index 78ec0a85..e392d9a6 100644 --- a/modules/utility/surround/config.nix +++ b/modules/utility/surround/config.nix @@ -3,7 +3,9 @@ lib, ... }: let - inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetBinding nvim; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.utility.surround; self = import ./surround.nix {inherit lib config;}; @@ -16,7 +18,7 @@ in { "nvim-surround" ]; - luaConfigRC.surround = nvim.dag.entryAnywhere '' + luaConfigRC.surround = entryAnywhere '' require('nvim-surround').setup() ''; diff --git a/modules/utility/surround/surround.nix b/modules/utility/surround/surround.nix index 7b20fb4b..8024c9b4 100644 --- a/modules/utility/surround/surround.nix +++ b/modules/utility/surround/surround.nix @@ -3,67 +3,69 @@ config, ... }: let - inherit (lib) mkOption types mkIf mkDefault; + inherit (lib.modules) mkIf mkDefault; + inherit (lib.options) mkOption; + inherit (lib.types) bool nullOr str; in { options.vim.utility.surround = { enable = mkOption { - type = types.bool; + type = bool; default = false; description = "nvim-surround: add/change/delete surrounding delimiter pairs with ease. Note that the default mappings deviate from upstreeam to avoid conflicts with nvim-leap."; }; useVendoredKeybindings = mkOption { - type = types.bool; + type = bool; default = true; description = "Use alternative set of keybindings that avoids conflicts with other popular plugins, e.g. nvim-leap"; }; mappings = { insert = mkOption { - type = types.nullOr types.str; + type = nullOr str; default = "z"; description = "Add surround character around the cursor"; }; insertLine = mkOption { - type = types.nullOr types.str; + type = nullOr str; default = "Z"; description = "Add surround character around the cursor on new lines"; }; normal = mkOption { - type = types.nullOr types.str; + type = nullOr str; default = "gz"; description = "Surround motion with character"; }; normalCur = mkOption { - type = types.nullOr types.str; + type = nullOr str; default = "gZ"; description = "Surround motion with character on new lines"; }; normalLine = mkOption { - type = types.nullOr types.str; + type = nullOr str; default = "gzz"; description = "Surround line with character"; }; normalCurLine = mkOption { - type = types.nullOr types.str; + type = nullOr str; default = "gZZ"; description = "Surround line with character on new lines"; }; visual = mkOption { - type = types.nullOr types.str; + type = nullOr str; default = "gz"; description = "Surround selection with character"; }; visualLine = mkOption { - type = types.nullOr types.str; + type = nullOr str; default = "gZ"; description = "Surround selection with character on new lines"; }; delete = mkOption { - type = types.nullOr types.str; + type = nullOr str; default = "gzd"; description = "Delete surrounding character"; }; change = mkOption { - type = types.nullOr types.str; + type = nullOr str; default = "gzr"; description = "Change surrounding character"; }; diff --git a/modules/utility/telescope/config.nix b/modules/utility/telescope/config.nix index eb7a14e5..d9a156f0 100644 --- a/modules/utility/telescope/config.nix +++ b/modules/utility/telescope/config.nix @@ -4,7 +4,11 @@ lib, ... }: let - inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetBinding nvim pushDownDefault; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding; + inherit (lib.nvim.dag) entryAnywhere; + # TODO: move this to its own module + inherit (lib) pushDownDefault; cfg = config.vim.telescope; self = import ./telescope.nix {inherit lib;}; @@ -60,7 +64,7 @@ in { "fvc" = "Commits"; }; - vim.luaConfigRC.telescope = nvim.dag.entryAnywhere '' + vim.luaConfigRC.telescope = entryAnywhere '' local telescope = require('telescope') telescope.setup { defaults = { diff --git a/modules/utility/telescope/telescope.nix b/modules/utility/telescope/telescope.nix index 12ea8878..fd8d2f3f 100644 --- a/modules/utility/telescope/telescope.nix +++ b/modules/utility/telescope/telescope.nix @@ -1,5 +1,6 @@ {lib, ...}: let - inherit (lib) mkMappingOption mkEnableOption; + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; in { options.vim.telescope = { mappings = { diff --git a/modules/utility/wakatime/config.nix b/modules/utility/wakatime/config.nix index 69063e28..e6332d5d 100644 --- a/modules/utility/wakatime/config.nix +++ b/modules/utility/wakatime/config.nix @@ -4,7 +4,8 @@ pkgs, ... }: let - inherit (lib) mkIf nvim; + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.utility.vim-wakatime; in { @@ -13,7 +14,7 @@ in { pkgs.vimPlugins.vim-wakatime ]; - vim.configRC.vim-wakatime = nvim.dag.entryAnywhere '' + vim.configRC.vim-wakatime = entryAnywhere '' ${ if cfg.cli-package == null then "" diff --git a/modules/utility/wakatime/vim-wakatime.nix b/modules/utility/wakatime/vim-wakatime.nix index f0f42b9e..6b853821 100644 --- a/modules/utility/wakatime/vim-wakatime.nix +++ b/modules/utility/wakatime/vim-wakatime.nix @@ -3,13 +3,14 @@ pkgs, ... }: let - inherit (lib) mkEnableOption mkOption types; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) nullOr package; in { options.vim.utility.vim-wakatime = { enable = mkEnableOption "vim-wakatime: live code statistics"; cli-package = mkOption { - type = with types; nullOr package; + type = nullOr package; default = pkgs.wakatime; description = "The package that should be used for wakatime-cli. Set as null to use the default path in `$XDG_DATA_HOME`"; }; diff --git a/modules/visuals/config.nix b/modules/visuals/config.nix index 8cd4ecfc..f920cd38 100644 --- a/modules/visuals/config.nix +++ b/modules/visuals/config.nix @@ -3,14 +3,18 @@ lib, ... }: let - inherit (lib) mkIf mkMerge nvim optionalString boolToString mkBinding; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.strings) optionalString; + inherit (lib.trivial) boolToString; + inherit (lib.nvim.binds) mkBinding; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.visuals; in { config = mkIf cfg.enable (mkMerge [ (mkIf cfg.indentBlankline.enable { vim.startPlugins = ["indent-blankline"]; - vim.luaConfigRC.indent-blankline = nvim.dag.entryAnywhere '' + vim.luaConfigRC.indent-blankline = entryAnywhere '' -- highlight error: https://github.com/lukas-reineke/indent-blankline.nvim/issues/59 -- vim.wo.colorcolumn = "99999" vim.opt.list = true @@ -42,7 +46,7 @@ in { (mkIf cfg.cursorline.enable { vim.startPlugins = ["nvim-cursorline"]; - vim.luaConfigRC.cursorline = nvim.dag.entryAnywhere '' + vim.luaConfigRC.cursorline = entryAnywhere '' require('nvim-cursorline').setup { cursorline = { timeout = ${toString cfg.cursorline.lineTimeout}, @@ -58,7 +62,7 @@ in { (mkIf cfg.scrollBar.enable { vim.startPlugins = ["scrollbar-nvim"]; - vim.luaConfigRC.scrollBar = nvim.dag.entryAnywhere '' + vim.luaConfigRC.scrollBar = entryAnywhere '' require('scrollbar').setup{ excluded_filetypes = { 'prompt', @@ -77,7 +81,7 @@ in { (mkIf cfg.smoothScroll.enable { vim.startPlugins = ["cinnamon-nvim"]; - vim.luaConfigRC.smoothScroll = nvim.dag.entryAnywhere '' + vim.luaConfigRC.smoothScroll = entryAnywhere '' require('cinnamon').setup() ''; }) @@ -87,7 +91,7 @@ in { vim.maps.normal = mkBinding cfg.cellularAutomaton.mappings.makeItRain "CellularAutomaton make_it_rain" "Make it rain"; - vim.luaConfigRC.cellularAUtomaton = nvim.dag.entryAnywhere '' + vim.luaConfigRC.cellularAUtomaton = entryAnywhere '' local config = { fps = 50, name = 'slide', @@ -115,7 +119,7 @@ in { (mkIf cfg.highlight-undo.enable { vim.startPlugins = ["highlight-undo"]; - vim.luaConfigRC.highlight-undo = nvim.dag.entryAnywhere '' + vim.luaConfigRC.highlight-undo = entryAnywhere '' require('highlight-undo').setup({ duration = ${toString cfg.highlight-undo.duration}, highlight_for_count = ${boolToString cfg.highlight-undo.highlightForCount}, diff --git a/modules/visuals/fidget/config.nix b/modules/visuals/fidget/config.nix index cb212db2..cde2f63a 100644 --- a/modules/visuals/fidget/config.nix +++ b/modules/visuals/fidget/config.nix @@ -3,14 +3,17 @@ lib, ... }: let - inherit (lib) mkIf nvim; + inherit (lib.modules) mkIf; + inherit (lib.nvim.lua) toLuaObject; + inherit (lib.nvim.dag) entryAnywhere; + cfg = config.vim.visuals.fidget-nvim; in { config = mkIf cfg.enable { vim.startPlugins = ["fidget-nvim"]; - vim.luaConfigRC.fidget-nvim = nvim.dag.entryAnywhere '' - require'fidget'.setup(${nvim.lua.toLuaObject cfg.setupOpts}) + vim.luaConfigRC.fidget-nvim = entryAnywhere '' + require'fidget'.setup(${toLuaObject cfg.setupOpts}) ''; }; } diff --git a/modules/visuals/fidget/fidget.nix b/modules/visuals/fidget/fidget.nix index 173cfd8d..482391ae 100644 --- a/modules/visuals/fidget/fidget.nix +++ b/modules/visuals/fidget/fidget.nix @@ -3,7 +3,13 @@ lib, ... }: let - inherit (lib) mkRemovedOptionModule mkEnableOption mkOption mapAttrs toUpper nvim types mkRenamedOptionModule; + inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.attrsets) mapAttrs; + inherit (lib.strings) toUpper; + inherit (lib.types) int float bool str enum listOf attrsOf; + inherit (lib.nvim.types) mkPluginSetupOption; + rawLua = lua: {__raw = lua;}; in { imports = [ @@ -15,31 +21,31 @@ in { options.vim.visuals.fidget-nvim = { enable = mkEnableOption "nvim LSP UI element [fidget-nvim]"; - setupOpts = nvim.types.mkPluginSetupOption "Fidget" { + setupOpts = mkPluginSetupOption "Fidget" { progress = { poll_rate = mkOption { description = "How frequently to poll for LSP progress messages"; - type = types.int; + type = int; default = 0; }; suppress_on_insert = mkOption { description = "Suppress new messages when in insert mode"; - type = types.bool; + type = bool; default = false; }; ignore_done_already = mkOption { description = "Ignore new tasks that are already done"; - type = types.bool; + type = bool; default = false; }; ignore_empty_message = mkOption { description = "Ignore new tasks with empty messages"; - type = types.bool; + type = bool; default = false; }; clear_on_detach = mkOption { description = "Clear notification group when LSP server detaches"; - type = types.bool; + type = bool; default = true; apply = clear: if clear @@ -54,7 +60,7 @@ in { }; notification_group = mkOption { description = "How to get a progress message's notification group key"; - type = types.str; + type = str; default = '' function(msg) return msg.lsp_client.name @@ -64,40 +70,40 @@ in { }; ignore = mkOption { description = "Ignore LSP servers by name"; - type = types.listOf types.str; + type = listOf str; default = []; }; display = { render_limit = mkOption { description = "Maximum number of messages to render"; - type = types.int; + type = int; default = 16; }; done_ttl = mkOption { description = "How long a message should persist when complete"; - type = types.int; + type = int; default = 3; }; done_icon = mkOption { description = "Icon shown when LSP progress tasks are completed"; - type = types.str; + type = str; default = "✓"; }; done_style = mkOption { description = "Highlight group for completed LSP tasks"; - type = types.str; + type = str; default = "Constant"; }; progress_ttl = mkOption { description = "How long a message should persist when in progress"; - type = types.int; + type = int; default = 99999; }; progress_icon = { pattern = mkOption { description = "Pattern shown when LSP progress tasks are in progress"; - type = types.enum [ + type = enum [ "dots" "dots_negative" "dots_snake" @@ -136,38 +142,38 @@ in { }; period = mkOption { description = "Period of the pattern"; - type = types.int; + type = int; default = 1; }; }; progress_style = mkOption { description = "Highlight group for in-progress LSP tasks"; - type = types.str; + type = str; default = "WarningMsg"; }; group_style = mkOption { description = "Highlight group for group name (LSP server name)"; - type = types.str; + type = str; default = "Title"; }; icon_style = mkOption { description = "Highlight group for group icons"; - type = types.str; + type = str; default = "Question"; }; priority = mkOption { description = "Priority of the progress notification"; - type = types.int; + type = int; default = 30; }; skip_history = mkOption { description = "Skip adding messages to history"; - type = types.bool; + type = bool; default = true; }; format_message = mkOption { description = "How to format a progress message"; - type = types.str; + type = str; default = '' require("fidget.progress.display").default_format_message ''; @@ -175,7 +181,7 @@ in { }; format_annote = mkOption { description = "How to format a progress annotation"; - type = types.str; + type = str; default = '' function(msg) return msg.title end ''; @@ -183,7 +189,7 @@ in { }; format_group_name = mkOption { description = "How to format a progress notification group's name"; - type = types.str; + type = str; default = '' function(group) return tostring(group) end ''; @@ -191,7 +197,7 @@ in { }; overrides = mkOption { description = "Override options from the default notification config"; - type = types.attrsOf types.str; + type = attrsOf str; default = {rust_analyzer = "{ name = 'rust-analyzer' }";}; apply = mapAttrs (key: lua: rawLua lua); }; @@ -200,12 +206,12 @@ in { lsp = { progress_ringbuf_size = mkOption { description = "Nvim's LSP client ring buffer size"; - type = types.int; + type = int; default = 100; }; log_handler = mkOption { description = "Log `$/progress` handler invocations"; - type = types.bool; + type = bool; default = false; }; }; @@ -214,34 +220,34 @@ in { notification = { poll_rate = mkOption { description = "How frequently to update and render notifications"; - type = types.int; + type = int; default = 10; }; filter = mkOption { description = "Minimum notifications level"; - type = types.enum ["debug" "info" "warn" "error"]; + type = enum ["debug" "info" "warn" "error"]; default = "info"; apply = filter: rawLua "vim.log.levels.${toUpper filter}"; }; history_size = mkOption { description = "Number of removed messages to retain in history"; - type = types.int; + type = int; default = 128; }; override_vim_notify = mkOption { description = "Automatically override vim.notify() with Fidget"; - type = types.bool; + type = bool; default = false; }; configs = mkOption { description = "How to configure notification groups when instantiated"; - type = types.attrsOf types.str; + type = attrsOf str; default = {default = "require('fidget.notification').default_config";}; apply = mapAttrs (key: lua: rawLua lua); }; redirect = mkOption { description = "Conditionally redirect notifications to another backend"; - type = types.str; + type = str; default = '' function(msg, level, opts) if opts and opts.on_open then @@ -255,27 +261,27 @@ in { view = { stack_upwards = mkOption { description = "Display notification items from bottom to top"; - type = types.bool; + type = bool; default = true; }; icon_separator = mkOption { description = "Separator between group name and icon"; - type = types.str; + type = str; default = " "; }; group_separator = mkOption { description = "Separator between notification groups"; - type = types.str; + type = str; default = "---"; }; group_separator_hl = mkOption { description = "Highlight group used for group separator"; - type = types.str; + type = str; default = "Comment"; }; render_message = mkOption { description = "How to render notification messages"; - type = types.str; + type = str; default = '' function(msg, cnt) return cnt == 1 and msg or string.format("(%dx) %s", cnt, msg) @@ -288,17 +294,17 @@ in { window = { normal_hl = mkOption { description = "Base highlight group in the notification window"; - type = types.str; + type = str; default = "Comment"; }; winblend = mkOption { description = "Background color opacity in the notification window"; - type = types.int; + type = int; default = 100; }; border = mkOption { description = "Border style of the notification window"; - type = types.enum ["none" "single" "double" "rounded" "solid" "shadow"]; + type = enum ["none" "single" "double" "rounded" "solid" "shadow"]; default = if config.vim.ui.borders.enable then config.vim.ui.borders.globalStyle @@ -306,37 +312,37 @@ in { }; zindex = mkOption { description = "Stacking priority of the notification window"; - type = types.int; + type = int; default = 45; }; max_width = mkOption { description = "Maximum width of the notification window"; - type = types.int; + type = int; default = 0; }; max_height = mkOption { description = "Maximum height of the notification window"; - type = types.int; + type = int; default = 0; }; x_padding = mkOption { description = "Padding from right edge of window boundary"; - type = types.int; + type = int; default = 1; }; y_padding = mkOption { description = "Padding from bottom edge of window boundary"; - type = types.int; + type = int; default = 0; }; align = mkOption { description = "How to align the notification window"; - type = types.enum ["top" "bottom"]; + type = enum ["top" "bottom"]; default = "bottom"; }; relative = mkOption { description = "What the notification window position is relative to"; - type = types.enum ["editor" "win"]; + type = enum ["editor" "win"]; default = "editor"; }; }; @@ -346,7 +352,7 @@ in { nvim-tree = { enable = mkOption { description = "Integrate with nvim-tree/nvim-tree.lua (if enabled)"; - type = types.bool; + type = bool; default = if config.vim.filetree.nvimTree.enable then true @@ -356,7 +362,7 @@ in { xcodebuild-nvim = { enable = mkOption { description = "Integrate with wojciech-kulik/xcodebuild.nvim (if enabled)"; - type = types.bool; + type = bool; default = true; }; }; @@ -365,23 +371,23 @@ in { logger = { level = mkOption { description = "Minimum logging level"; - type = types.enum ["debug" "error" "info" "trace" "warn" "off"]; + type = enum ["debug" "error" "info" "trace" "warn" "off"]; default = "warn"; apply = logLevel: rawLua "vim.log.levels.${toUpper logLevel}"; }; max_size = mkOption { description = "Maximum log file size, in KB"; - type = types.int; + type = int; default = 10000; }; float_precision = mkOption { description = "Limit the number of decimals displayed for floats"; - type = types.float; + type = float; default = 0.01; }; path = mkOption { description = "Where Fidget writes its logs to"; - type = types.str; + type = str; default = '' string.format("%s/fidget.nvim.log", vim.fn.stdpath("cache")) ''; diff --git a/modules/visuals/visuals.nix b/modules/visuals/visuals.nix index 4fde5885..60ab9071 100644 --- a/modules/visuals/visuals.nix +++ b/modules/visuals/visuals.nix @@ -3,7 +3,10 @@ lib, ... }: let - inherit (lib) mkEnableOption mkMappingOption mkOption types literalExpression mkRenamedOptionModule mkRemovedOptionModule; + inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule; + inherit (lib.options) mkEnableOption mkOption literalExpression; + inherit (lib.types) int bool str nullOr; + inherit (lib.nvim.binds) mkMappingOption; cfg = config.vim.visuals; in { @@ -34,13 +37,13 @@ in { enable = mkEnableOption "line hightlighting on the cursor [nvim-cursorline]"; lineTimeout = mkOption { - type = types.int; + type = int; description = "Time in milliseconds for cursorline to appear"; default = 0; }; lineNumbersOnly = mkOption { - type = types.bool; + type = bool; description = "Hightlight only in the presence of line numbers"; default = true; }; @@ -49,21 +52,21 @@ in { indentBlankline = { enable = mkEnableOption "indentation guides [indent-blankline]"; debounce = mkOption { - type = types.int; + type = int; description = "Debounce time in milliseconds"; default = 200; }; viewportBuffer = { min = mkOption { - type = types.int; + type = int; description = "Number of lines above and below of what is currently visible in the window"; default = 30; }; max = mkOption { - type = types.int; + type = int; description = "Number of lines above and below of what is currently visible in the window"; default = 500; @@ -72,34 +75,34 @@ in { indent = { char = mkOption { - type = types.str; + type = str; description = "Character for indentation line"; default = "│"; }; }; listChar = mkOption { - type = types.str; + type = str; description = "Character for indentation line"; default = "│"; }; fillChar = mkOption { description = "Character to fill indents"; - type = with types; nullOr types.str; + type = nullOr str; default = "⋅"; }; eolChar = mkOption { description = "Character at end of line"; - type = with types; nullOr types.str; + type = nullOr str; default = "↴"; }; scope = { enabled = mkOption { description = "Highlight current scope from treesitter"; - type = types.bool; + type = bool; default = config.vim.treesitter.enable; defaultText = literalExpression "config.vim.treesitter.enable"; }; @@ -109,7 +112,7 @@ in { Displays the end of line character set by [](#opt-vim.visuals.indentBlankline.eolChar) instead of the indent guide on line returns. ''; - type = types.bool; + type = bool; default = cfg.indentBlankline.eolChar != null; defaultText = literalExpression "config.vim.visuals.indentBlankline.eolChar != null"; }; @@ -120,7 +123,7 @@ in { enable = mkEnableOption "highlight undo [highlight-undo]"; highlightForCount = mkOption { - type = types.bool; + type = bool; default = true; description = '' Enable support for highlighting when a is provided before the key @@ -129,14 +132,14 @@ in { }; duration = mkOption { - type = types.int; + type = int; description = "Duration of highlight"; default = 500; }; undo = { hlGroup = mkOption { - type = types.str; + type = str; description = "Highlight group for undo"; default = "HighlightUndo"; }; @@ -144,7 +147,7 @@ in { redo = { hlGroup = mkOption { - type = types.str; + type = str; description = "Highlight group for redo"; default = "HighlightUndo"; };