mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
Compare commits
211 commits
56a8476bc1
...
8997e62b3b
Author | SHA1 | Date | |
---|---|---|---|
|
8997e62b3b | ||
|
8ff50562d7 | ||
|
0947ab38c0 | ||
|
e77632e4eb | ||
614ad33a60 | |||
fdd0642c7d | |||
379d2a9f16 | |||
|
f01e404b2e | ||
|
cc14a1c1f6 | ||
|
108cfd8383 | ||
9ea9995b92 | |||
7417c6e4f3 | |||
3cba3ca30c | |||
c727528b6f | |||
38fc01b9c6 | |||
d6bbae1a91 | |||
cef3aefabb | |||
|
69cd77630b | ||
bce45d4eeb | |||
ccea1a6159 | |||
ab9a7c1600 | |||
|
c957b23aaa | ||
|
b4c06c71dc | ||
a56a83bd46 | |||
|
8e96f0aaa3 | ||
316f25a0f6 | |||
842b45b969 | |||
27b3524508 | |||
a85ac83182 | |||
|
57be605ed4 | ||
|
99ace503ad | ||
e40d7a2a56 | |||
cb7ff874e2 | |||
eb037b7bff | |||
|
b9dcbec29c | ||
|
b499151527 | ||
b347757f8a | |||
99de583e21 | |||
|
9eb6159ca3 | ||
|
67abc51902 | ||
c757d28ff7 | |||
|
e949a51c55 | ||
|
473ebea4cf | ||
|
fc2e5998e7 | ||
|
25fe1c4625 | ||
fd90cf7fd5 | |||
|
7d824d6711 | ||
|
de20ff2c51 | ||
|
fd65c83956 | ||
773186d93d | |||
|
0984e84444 | ||
|
21f4e5b9ab | ||
|
589b86d378 | ||
2b8d0af2e6 | |||
8b15271f63 | |||
|
f9789432f9 | ||
|
cbff0e4715 | ||
|
9c93e9a9c0 | ||
|
0f17147d52 | ||
a4d35b4419 | |||
|
1426c83ce6 | ||
|
f6a058d1ed | ||
|
ce0b361bca | ||
5fab82ba91 | |||
|
32d231395f | ||
|
901363d1ac | ||
|
0c444830f6 | ||
|
9b48c30e20 | ||
|
82d67cbc66 | ||
0dca62eaa2 | |||
d33fdda463 | |||
|
8071bfdb72 | ||
|
8d5f23035d | ||
|
f1849c0ce5 | ||
|
3f5ed9e979 | ||
|
9c4aabd0a6 | ||
|
a20d860b45 | ||
|
72ff44c1eb | ||
|
dde2b5cac4 | ||
|
d9a62eff17 | ||
|
7df75f5b55 | ||
|
71064e8865 | ||
|
42447cd3bf | ||
|
c66854fc7f | ||
|
187d924509 | ||
|
415954595e | ||
|
83b7632297 | ||
|
c96181e739 | ||
|
506b29c726 | ||
954470581e | |||
b0af809b95 | |||
1bb901edeb | |||
|
bb2a78272b | ||
155bc8e1cc | |||
|
a145f997f3 | ||
688a457a3d | |||
|
c2c85d70ee | ||
335fbea0c0 | |||
|
216cb34caf | ||
|
2e99a21010 | ||
7b719d0044 | |||
ba803c8684 | |||
f00ecd4eb9 | |||
35c7327f81 | |||
|
8a0cddd9bb | ||
923481640e | |||
2759b9caae | |||
|
abdcb62941 | ||
|
d873bc0667 | ||
f66c40b687 | |||
|
ad22bca3d7 | ||
95615ec308 | |||
|
d6cd853520 | ||
a86c59457c | |||
|
a437dbd158 | ||
c1b3900846 | |||
|
9cff1b03d6 | ||
dfa2718bb3 | |||
fcab30e7bb | |||
|
68b0647936 | ||
c50522f6b0 | |||
ae45cdf92a | |||
|
8eb8326bd6 | ||
200a45ec73 | |||
|
08547724e4 | ||
5748bb5eb9 | |||
|
367320dcd9 | ||
|
fc4e471490 | ||
|
1061c920be | ||
9bbdb8d48a | |||
f9343f1bc7 | |||
6624841e63 | |||
|
9baebb0d82 | ||
|
2c9a9b4d29 | ||
|
68ca227a87 | ||
|
69257c03a3 | ||
|
ac20dfbdd4 | ||
9074b6e5e7 | |||
|
011f662fa0 | ||
f59a915da9 | |||
60d9ebb3f0 | |||
bb06827474 | |||
|
af72dc105d | ||
9d0247c599 | |||
f0f2c08e9f | |||
cfbed8ceb1 | |||
1ce25d7ca3 | |||
eefc7a9d1d | |||
74c94b8a54 | |||
74df3a5f03 | |||
|
7224c1e6af | ||
|
f343ab8b3a | ||
|
208d1e6741 | ||
493854e44f | |||
|
cc0aba4e21 | ||
|
db810bbf9f | ||
1fd4a2a1b8 | |||
7cafa56cdb | |||
b5f38b8e5e | |||
355d4830e5 | |||
|
8aa3a23e97 | ||
|
7d9f1e0481 | ||
|
82e92a56da | ||
|
981fe07075 | ||
2615c568f8 | |||
407ecf00d5 | |||
7c1a8e2c1e | |||
ea5f229efd | |||
41f7abcdc3 | |||
a85bf963e6 | |||
26755a6b93 | |||
96b92b5652 | |||
544c98a03b | |||
e96897f6b3 | |||
12fd9d69dc | |||
|
dc0fa76295 | ||
e0790f2bdb | |||
bf090172d2 | |||
7481423bed | |||
6eba2a5585 | |||
1847b9f1bf | |||
d06ff3d7db | |||
|
83583e9b64 | ||
efd8b44ce1 | |||
|
9fe96ce010 | ||
a777941eed | |||
a20f84edfb | |||
|
666de6a5be | ||
|
3ad560ea30 | ||
|
2c37513012 | ||
ab2685579a | |||
5b982fafa0 | |||
d25492788c | |||
|
e1edeb5189 | ||
|
4df41ae0d0 | ||
0ae4408fd8 | |||
32615fca69 | |||
768449eff7 | |||
4d41469b3d | |||
fbc138a51b | |||
d5fde3f445 | |||
|
90ee038794 | ||
f66a879dce | |||
|
ee240a1483 | ||
94ffd5ec9f | |||
|
4056deb411 | ||
6e8bb14567 | |||
2a37873f8a | |||
a12a26e405 | |||
d2d2c2a227 | |||
fde298805c |
181 changed files with 4820 additions and 3063 deletions
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
|
@ -16,7 +16,7 @@ If you have any questions regarding those files, feel free to open an issue or [
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
The contribution process is mostly documented in the [pull request template](.github/pull_request_template.md). You will find a checklist of items to complete before submitting a pull request. Please make sure you complete it before submitting a pull request. If you are unsure about any of the items, please ask.
|
The contribution process is mostly documented in the [pull request template](pull_request_template.md). You will find a checklist of items to complete before submitting a pull request. Please make sure you complete it before submitting a pull request. If you are unsure about any of the items, please ask.
|
||||||
|
|
||||||
### Guidelines
|
### Guidelines
|
||||||
|
|
||||||
|
|
4
.github/FUNDING.yml
vendored
Normal file
4
.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
github: NotAShelf
|
||||||
|
ko_fi: NotAShelf
|
||||||
|
liberapay: NotAShelf
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
# Description
|
|
||||||
|
|
||||||
A clear and concise description of the aim of your Pull Request.
|
|
||||||
|
|
||||||
**If your pull request aims to fix an open issue or a present bug, please link the relevant issue below. If not, please remove this section**
|
|
||||||
Fixes #(issue)
|
|
||||||
|
|
||||||
## Type of change
|
|
||||||
|
|
||||||
Please delete any options that are not relevant.
|
|
||||||
|
|
||||||
- Bug fix (non-breaking change which fixes an issue)
|
|
||||||
- New feature (non-breaking change which adds functionality)
|
|
||||||
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
||||||
- Translation/Language update
|
|
||||||
- Docs
|
|
||||||
- Other
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
|
|
||||||
Please try to check at least a majority of the checklist before opening your pull request. Exceptions to this will be reviewed on a case by case basis.
|
|
||||||
|
|
||||||
- [ ] My code follows the style and contributing guidelines of this project.
|
|
||||||
- [ ] I ran Alejandra to format my code (`nix fmt`).
|
|
||||||
- [ ] I have performed a self-review of my own code and tested it.
|
|
||||||
- [ ] I have commented my code, particularly in hard-to-understand areas.
|
|
||||||
- [ ] My changes generate no new warnings.
|
|
||||||
- [ ] This change requires a documentation update.
|
|
||||||
- [ ] I have updated the documentation accordingly.
|
|
||||||
|
|
||||||
## Screenshots & Logs
|
|
||||||
|
|
||||||
You are kindly requested to attach screenshots of your changes in actions and preferably your build/run logs for all available packages. If you are not sure how to do this, you can refer to the [documentation](https://notashelf.github.io/neovim-flake/).
|
|
||||||
|
|
||||||
**Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.**
|
|
||||||
|
|
||||||
```console
|
|
||||||
# Paste your logs here
|
|
||||||
```
|
|
216
.github/README.md
vendored
216
.github/README.md
vendored
|
@ -1,9 +1,11 @@
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<img src="assets/nvf-logo-work.svg" alt="nvf Logo" width="200">
|
<img src="assets/nvf-logo-work.svg" alt="nvf Logo" width="200">
|
||||||
|
<br/>
|
||||||
|
<h1>nvf</h1>
|
||||||
</div>
|
</div>
|
||||||
<h1 align="center">❄️ nvf</h1>
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<p>
|
<p>
|
||||||
<a href="https://github.com/NotAShelf/nvf/releases/latest">
|
<a href="https://github.com/NotAShelf/nvf/releases/latest">
|
||||||
<img alt="Latest release" src="https://img.shields.io/github/v/release/NotAShelf/nvf?style=for-the-badge&logo=nixos&color=C9CBFF&logoColor=D9E0EE&labelColor=302D41" />
|
<img alt="Latest release" src="https://img.shields.io/github/v/release/NotAShelf/nvf?style=for-the-badge&logo=nixos&color=C9CBFF&logoColor=D9E0EE&labelColor=302D41" />
|
||||||
</a>
|
</a>
|
||||||
|
@ -22,7 +24,8 @@
|
||||||
<a href="https://github.com/NotAShelf/nvf">
|
<a href="https://github.com/NotAShelf/nvf">
|
||||||
<img alt="Repo Size" src="https://img.shields.io/github/repo-size/NotAShelf/nvf?color=%23DDB6F2&label=SIZE&logo=codesandbox&style=for-the-badge&logoColor=D9E0EE&labelColor=302D41" />
|
<img alt="Repo Size" src="https://img.shields.io/github/repo-size/NotAShelf/nvf?color=%23DDB6F2&label=SIZE&logo=codesandbox&style=for-the-badge&logoColor=D9E0EE&labelColor=302D41" />
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://stars.medv.io/NotAShelf/nvf.svg", title="stars"/>
|
<img src="https://stars.medv.io/NotAShelf/nvf.svg", title="stars"/>
|
||||||
|
@ -30,34 +33,17 @@
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<a>
|
<a>
|
||||||
A highly modular, configurable, extensible and easy to use Neovim configuration
|
nvf is a highly modular, configurable, extensible and easy to use Neovim configuration
|
||||||
framework in Nix. Designed for flexibility and ease of use, this flake
|
in Nix. Designed for flexibility and ease of use, nvf allows you to easily configure
|
||||||
allows you to easily configure your Neovim instance with a few lines of
|
your fully featured Neovim instance with a few lines of Nix.
|
||||||
Nix code.
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
|
||||||
|
|
||||||
> [!WARNING]
|
|
||||||
> Main branch is only updated for small, non-breaking changes. For the latest version of neovim-flake, please see
|
|
||||||
> [the list of branches](https://github.com/NotAShelf/neovim-flake/branches) or
|
|
||||||
> [open pull requests](https://github.com/NotAShelf/neovim-flake/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc).
|
|
||||||
> neovim-flake, at the time, is still being actively developed - and will continue to be so for the foreseeable
|
|
||||||
> future.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<div align="center"><p>
|
<div align="center"><p>
|
||||||
|
|
||||||
**[<kbd> <br> Get Started <br> </kbd>][Get Started]**
|
[Features]: #features
|
||||||
**[<kbd> <br> Documentation <br> </kbd>][Documentation]**
|
|
||||||
**[<kbd> <br> Help <br> </kbd>][Help]**
|
|
||||||
**[<kbd> <br> Contribute <br> </kbd>][Contribute]**
|
|
||||||
**[<kbd> <br> FAQ <br> </kbd>][Faq]**
|
|
||||||
**[<kbd> <br> Credits <br> </kbd>][Credits]**
|
|
||||||
|
|
||||||
</p></div>
|
|
||||||
|
|
||||||
[Get Started]: #get-started
|
[Get Started]: #get-started
|
||||||
[Documentation]: #documentation
|
[Documentation]: #documentation
|
||||||
[Help]: #help
|
[Help]: #help
|
||||||
|
@ -65,100 +51,156 @@
|
||||||
[FAQ]: #faq
|
[FAQ]: #faq
|
||||||
[Credits]: #credits
|
[Credits]: #credits
|
||||||
|
|
||||||
|
**[<kbd><br> Features <br></kbd>][Features]**
|
||||||
|
**[<kbd><br> Get Started <br></kbd>][Get Started]**
|
||||||
|
**[<kbd><br> Documentation <br></kbd>][Documentation]**
|
||||||
|
**[<kbd><br> Help <br></kbd>][Help]**
|
||||||
|
**[<kbd><br> Contribute <br></kbd>][Contribute]**
|
||||||
|
**[<kbd><br> FAQ <br></kbd>][Faq]** **[<kbd><br> Credits <br></kbd>][Credits]**
|
||||||
|
|
||||||
|
</p></div>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- **Reproducible**: Your configuration will behave the same _anywhere_. No
|
||||||
|
surprises, promise!
|
||||||
|
- **Portable**: nvf depends _solely_ on your Nix store, and nothing else. No
|
||||||
|
more global binaries! Works on all platforms, without hassle.
|
||||||
|
- **Customizable**: There are _almost no defaults_ to annoy you. nvf is fully
|
||||||
|
customizable through the Nix module system.
|
||||||
|
- **Well-documented**: Documentation is priority. You will _never_ face
|
||||||
|
undocumented, obscure behaviour.
|
||||||
|
- **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and
|
||||||
|
will, remain maintainable for myself and any contributors.
|
||||||
|
|
||||||
## Get Started
|
## Get Started
|
||||||
|
|
||||||
### Using `nix` CLI
|
[nvf manual]: https://notashelf.github.io/nvf/
|
||||||
|
[issue tracker]: https://github.com/NotAShelf/nvf/issues
|
||||||
|
|
||||||
If you would like to try out the configuration before even thinking about
|
If you are not sold on the concepts of **nvf**, and would like to try out the
|
||||||
installing it, you can run the following command
|
default configuration before even _thinking about_ installing it, you may run
|
||||||
|
the following in order to take **nvf** out for a spin.
|
||||||
|
|
||||||
```console
|
```bash
|
||||||
|
# Run the default package
|
||||||
nix run github:notashelf/nvf
|
nix run github:notashelf/nvf
|
||||||
```
|
```
|
||||||
|
|
||||||
This will get you a feel for the base configuration and UI design.
|
This will get you a feel for the base configuration and UI design. Though, none
|
||||||
The flake exposes `#nix` as the default package, providing minimal
|
of the configuration options are final as **nvf** is designed to be modular and
|
||||||
language support and various utilities.You may also use `#nix`,
|
configurable.
|
||||||
`#tidal` or `#maximal` to get try out different configurations.
|
|
||||||
|
|
||||||
It is as simple as changing the target output to get a different
|
> [!TIP]
|
||||||
configuration. For example, to get a configuration with `tidal` support, run:
|
> The flake exposes `#nix` as the default package, providing minimal language
|
||||||
|
> support and various utilities. You may also use the `#nix` or `#maximal`
|
||||||
|
> packages provided by the this flake to get try out different configurations.
|
||||||
|
|
||||||
```console
|
It is as simple as changing the target output to get a different configuration.
|
||||||
nix run github:notashelf/nvf#tidal
|
For example, to get a configuration with large language coverage, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run the maximal package
|
||||||
|
nix run github:notashelf/nvf#maximal
|
||||||
```
|
```
|
||||||
|
|
||||||
Similar instructions will apply for `nix profile install`. However, you are
|
Similar instructions will apply for `nix profile install`. However, you are
|
||||||
recommended to instead use the module system as described in the manual.
|
recommended to instead use the module system as described in the manual.
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> The `maximal` configuration is _massive_ and will take a while to build.
|
> The `maximal` configuration is quite large, and might take a while to build.
|
||||||
> To get a feel for the configuration, use the default `nix` or `tidal`
|
> To get a feel for the configuration, use the default `nix` configuration.
|
||||||
> configurations. Should you choose to try out the `maximal` configuration,
|
> Should you choose to try out the `maximal` configuration, using the binary
|
||||||
> using the binary cache as described in the manual is _strongly_ recommended.
|
> cache as described in the manual is _strongly_ recommended.
|
||||||
|
|
||||||
|
If you are convinced, proceed to the next section to view the installation
|
||||||
|
instructions.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
See the [**nvf** Manual](https://notashelf.github.io/nvf/) for
|
The _recommended_ way of installing **nvf** is using either the NixOS or the
|
||||||
detailed installation guides, configurations, available options, release notes
|
Home-Manager module, though it is completely possible and no less supported to
|
||||||
and more. Tips for installing userspace plugins is also contained in the
|
install **nvf** as a standalone package, or a flake output.
|
||||||
documentation.
|
|
||||||
|
|
||||||
If you want to dive right into trying **nvf** you can get a fully
|
See the rendered [nvf manual] for detailed and up-to-date installation guides,
|
||||||
featured configuration with `nix` language support by running:
|
configurations, available options, release notes and more. Tips for installing
|
||||||
|
userspace plugins is also contained in the documentation.
|
||||||
|
|
||||||
```console
|
> [!TIP]
|
||||||
nix run github:notashelf/nvf#nix
|
> While using NixOS or Home-Manager modules,
|
||||||
```
|
> `programs.nvf.enableManpages = true;` will allow you to view option
|
||||||
|
> documentation from the comfort of your terminal via `man 5 nvf`. The more you
|
||||||
|
> know.
|
||||||
|
|
||||||
Please create an issue on the [issue tracker](../../../issues) if you find
|
Please create an issue on the [issue tracker] if you find the documentation
|
||||||
the documentation lacking or confusing. I also appreciate any contributions
|
lacking or confusing. Any improvements to the documentation through pull
|
||||||
to the documentation.
|
requests are also welcome, and appreciated.
|
||||||
|
|
||||||
## Help
|
## Help
|
||||||
|
|
||||||
You can create an issue on the [issue tracker](../../../issues) to ask questions
|
You can create an issue on the [issue tracker] to ask questions or report bugs.
|
||||||
or report bugs. I am not yet on spaces like matrix or IRC, so please use the issue
|
I am not yet on spaces like matrix or IRC, so please use the issue tracker for
|
||||||
tracker for now.
|
now.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
I am always looking for new ways to help improve this flake. If you would like
|
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
|
to contribute, please read the [contributing guide](CONTRIBUTING.md) before
|
||||||
submitting a pull request. You can also create an issue on the
|
submitting a pull request. You can also create an issue on the [issue tracker]
|
||||||
[issue tracker](../../../issues) before submitting a pull request if you would
|
before submitting a pull request if you would like to discuss a feature or bug
|
||||||
like to discuss a feature or bug fix.
|
fix.
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
|
[appropriate issue template]: https://github.com/NotAShelf/nvf/issues/new/choose
|
||||||
|
[list of branches]: https://github.com/NotAShelf/nvf/branches
|
||||||
|
[list of open pull requests]: https://github.com/NotAShelf/nvf/pulls
|
||||||
|
|
||||||
|
**Q**: What platforms are supported?
|
||||||
|
<br/> **A**: nvf actively supports Linux and Darwin platforms using standalone
|
||||||
|
Nix, NixOS or Home-Manager. Please take a look at the
|
||||||
|
|
||||||
**Q**: Can you add _X_?
|
**Q**: Can you add _X_?
|
||||||
<br/>
|
<br/> **A**: Maybe! It is not one of our goals to support each and every Neovim
|
||||||
**A**: Maybe! It is not one of our goals to support each and every Neovim
|
plugin, however, I am always open to new modules and plugin setup additions to
|
||||||
plugin, however, I am always open to new modules and plugin setup additions
|
**nvf**. Use the [appropriate issue template] and I will consider a module
|
||||||
to **nvf**. Use the [appropritate issue
|
addition. As mentioned before, PRs adding new features are also welcome.
|
||||||
template](https://github.com/NotAShelf/nvf/issues/new/choose) and I will
|
|
||||||
consider a module addition.
|
|
||||||
|
|
||||||
**Q**: A plugin I need is not available in **nvf**. What to do?
|
**Q**: A plugin I need is not available in **nvf**. What to do?
|
||||||
<br/>
|
<br/> **A**: **nvf** exposes several APIs for you to be able to add your own
|
||||||
**A**: **nvf** exposes several APIs for you to be able to add your own
|
plugin configurations! Please see the documentation on how you may do this.
|
||||||
plugin configurations! Please see the documentation on how you may do
|
|
||||||
this.
|
**Q**: Main branch is awfully silent, is the project dead?
|
||||||
|
<br/> **A**: No! Sometimes we branch out (e.g. `v0.6`) to avoid breaking
|
||||||
|
userspace and work in a separate branch until we make sure the new additions are
|
||||||
|
implemented in the most comfortable way possible for the end user. If you have
|
||||||
|
not noticed any activity on the main branch, consider taking a look at the
|
||||||
|
[list of branches] or the [list of open pull requests]. You may also consider
|
||||||
|
_testing_ those release branches to get access to new features ahead of time and
|
||||||
|
better prepare to breaking changes.
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
### Contributors
|
### Contributors
|
||||||
|
|
||||||
Special thanks to
|
Special, heart-felt thanks to
|
||||||
|
|
||||||
- [@fufexan](https://github.com/fufexan) - For the transition to flake-parts
|
- [@fufexan](https://github.com/fufexan) - For the transition to flake-parts
|
||||||
- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to work
|
- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to
|
||||||
- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally possible
|
work
|
||||||
- [@horriblename](https://github.com/horriblename) - For actively implementing planned features and quality of life updates
|
- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally
|
||||||
|
possible
|
||||||
|
- [@horriblename](https://github.com/horriblename) - For actively implementing
|
||||||
|
planned features and quality of life updates
|
||||||
- [@Yavko](https://github.com/Yavko) - For the amazing **nvf** logo
|
- [@Yavko](https://github.com/Yavko) - For the amazing **nvf** logo
|
||||||
- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I could not
|
- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I
|
||||||
|
could not
|
||||||
|
- [@Diniamo](https://github.com/Diniamo) - For actively submitting PRs, pull
|
||||||
|
requests and overall assistence
|
||||||
|
- [@Gerg-l](https://github.com/gerg-l) - For the modern Neovim wrapper, mnw and
|
||||||
|
occasional code improvements
|
||||||
|
|
||||||
and everyone who has submitted issues or pull requests!
|
and everyone who has submitted issues or pull requests!
|
||||||
|
|
||||||
|
@ -167,10 +209,18 @@ and everyone who has submitted issues or pull requests!
|
||||||
This configuration borrows from and is based on a few other configurations,
|
This configuration borrows from and is based on a few other configurations,
|
||||||
including:
|
including:
|
||||||
|
|
||||||
- [@jordanisaacs's](https://github.com/jordanisaacs) [neovim-flake](https://github.com/jordanisaacs/neovim-flake) that this flake is originally based on.
|
- [@jordanisaacs's](https://github.com/jordanisaacs)
|
||||||
- [@sioodmy's](https://github.com/sioodmy) [dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design choices.
|
[neovim-flake](https://github.com/jordanisaacs/neovim-flake) that this flake
|
||||||
- [@wiltaylor's](https://github.com/wiltaylor) [neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and design ideas.
|
is originally based on.
|
||||||
- [@gvolpe's](https://github.com/gvolpe) [neovim-flake](https://github.com/gvolpe/neovim-flake) for plugin, design and nix concepts.
|
- [@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
|
I am grateful for their previous work and inspiration, and I wholeheartedly
|
||||||
recommend checking their work out.
|
recommend checking their work out.
|
||||||
|
@ -178,9 +228,13 @@ recommend checking their work out.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Following the [original neovim-flake](https://github.com/jordanisaacs/neovim-flake)
|
Following the license of the
|
||||||
**nvf** has been made available under the **MIT License**. However, all assets
|
[original neovim-flake](https://github.com/jordanisaacs/neovim-flake), **nvf**
|
||||||
are published under the [CC BY License].
|
has been made available under the [**MIT License**](LICENSE). However, all
|
||||||
|
assets and documentation are published under the
|
||||||
|
[**CC BY License**](https://github.com/NotAShelf/nvf/blob/main/.github/assets/LICENSE).
|
||||||
|
|
||||||
|
<h6 align="center">Yes, this includes the logo work too. Stop taking artwork that is not yours!</h6>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
57
.github/pull_request_template.md
vendored
Normal file
57
.github/pull_request_template.md
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<!--
|
||||||
|
^ Please include a clear and concise description of the aim of your Pull Request above this line ^
|
||||||
|
|
||||||
|
For plugin dependency/module additions, please make sure to link the source link of the added plugin
|
||||||
|
or dependency in this section.
|
||||||
|
|
||||||
|
If your pull request aims to fix an open issue or a please bug, please also link the relevant issue
|
||||||
|
below this line. You may attach an issue to your pull request with `Fixes #<issue number>` outside
|
||||||
|
this comment.
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Sanity Checking
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Please check all that apply. As before, this section is not a hard requirement but checklists with more checked
|
||||||
|
items are likely to be merged faster. You may save some time in maintainer review by performing self-reviews here
|
||||||
|
before submitting your pull request.
|
||||||
|
|
||||||
|
If your pull request includes any change or unexpected behaviour not covered below, please do make sure to include
|
||||||
|
it above in your description.
|
||||||
|
-->
|
||||||
|
|
||||||
|
[editorconfig]: https://editorconfig.org
|
||||||
|
[changelog]: https://github.com/NotAShelf/nvf/tree/main/docs/release-notes
|
||||||
|
|
||||||
|
- [ ] I have updated the [changelog] as per my changes.
|
||||||
|
- [ ] I have tested, and self-reviewed my code.
|
||||||
|
- Style and consistency
|
||||||
|
- [ ] I ran **Alejandra** to format my code (`nix fmt`).
|
||||||
|
- [ ] My code conforms to the [editorconfig] configuration of the project.
|
||||||
|
- [ ] My changes are consistent with the rest of the codebase.
|
||||||
|
- If new changes are particularly complex:
|
||||||
|
- [ ] My code includes comments in particularly complex areas
|
||||||
|
- [ ] I have added a section in the manual.
|
||||||
|
- [ ] _(For breaking changes)_ I have included a migration guide.
|
||||||
|
- Package(s) built:
|
||||||
|
- [ ] `.#nix` (default package)
|
||||||
|
- [ ] `.#maximal`
|
||||||
|
- [ ] `.#docs-html`
|
||||||
|
- Tested on platform(s)
|
||||||
|
- [ ] `x86_64-linux`
|
||||||
|
- [ ] `aarch64-linux`
|
||||||
|
- [ ] `x86_64-darwin`
|
||||||
|
- [ ] `aarch64-darwin`
|
||||||
|
|
||||||
|
<!--
|
||||||
|
If your changes touch upon a portion of the codebase that you do not understand well, please make sure to consult
|
||||||
|
the maintainers on your changes. In most cases, making an issue before creating your PR will help you avoid duplicate
|
||||||
|
efforts in the long run.
|
||||||
|
-->
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Add a :+1: [reaction] to [pull requests you find important].
|
||||||
|
|
||||||
|
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
|
||||||
|
[pull requests you find important]: https://github.com/NixOS/nixpkgs/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc
|
3
.github/workflows/cachix.yml
vendored
3
.github/workflows/cachix.yml
vendored
|
@ -19,7 +19,6 @@ jobs:
|
||||||
package:
|
package:
|
||||||
- default
|
- default
|
||||||
- nix
|
- nix
|
||||||
- tidal
|
|
||||||
- maximal
|
- maximal
|
||||||
steps:
|
steps:
|
||||||
- uses: easimon/maximize-build-space@v10
|
- uses: easimon/maximize-build-space@v10
|
||||||
|
@ -38,7 +37,7 @@ jobs:
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
|
|
||||||
- uses: cachix/cachix-action@v14
|
- uses: cachix/cachix-action@v15
|
||||||
with:
|
with:
|
||||||
authToken: ${{ secrets.CACHIX_TOKEN }}
|
authToken: ${{ secrets.CACHIX_TOKEN }}
|
||||||
extraPullNames: nix-community
|
extraPullNames: nix-community
|
||||||
|
|
2
.github/workflows/check-docs.yml
vendored
2
.github/workflows/check-docs.yml
vendored
|
@ -48,4 +48,4 @@ jobs:
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: "${{ matrix.package }}"
|
name: "${{ matrix.package }}"
|
||||||
path: result/share/doc/neovim-flake/
|
path: result/share/doc/nvf
|
||||||
|
|
22
.github/workflows/cleanup.yml
vendored
Normal file
22
.github/workflows/cleanup.yml
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
name: Cleanup
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 4 1 * *" # 4AM on 1st of every month
|
||||||
|
- cron: "0 4 15 * *" # 4AM on the 15th of every month
|
||||||
|
jobs:
|
||||||
|
branches:
|
||||||
|
name: Cleanup old branches
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: "Checkout"
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: "Delete old branches"
|
||||||
|
uses: beatlabs/delete-old-branches-action@v0.0.10
|
||||||
|
with:
|
||||||
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
date: "1 months ago"
|
||||||
|
dry_run: false
|
||||||
|
delete_tags: false
|
||||||
|
exclude_open_pr_branches: true
|
50
.github/workflows/docker.yml
vendored
50
.github/workflows/docker.yml
vendored
|
@ -1,50 +0,0 @@
|
||||||
name: "Publish Docker Image"
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
tags: ["v*"]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-docker-image:
|
|
||||||
name: "Build Docker Image"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Nix
|
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
|
||||||
- name: Magic Nix Cache
|
|
||||||
uses: DeterminateSystems/magic-nix-cache-action@main
|
|
||||||
|
|
||||||
- name: Build Docker Image
|
|
||||||
run: nix build .#docker-nix --print-build-logs
|
|
||||||
|
|
||||||
- name: Load & Tag Built Docker Image
|
|
||||||
run: |
|
|
||||||
docker load -i result &&
|
|
||||||
docker tag neovim-flake:latest notashelf/neovim-flake:latest
|
|
||||||
|
|
||||||
- name: Log into DockerHub
|
|
||||||
uses: docker/login-action@master
|
|
||||||
with:
|
|
||||||
username: notashelf
|
|
||||||
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
|
||||||
|
|
||||||
- name: Push to DockerHub
|
|
||||||
run: docker push notashelf/neovim-flake:latest
|
|
||||||
|
|
||||||
- name: Log into ghcr
|
|
||||||
uses: docker/login-action@master
|
|
||||||
with:
|
|
||||||
registry: "ghcr.io"
|
|
||||||
username: "${{ github.actor }}"
|
|
||||||
password: "${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
|
|
||||||
- name: Publish Docker Image (Github Packages)
|
|
||||||
run: docker push notashelf/neovim-flake:latest
|
|
39
.github/workflows/manual.yml
vendored
39
.github/workflows/manual.yml
vendored
|
@ -1,4 +1,5 @@
|
||||||
name: "Build and deploy documentation"
|
name: "Build and deploy documentation"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
|
@ -7,6 +8,7 @@ on:
|
||||||
paths:
|
paths:
|
||||||
# build the manuals only when docs directory is updated
|
# build the manuals only when docs directory is updated
|
||||||
- docs/**
|
- docs/**
|
||||||
|
- modules/**
|
||||||
|
|
||||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||||
permissions:
|
permissions:
|
||||||
|
@ -20,23 +22,34 @@ concurrency:
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
check_date:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Check latest commit
|
||||||
|
outputs:
|
||||||
|
should_run: ${{ steps.should_run.outputs.should_run }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4.1.7
|
||||||
|
- name: print latest_commit
|
||||||
|
run: echo ${{ github.sha }}
|
||||||
|
|
||||||
|
- id: should_run
|
||||||
|
continue-on-error: true
|
||||||
|
name: check latest commit is less than a day
|
||||||
|
if: ${{ github.event_name == 'schedule' }}
|
||||||
|
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
|
needs: check_date
|
||||||
|
if: ${{ needs.check_date.outputs.should_run != 'false' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v4.1.7
|
||||||
uses: actions/checkout@v4
|
- uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
- name: Install Nix
|
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
|
||||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
|
- run: |
|
||||||
- name: Build
|
nix build .#docs
|
||||||
run: |
|
cp -r result/share/doc/nvf public
|
||||||
nix build '.#docs'
|
- uses: peaceiris/actions-gh-pages@v4
|
||||||
cp -r result/share/doc/neovim-flake public
|
|
||||||
|
|
||||||
- name: Deploy
|
|
||||||
uses: peaceiris/actions-gh-pages@v4
|
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
publish_dir: ./public
|
publish_dir: ./public
|
||||||
|
|
|
@ -1,255 +1,237 @@
|
||||||
inputs: let
|
isMaximal: {
|
||||||
modulesWithInputs = import ./modules inputs;
|
config.vim = {
|
||||||
|
viAlias = true;
|
||||||
neovimConfiguration = {
|
vimAlias = true;
|
||||||
modules ? [],
|
debugMode = {
|
||||||
pkgs,
|
enable = false;
|
||||||
lib ? pkgs.lib,
|
level = 16;
|
||||||
check ? true,
|
logFile = "/tmp/nvim.log";
|
||||||
extraSpecialArgs ? {},
|
|
||||||
extraModules ? [],
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
modulesWithInputs {
|
|
||||||
inherit pkgs lib check extraSpecialArgs extraModules;
|
|
||||||
configuration.imports = modules;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
tidalConfig = {
|
spellcheck = {
|
||||||
config.vim.languages.tidal.enable = true;
|
enable = isMaximal;
|
||||||
};
|
};
|
||||||
|
|
||||||
mainConfig = isMaximal: {
|
lsp = {
|
||||||
config.vim = {
|
formatOnSave = true;
|
||||||
viAlias = true;
|
lspkind.enable = false;
|
||||||
vimAlias = true;
|
lightbulb.enable = true;
|
||||||
debugMode = {
|
lspsaga.enable = false;
|
||||||
enable = false;
|
trouble.enable = true;
|
||||||
level = 16;
|
lspSignature.enable = true;
|
||||||
logFile = "/tmp/nvim.log";
|
otter-nvim.enable = isMaximal;
|
||||||
|
lsplines.enable = isMaximal;
|
||||||
|
nvim-docs-view.enable = isMaximal;
|
||||||
|
};
|
||||||
|
|
||||||
|
debugger = {
|
||||||
|
nvim-dap = {
|
||||||
|
enable = true;
|
||||||
|
ui.enable = true;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
spellcheck = {
|
languages = {
|
||||||
|
enableLSP = true;
|
||||||
|
enableFormat = true;
|
||||||
|
enableTreesitter = true;
|
||||||
|
enableExtraDiagnostics = true;
|
||||||
|
|
||||||
|
# Nim LSP is broken on Darwin and therefore
|
||||||
|
# should be disabled by default. Users may still enable
|
||||||
|
# `vim.languages.vim` to enable it, this does not restrict
|
||||||
|
# that.
|
||||||
|
# See: <https://github.com/PMunch/nimlsp/issues/178#issue-2128106096>
|
||||||
|
nim.enable = false;
|
||||||
|
|
||||||
|
nix.enable = true;
|
||||||
|
|
||||||
|
markdown.enable = isMaximal;
|
||||||
|
html.enable = isMaximal;
|
||||||
|
css.enable = isMaximal;
|
||||||
|
sql.enable = isMaximal;
|
||||||
|
java.enable = isMaximal;
|
||||||
|
ts.enable = isMaximal;
|
||||||
|
svelte.enable = isMaximal;
|
||||||
|
go.enable = isMaximal;
|
||||||
|
lua.enable = isMaximal;
|
||||||
|
elixir.enable = isMaximal;
|
||||||
|
zig.enable = isMaximal;
|
||||||
|
ocaml.enable = isMaximal;
|
||||||
|
python.enable = isMaximal;
|
||||||
|
dart.enable = isMaximal;
|
||||||
|
bash.enable = isMaximal;
|
||||||
|
r.enable = isMaximal;
|
||||||
|
tailwind.enable = isMaximal;
|
||||||
|
typst.enable = isMaximal;
|
||||||
|
clang = {
|
||||||
enable = isMaximal;
|
enable = isMaximal;
|
||||||
|
lsp.server = "clangd";
|
||||||
};
|
};
|
||||||
|
|
||||||
lsp = {
|
rust = {
|
||||||
formatOnSave = true;
|
enable = isMaximal;
|
||||||
lspkind.enable = false;
|
crates.enable = isMaximal;
|
||||||
lightbulb.enable = true;
|
|
||||||
lspsaga.enable = false;
|
|
||||||
nvimCodeActionMenu.enable = isMaximal;
|
|
||||||
trouble.enable = true;
|
|
||||||
lspSignature.enable = true;
|
|
||||||
lsplines.enable = isMaximal;
|
|
||||||
nvim-docs-view.enable = isMaximal;
|
|
||||||
};
|
|
||||||
|
|
||||||
debugger = {
|
|
||||||
nvim-dap = {
|
|
||||||
enable = true;
|
|
||||||
ui.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
languages = {
|
|
||||||
enableLSP = true;
|
|
||||||
enableFormat = true;
|
|
||||||
enableTreesitter = true;
|
|
||||||
enableExtraDiagnostics = true;
|
|
||||||
|
|
||||||
nix.enable = true;
|
|
||||||
html.enable = isMaximal;
|
|
||||||
css.enable = isMaximal;
|
|
||||||
sql.enable = isMaximal;
|
|
||||||
java.enable = isMaximal;
|
|
||||||
ts.enable = isMaximal;
|
|
||||||
svelte.enable = isMaximal;
|
|
||||||
go.enable = isMaximal;
|
|
||||||
zig.enable = isMaximal;
|
|
||||||
python.enable = isMaximal;
|
|
||||||
dart.enable = isMaximal;
|
|
||||||
elixir.enable = isMaximal;
|
|
||||||
bash.enable = isMaximal;
|
|
||||||
terraform.enable = isMaximal;
|
|
||||||
nim.enable = false;
|
|
||||||
tailwind.enable = isMaximal;
|
|
||||||
clang = {
|
|
||||||
enable = isMaximal;
|
|
||||||
lsp.server = "clangd";
|
|
||||||
};
|
|
||||||
|
|
||||||
rust = {
|
|
||||||
enable = isMaximal;
|
|
||||||
crates.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
visuals = {
|
|
||||||
enable = true;
|
|
||||||
nvimWebDevicons.enable = true;
|
|
||||||
scrollBar.enable = true;
|
|
||||||
smoothScroll.enable = true;
|
|
||||||
cellularAutomaton.enable = false;
|
|
||||||
fidget-nvim.enable = true;
|
|
||||||
highlight-undo.enable = true;
|
|
||||||
|
|
||||||
indentBlankline = {
|
|
||||||
enable = true;
|
|
||||||
fillChar = null;
|
|
||||||
eolChar = null;
|
|
||||||
scope = {
|
|
||||||
enabled = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
cursorline = {
|
|
||||||
enable = true;
|
|
||||||
lineTimeout = 0;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
statusline = {
|
|
||||||
lualine = {
|
|
||||||
enable = true;
|
|
||||||
theme = "catppuccin";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
theme = {
|
|
||||||
enable = true;
|
|
||||||
name = "catppuccin";
|
|
||||||
style = "mocha";
|
|
||||||
transparent = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
autopairs.enable = true;
|
|
||||||
|
|
||||||
autocomplete = {
|
|
||||||
enable = true;
|
|
||||||
type = "nvim-cmp";
|
|
||||||
};
|
|
||||||
|
|
||||||
filetree = {
|
|
||||||
nvimTree = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
tabline = {
|
|
||||||
nvimBufferline.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
treesitter.context.enable = true;
|
|
||||||
|
|
||||||
binds = {
|
|
||||||
whichKey.enable = true;
|
|
||||||
cheatsheet.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
telescope.enable = true;
|
|
||||||
|
|
||||||
git = {
|
|
||||||
enable = true;
|
|
||||||
gitsigns.enable = true;
|
|
||||||
gitsigns.codeActions.enable = false; # throws an annoying debug message
|
|
||||||
};
|
|
||||||
|
|
||||||
minimap = {
|
|
||||||
minimap-vim.enable = false;
|
|
||||||
codewindow.enable = isMaximal; # lighter, faster, and uses lua for configuration
|
|
||||||
};
|
|
||||||
|
|
||||||
dashboard = {
|
|
||||||
dashboard-nvim.enable = false;
|
|
||||||
alpha.enable = isMaximal;
|
|
||||||
};
|
|
||||||
|
|
||||||
notify = {
|
|
||||||
nvim-notify.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
projects = {
|
|
||||||
project-nvim.enable = isMaximal;
|
|
||||||
};
|
|
||||||
|
|
||||||
utility = {
|
|
||||||
ccc.enable = isMaximal;
|
|
||||||
vim-wakatime.enable = isMaximal;
|
|
||||||
icon-picker.enable = isMaximal;
|
|
||||||
surround.enable = isMaximal;
|
|
||||||
diffview-nvim.enable = true;
|
|
||||||
motion = {
|
|
||||||
hop.enable = true;
|
|
||||||
leap.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
images = {
|
|
||||||
image-nvim.enable = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
notes = {
|
|
||||||
obsidian.enable = false; # FIXME: neovim fails to build if obsidian is enabled
|
|
||||||
orgmode.enable = false;
|
|
||||||
mind-nvim.enable = isMaximal;
|
|
||||||
todo-comments.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
terminal = {
|
|
||||||
toggleterm = {
|
|
||||||
enable = true;
|
|
||||||
lazygit.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
ui = {
|
|
||||||
borders.enable = true;
|
|
||||||
noice.enable = true;
|
|
||||||
colorizer.enable = true;
|
|
||||||
modes-nvim.enable = false; # the theme looks terrible with catppuccin
|
|
||||||
illuminate.enable = true;
|
|
||||||
breadcrumbs = {
|
|
||||||
enable = isMaximal;
|
|
||||||
navbuddy.enable = isMaximal;
|
|
||||||
};
|
|
||||||
smartcolumn = {
|
|
||||||
enable = true;
|
|
||||||
setupOpts.custom_colorcolumn = {
|
|
||||||
# this is a freeform module, it's `buftype = int;` for configuring column position
|
|
||||||
nix = 110;
|
|
||||||
ruby = 120;
|
|
||||||
java = 130;
|
|
||||||
go = [90 130];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
assistant = {
|
|
||||||
chatgpt.enable = false;
|
|
||||||
copilot = {
|
|
||||||
enable = false;
|
|
||||||
cmp.enable = isMaximal;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
session = {
|
|
||||||
nvim-session-manager.enable = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
gestures = {
|
|
||||||
gesture-nvim.enable = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
comments = {
|
|
||||||
comment-nvim.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
presence = {
|
|
||||||
neocord.enable = false;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
visuals = {
|
||||||
|
enable = true;
|
||||||
|
nvimWebDevicons.enable = true;
|
||||||
|
scrollBar.enable = isMaximal;
|
||||||
|
smoothScroll.enable = true;
|
||||||
|
cellularAutomaton.enable = false;
|
||||||
|
fidget-nvim.enable = true;
|
||||||
|
highlight-undo.enable = true;
|
||||||
|
|
||||||
|
indentBlankline.enable = true;
|
||||||
|
|
||||||
|
cursorline = {
|
||||||
|
enable = true;
|
||||||
|
lineTimeout = 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
statusline = {
|
||||||
|
lualine = {
|
||||||
|
enable = true;
|
||||||
|
theme = "catppuccin";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
theme = {
|
||||||
|
enable = true;
|
||||||
|
name = "catppuccin";
|
||||||
|
style = "mocha";
|
||||||
|
transparent = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
autopairs.enable = true;
|
||||||
|
|
||||||
|
autocomplete = {
|
||||||
|
enable = true;
|
||||||
|
type = "nvim-cmp";
|
||||||
|
};
|
||||||
|
|
||||||
|
filetree = {
|
||||||
|
nvimTree = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
tabline = {
|
||||||
|
nvimBufferline.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
treesitter.context.enable = true;
|
||||||
|
|
||||||
|
binds = {
|
||||||
|
whichKey.enable = true;
|
||||||
|
cheatsheet.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
telescope.enable = true;
|
||||||
|
|
||||||
|
git = {
|
||||||
|
enable = true;
|
||||||
|
gitsigns.enable = true;
|
||||||
|
gitsigns.codeActions.enable = false; # throws an annoying debug message
|
||||||
|
};
|
||||||
|
|
||||||
|
minimap = {
|
||||||
|
minimap-vim.enable = false;
|
||||||
|
codewindow.enable = isMaximal; # lighter, faster, and uses lua for configuration
|
||||||
|
};
|
||||||
|
|
||||||
|
dashboard = {
|
||||||
|
dashboard-nvim.enable = false;
|
||||||
|
alpha.enable = isMaximal;
|
||||||
|
};
|
||||||
|
|
||||||
|
notify = {
|
||||||
|
nvim-notify.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
projects = {
|
||||||
|
project-nvim.enable = isMaximal;
|
||||||
|
};
|
||||||
|
|
||||||
|
utility = {
|
||||||
|
ccc.enable = false;
|
||||||
|
vim-wakatime.enable = false;
|
||||||
|
icon-picker.enable = isMaximal;
|
||||||
|
surround.enable = isMaximal;
|
||||||
|
diffview-nvim.enable = true;
|
||||||
|
motion = {
|
||||||
|
hop.enable = true;
|
||||||
|
leap.enable = true;
|
||||||
|
precognition.enable = isMaximal;
|
||||||
|
};
|
||||||
|
|
||||||
|
images = {
|
||||||
|
image-nvim.enable = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
notes = {
|
||||||
|
obsidian.enable = false; # FIXME: neovim fails to build if obsidian is enabled
|
||||||
|
orgmode.enable = false;
|
||||||
|
mind-nvim.enable = isMaximal;
|
||||||
|
todo-comments.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
terminal = {
|
||||||
|
toggleterm = {
|
||||||
|
enable = true;
|
||||||
|
lazygit.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ui = {
|
||||||
|
borders.enable = true;
|
||||||
|
noice.enable = true;
|
||||||
|
colorizer.enable = true;
|
||||||
|
modes-nvim.enable = false; # the theme looks terrible with catppuccin
|
||||||
|
illuminate.enable = true;
|
||||||
|
breadcrumbs = {
|
||||||
|
enable = isMaximal;
|
||||||
|
navbuddy.enable = isMaximal;
|
||||||
|
};
|
||||||
|
smartcolumn = {
|
||||||
|
enable = true;
|
||||||
|
setupOpts.custom_colorcolumn = {
|
||||||
|
# this is a freeform module, it's `buftype = int;` for configuring column position
|
||||||
|
nix = "110";
|
||||||
|
ruby = "120";
|
||||||
|
java = "130";
|
||||||
|
go = ["90" "130"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
fastaction.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
assistant = {
|
||||||
|
chatgpt.enable = false;
|
||||||
|
copilot = {
|
||||||
|
enable = false;
|
||||||
|
cmp.enable = isMaximal;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
session = {
|
||||||
|
nvim-session-manager.enable = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
gestures = {
|
||||||
|
gesture-nvim.enable = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
comments = {
|
||||||
|
comment-nvim.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
presence = {
|
||||||
|
neocord.enable = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
in {
|
|
||||||
inherit neovimConfiguration mainConfig tidalConfig;
|
|
||||||
}
|
}
|
||||||
|
|
262
docs/default.nix
262
docs/default.nix
|
@ -1,132 +1,132 @@
|
||||||
{
|
{
|
||||||
inputs,
|
inputs,
|
||||||
pkgs,
|
pkgs,
|
||||||
lib ? import ../lib/stdlib-extended.nix pkgs.lib inputs,
|
lib,
|
||||||
manpageUrls ? pkgs.path + "/doc/manpage-urls.json",
|
|
||||||
...
|
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkForce evalModules;
|
inherit ((lib.importJSON ../release.json)) release;
|
||||||
inherit (lib.strings) hasPrefix removePrefix;
|
|
||||||
inherit (lib.attrsets) isAttrs mapAttrs optionalAttrs recursiveUpdate isDerivation;
|
|
||||||
inherit (builtins) fromJSON readFile;
|
|
||||||
|
|
||||||
# release data
|
nvimModuleDocs = pkgs.nixosOptionsDoc {
|
||||||
release-config = fromJSON (readFile ../release.json);
|
|
||||||
revision = release-config.release;
|
|
||||||
|
|
||||||
# From home-manager:
|
|
||||||
#
|
|
||||||
# Recursively replace each derivation in the given attribute set
|
|
||||||
# with the same derivation but with the `outPath` attribute set to
|
|
||||||
# the string `"\${pkgs.attribute.path}"`. This allows the
|
|
||||||
# documentation to refer to derivations through their values without
|
|
||||||
# establishing an actual dependency on the derivation output.
|
|
||||||
#
|
|
||||||
# This is not perfect, but it seems to cover a vast majority of use
|
|
||||||
# cases.
|
|
||||||
#
|
|
||||||
# Caveat: even if the package is reached by a different means, the
|
|
||||||
# path above will be shown and not e.g.
|
|
||||||
# `${config.services.foo.package}`.
|
|
||||||
scrubDerivations = prefixPath: attrs: let
|
|
||||||
scrubDerivation = name: value: let
|
|
||||||
pkgAttrName = prefixPath + "." + name;
|
|
||||||
in
|
|
||||||
if isAttrs value
|
|
||||||
then
|
|
||||||
scrubDerivations pkgAttrName value
|
|
||||||
// optionalAttrs (isDerivation value) {
|
|
||||||
outPath = "\${${pkgAttrName}}";
|
|
||||||
}
|
|
||||||
else value;
|
|
||||||
in
|
|
||||||
mapAttrs scrubDerivation attrs;
|
|
||||||
|
|
||||||
# Make sure the used package is scrubbed to avoid actually
|
|
||||||
# instantiating derivations.
|
|
||||||
scrubbedPkgsModule = {
|
|
||||||
imports = [
|
|
||||||
{
|
|
||||||
_module.args = {
|
|
||||||
pkgs = mkForce (scrubDerivations "pkgs" pkgs);
|
|
||||||
pkgs_i686 = mkForce {};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Specify the path to the module entrypoint
|
|
||||||
nvimPath = toString ./..;
|
|
||||||
buildOptionsDocs = args @ {
|
|
||||||
modules,
|
|
||||||
includeModuleSystemOptions ? true,
|
|
||||||
warningsAreErrors ? true,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit ((evalModules {inherit modules;})) options;
|
|
||||||
|
|
||||||
# Declaration of the Github site URL.
|
|
||||||
# Takes a user, repo, and subpath, and returns a declaration site
|
|
||||||
# as a string.
|
|
||||||
githubDeclaration = user: repo: subpath: let
|
|
||||||
urlRef = "github.com";
|
|
||||||
branch = "main";
|
|
||||||
in {
|
|
||||||
url = "https://${urlRef}/${user}/${repo}/blob/${branch}/${subpath}";
|
|
||||||
name = "<${repo}/${subpath}>";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
pkgs.buildPackages.nixosOptionsDoc ({
|
|
||||||
inherit warningsAreErrors;
|
|
||||||
|
|
||||||
options =
|
|
||||||
if includeModuleSystemOptions
|
|
||||||
then options
|
|
||||||
else builtins.removeAttrs options ["_module"];
|
|
||||||
|
|
||||||
transformOptions = opt:
|
|
||||||
recursiveUpdate opt {
|
|
||||||
# Clean up declaration sites to not refer to the nvf
|
|
||||||
# source tree.
|
|
||||||
declarations = map (decl:
|
|
||||||
if hasPrefix nvimPath (toString decl)
|
|
||||||
then
|
|
||||||
githubDeclaration "notashelf" "nvf"
|
|
||||||
(removePrefix "/" (removePrefix nvimPath (toString decl)))
|
|
||||||
else if decl == "lib/modules.nix"
|
|
||||||
then
|
|
||||||
# TODO: handle this in a better way (may require upstream
|
|
||||||
# changes to nixpkgs)
|
|
||||||
githubDeclaration "NixOS" "nixpkgs" decl
|
|
||||||
else decl)
|
|
||||||
opt.declarations;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// builtins.removeAttrs args ["modules" "includeModuleSystemOptions"]);
|
|
||||||
|
|
||||||
nvimModuleDocs = buildOptionsDocs {
|
|
||||||
variablelistId = "nvf-options";
|
variablelistId = "nvf-options";
|
||||||
|
warningsAreErrors = true;
|
||||||
|
|
||||||
modules =
|
inherit
|
||||||
import ../modules/modules.nix {
|
(
|
||||||
inherit lib pkgs;
|
(lib.evalModules {
|
||||||
check = false;
|
modules =
|
||||||
}
|
import ../modules/modules.nix {
|
||||||
++ [scrubbedPkgsModule];
|
inherit lib pkgs;
|
||||||
|
}
|
||||||
|
++ [
|
||||||
|
(
|
||||||
|
let
|
||||||
|
# From nixpkgs:
|
||||||
|
#
|
||||||
|
# Recursively replace each derivation in the given attribute set
|
||||||
|
# with the same derivation but with the `outPath` attribute set to
|
||||||
|
# the string `"\${pkgs.attribute.path}"`. This allows the
|
||||||
|
# documentation to refer to derivations through their values without
|
||||||
|
# establishing an actual dependency on the derivation output.
|
||||||
|
#
|
||||||
|
# This is not perfect, but it seems to cover a vast majority of use
|
||||||
|
# cases.
|
||||||
|
#
|
||||||
|
# Caveat: even if the package is reached by a different means, the
|
||||||
|
# path above will be shown and not e.g.
|
||||||
|
# `${config.services.foo.package}`.
|
||||||
|
scrubDerivations = namePrefix: pkgSet:
|
||||||
|
builtins.mapAttrs (
|
||||||
|
name: value: let
|
||||||
|
wholeName = "${namePrefix}.${name}";
|
||||||
|
in
|
||||||
|
if builtins.isAttrs value
|
||||||
|
then
|
||||||
|
scrubDerivations wholeName value
|
||||||
|
// lib.optionalAttrs (lib.isDerivation value) {
|
||||||
|
inherit (value) drvPath;
|
||||||
|
outPath = "\${${wholeName}}";
|
||||||
|
}
|
||||||
|
else value
|
||||||
|
)
|
||||||
|
pkgSet;
|
||||||
|
in {
|
||||||
|
_module = {
|
||||||
|
check = false;
|
||||||
|
args.pkgs = lib.mkForce (scrubDerivations "pkgs" pkgs);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
|
})
|
||||||
|
)
|
||||||
|
options
|
||||||
|
;
|
||||||
|
|
||||||
|
transformOptions = opt:
|
||||||
|
opt
|
||||||
|
// {
|
||||||
|
declarations =
|
||||||
|
map (
|
||||||
|
decl:
|
||||||
|
if lib.hasPrefix (toString ../.) (toString decl)
|
||||||
|
then
|
||||||
|
lib.pipe decl [
|
||||||
|
toString
|
||||||
|
(lib.removePrefix (toString ../.))
|
||||||
|
(lib.removePrefix "/")
|
||||||
|
(x: {
|
||||||
|
url = "https://github.com/NotAShelf/nvf/blob/main/${x}";
|
||||||
|
name = "<nvf/${x}>";
|
||||||
|
})
|
||||||
|
]
|
||||||
|
else if decl == "lib/modules.nix"
|
||||||
|
then {
|
||||||
|
url = "https://github.com/NixOS/nixpkgs/blob/master/${decl}";
|
||||||
|
name = "<nixpkgs/lib/modules.nix>";
|
||||||
|
}
|
||||||
|
else decl
|
||||||
|
)
|
||||||
|
opt.declarations;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Generate the HTML manual pages
|
||||||
|
html = pkgs.callPackage ./manual.nix {
|
||||||
|
inherit release;
|
||||||
|
inherit (nvimModuleDocs) optionsJSON;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
inherit (inputs) nmd;
|
||||||
|
|
||||||
|
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
|
||||||
|
# `nixosOptionsDoc` is more customizable.
|
||||||
|
options.json =
|
||||||
|
pkgs.runCommand "options.json" {
|
||||||
|
meta.description = "List of nvf options in JSON format";
|
||||||
|
} ''
|
||||||
|
mkdir -p $out/{share/doc,nix-support}
|
||||||
|
cp -a ${nvimModuleDocs.optionsJSON}/share/doc/nixos $out/share/doc/nvf
|
||||||
|
substitute \
|
||||||
|
${nvimModuleDocs.optionsJSON}/nix-support/hydra-build-products \
|
||||||
|
$out/nix-support/hydra-build-products \
|
||||||
|
--replace \
|
||||||
|
'${nvimModuleDocs.optionsJSON}/share/doc/nixos' \
|
||||||
|
"$out/share/doc/nvf"
|
||||||
|
'';
|
||||||
|
|
||||||
# Generate the `man home-configuration.nix` package
|
# Generate the `man home-configuration.nix` package
|
||||||
nvf-configuration-manual =
|
manPages =
|
||||||
pkgs.runCommand "nvf-reference-manpage" {
|
pkgs.runCommand "nvf-reference-manpage" {
|
||||||
nativeBuildInputs = [pkgs.buildPackages.installShellFiles pkgs.nixos-render-docs];
|
nativeBuildInputs = [
|
||||||
|
pkgs.buildPackages.installShellFiles
|
||||||
|
pkgs.nixos-render-docs
|
||||||
|
];
|
||||||
allowedReferences = ["out"];
|
allowedReferences = ["out"];
|
||||||
} ''
|
} ''
|
||||||
# Generate manpages.
|
# Generate manpages.
|
||||||
mkdir -p $out/share/man/man5
|
mkdir -p $out/share/man/{man5,man1}
|
||||||
mkdir -p $out/share/man/man1
|
|
||||||
|
|
||||||
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
|
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
|
||||||
--revision ${revision} \
|
--revision ${release} \
|
||||||
--header ${./man/header.5} \
|
--header ${./man/header.5} \
|
||||||
--footer ${./man/footer.5} \
|
--footer ${./man/footer.5} \
|
||||||
${nvimModuleDocs.optionsJSON}/share/doc/nixos/options.json \
|
${nvimModuleDocs.optionsJSON}/share/doc/nixos/options.json \
|
||||||
|
@ -135,38 +135,8 @@
|
||||||
cp ${./man/nvf.1} $out/share/man/man1/nvf.1
|
cp ${./man/nvf.1} $out/share/man/man1/nvf.1
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Generate the HTML manual pages
|
manual = {
|
||||||
nvf-manual = pkgs.callPackage ./manual.nix {
|
inherit html;
|
||||||
inherit revision manpageUrls;
|
htmlOpenTool = pkgs.callPackage ./html-open-tool.nix {inherit html;};
|
||||||
outputPath = "share/doc/nvf";
|
|
||||||
options = {
|
|
||||||
nvf = nvimModuleDocs.optionsJSON;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
html = nvf-manual;
|
|
||||||
htmlOpenTool = pkgs.callPackage ./html-open-tool.nix {} {inherit html;};
|
|
||||||
in {
|
|
||||||
inherit (inputs) nmd;
|
|
||||||
|
|
||||||
options = {
|
|
||||||
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
|
|
||||||
# `nixosOptionsDoc` is more customizable.
|
|
||||||
json =
|
|
||||||
pkgs.runCommand "options.json" {
|
|
||||||
meta.description = "List of nvf options in JSON format";
|
|
||||||
} ''
|
|
||||||
mkdir -p $out/{share/doc,nix-support}
|
|
||||||
cp -a ${nvimModuleDocs.optionsJSON}/share/doc/nixos $out/share/doc/nvf
|
|
||||||
substitute \
|
|
||||||
${nvimModuleDocs.optionsJSON}/nix-support/hydra-build-products \
|
|
||||||
$out/nix-support/hydra-build-products \
|
|
||||||
--replace \
|
|
||||||
'${nvimModuleDocs.optionsJSON}/share/doc/nixos' \
|
|
||||||
"$out/share/doc/nvf"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
manPages = nvf-configuration-manual;
|
|
||||||
manual = {inherit html htmlOpenTool;};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,9 @@
|
||||||
writeShellScriptBin,
|
writeShellScriptBin,
|
||||||
makeDesktopItem,
|
makeDesktopItem,
|
||||||
symlinkJoin,
|
symlinkJoin,
|
||||||
}: {
|
|
||||||
html,
|
html,
|
||||||
pathName ? "nvf",
|
|
||||||
projectName ? pathName,
|
|
||||||
name ? "${pathName}-help",
|
|
||||||
}: let
|
}: let
|
||||||
helpScript = writeShellScriptBin name ''
|
helpScript = writeShellScriptBin "nvf-help" ''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if [[ ! -v BROWSER || -z $BROWSER ]]; then
|
if [[ ! -v BROWSER || -z $BROWSER ]]; then
|
||||||
|
@ -24,20 +20,23 @@
|
||||||
echo "$0: unable to start a web browser; please set \$BROWSER"
|
echo "$0: unable to start a web browser; please set \$BROWSER"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
exec "$BROWSER" "${html}/share/doc/${pathName}/index.xhtml"
|
exec "$BROWSER" "${html}/share/doc/nvf/index.xhtml"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
desktopItem = makeDesktopItem {
|
desktopItem = makeDesktopItem {
|
||||||
name = "${pathName}-manual";
|
name = "nvf-manual";
|
||||||
desktopName = "${projectName} Manual";
|
desktopName = "nvf Manual";
|
||||||
genericName = "View ${projectName} documentation in a web browser";
|
genericName = "View nvf documentation in a web browser";
|
||||||
icon = "nix-snowflake";
|
icon = "nix-snowflake";
|
||||||
exec = "${helpScript}/bin/${name}";
|
exec = "${helpScript}/bin/nvf-help";
|
||||||
categories = ["System"];
|
categories = ["System"];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
symlinkJoin {
|
symlinkJoin {
|
||||||
inherit name;
|
name = "nvf-help";
|
||||||
paths = [helpScript desktopItem];
|
paths = [
|
||||||
|
helpScript
|
||||||
|
desktopItem
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,10 @@
|
||||||
# build inputs
|
# build inputs
|
||||||
nixos-render-docs,
|
nixos-render-docs,
|
||||||
documentation-highlighter,
|
documentation-highlighter,
|
||||||
|
path,
|
||||||
# nrd configuration
|
# nrd configuration
|
||||||
manpageUrls,
|
release,
|
||||||
revision,
|
optionsJSON,
|
||||||
options,
|
|
||||||
outputPath ? "share/doc/nvf",
|
|
||||||
}:
|
}:
|
||||||
stdenvNoCC.mkDerivation {
|
stdenvNoCC.mkDerivation {
|
||||||
name = "nvf-manual";
|
name = "nvf-manual";
|
||||||
|
@ -20,9 +19,11 @@ stdenvNoCC.mkDerivation {
|
||||||
nativeBuildInputs = [nixos-render-docs];
|
nativeBuildInputs = [nixos-render-docs];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
mkdir -p out/{highlightjs,media}
|
dest="$out/share/doc/nvf"
|
||||||
|
mkdir -p "$(dirname "$dest")"
|
||||||
|
mkdir -p $dest/{highlightjs,media}
|
||||||
|
|
||||||
cp -vt out/highlightjs \
|
cp -vt $dest/highlightjs \
|
||||||
${documentation-highlighter}/highlight.pack.js \
|
${documentation-highlighter}/highlight.pack.js \
|
||||||
${documentation-highlighter}/LICENSE \
|
${documentation-highlighter}/LICENSE \
|
||||||
${documentation-highlighter}/mono-blue.css \
|
${documentation-highlighter}/mono-blue.css \
|
||||||
|
@ -31,38 +32,32 @@ stdenvNoCC.mkDerivation {
|
||||||
substituteInPlace ./options.md \
|
substituteInPlace ./options.md \
|
||||||
--subst-var-by \
|
--subst-var-by \
|
||||||
OPTIONS_JSON \
|
OPTIONS_JSON \
|
||||||
${options.nvf}/share/doc/nixos/options.json
|
${optionsJSON}/share/doc/nixos/options.json
|
||||||
|
|
||||||
substituteInPlace ./manual.md \
|
substituteInPlace ./manual.md \
|
||||||
--subst-var-by \
|
--subst-var-by \
|
||||||
NVF_VERSION \
|
NVF_VERSION \
|
||||||
${revision}
|
${release}
|
||||||
|
|
||||||
# copy stylesheet
|
# copy stylesheet
|
||||||
cp ${./static/style.css} out/style.css
|
cp ${./static/style.css} "$dest/style.css"
|
||||||
|
|
||||||
# copy release notes
|
# copy release notes
|
||||||
cp -vr ${./release-notes} release-notes
|
cp -vr ${./release-notes} release-notes
|
||||||
|
|
||||||
# generate manual from
|
# generate manual from
|
||||||
nixos-render-docs manual html \
|
nixos-render-docs manual html \
|
||||||
--manpage-urls ${manpageUrls} \
|
--manpage-urls ${path + "/doc/manpage-urls.json"} \
|
||||||
--revision ${lib.trivial.revisionWithDefault revision} \
|
--revision ${lib.trivial.revisionWithDefault release} \
|
||||||
--stylesheet style.css \
|
--stylesheet style.css \
|
||||||
--script highlightjs/highlight.pack.js \
|
--script highlightjs/highlight.pack.js \
|
||||||
--script highlightjs/loader.js \
|
--script highlightjs/loader.js \
|
||||||
--toc-depth 2 \
|
--toc-depth 2 \
|
||||||
--section-toc-depth 1 \
|
--section-toc-depth 1 \
|
||||||
manual.md \
|
manual.md \
|
||||||
out/index.xhtml
|
"$dest/index.xhtml"
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
mkdir -p $out/nix-support/
|
||||||
dest="$out/${outputPath}"
|
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
|
||||||
mkdir -p "$(dirname "$dest")"
|
|
||||||
mv out "$dest"
|
|
||||||
|
|
||||||
mkdir -p $out/nix-support/
|
|
||||||
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,4 +5,5 @@ configuring/custom-package.md
|
||||||
configuring/custom-plugins.md
|
configuring/custom-plugins.md
|
||||||
configuring/languages.md
|
configuring/languages.md
|
||||||
configuring/dags.md
|
configuring/dags.md
|
||||||
|
configuring/dag-entries.md
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Custom Plugins {#ch-custom-plugins}
|
# Custom Plugins {#ch-custom-plugins}
|
||||||
|
|
||||||
**nvf**, by default, exposes a wide variety of plugins as module options
|
**nvf**, by default, exposes a wide variety of plugins as module options
|
||||||
for your convience and bundles necessary dependencies into **nvf**'s runtime.
|
for your convenience and bundles necessary dependencies into **nvf**'s runtime.
|
||||||
In case a plugin is not available in **nvf**, you may consider making a pull
|
In case a plugin is not available in **nvf**, you may consider making a pull
|
||||||
request to **nvf** to include it as a module or you may add it to your
|
request to **nvf** to include it as a module or you may add it to your
|
||||||
configuration locally.
|
configuration locally.
|
||||||
|
|
|
@ -1,16 +1,38 @@
|
||||||
# Configuring {#sec-configuring-plugins}
|
# Configuring {#sec-configuring-plugins}
|
||||||
|
|
||||||
Just making the plugin to your Neovim configuration available might not always
|
Just making the plugin to your Neovim configuration available might not always
|
||||||
be enough. In that case, you can write custom vimscript or lua config, using
|
be enough. In that case, you can write custom lua config using either
|
||||||
either `config.vim.configRC` or `config.vim.luaConfigRC` respectively. Both of
|
`config.vim.extraPlugins` (which has the `setup` field) or
|
||||||
these options are attribute sets, and you need to give the configuration you're
|
`config.vim.luaConfigRC`. The first option uses an attribute set, which maps DAG
|
||||||
adding some name, like this:
|
section names to a custom type, which has the fields `package`, `after`,
|
||||||
|
`setup`. They allow you to set the package of the plugin, the sections its setup
|
||||||
|
code should be after (note that the `extraPlugins` option has its own DAG
|
||||||
|
scope), and the its setup code respectively. For example:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
config.vim.extraPlugins = with pkgs.vimPlugins; {
|
||||||
|
aerial = {
|
||||||
|
package = aerial-nvim;
|
||||||
|
setup = "require('aerial').setup {}";
|
||||||
|
};
|
||||||
|
|
||||||
|
harpoon = {
|
||||||
|
package = harpoon;
|
||||||
|
setup = "require('harpoon').setup {}";
|
||||||
|
after = ["aerial"]; # place harpoon configuration after aerial
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The second option also uses an attribute set, but this one is resolved as a DAG
|
||||||
|
directly. The attribute names denote the section names, and the values lua code.
|
||||||
|
For example:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
# this will create an "aquarium" section in your init.vim with the contents of your custom config
|
# this will create an "aquarium" section in your init.lua with the contents of your custom config
|
||||||
# which will be *appended* to the rest of your configuration, inside your init.vim
|
# which will be *appended* to the rest of your configuration, inside your init.vim
|
||||||
config.vim.configRC.aquarium = "colorscheme aquiarum";
|
config.vim.luaConfigRC.aquarium = "vim.cmd('colorscheme aquiarum')";
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
23
docs/manual/configuring/dag-entries.md
Normal file
23
docs/manual/configuring/dag-entries.md
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# DAG entries in nvf {#ch-dag-entries}
|
||||||
|
|
||||||
|
From the previous chapter, it should be clear that DAGs are useful, because you
|
||||||
|
can add code that relies on other code. However, if you don't know what the
|
||||||
|
entries are called, it's hard to do that, so here is a list of the internal
|
||||||
|
entries in nvf:
|
||||||
|
|
||||||
|
## `vim.luaConfigRC` (top-level DAG) {#ch-vim-luaconfigrc}
|
||||||
|
|
||||||
|
1. (`luaConfigPre`) - not a part of the actual DAG, instead, it's simply
|
||||||
|
inserted before the rest of the DAG
|
||||||
|
2. `globalsScript` - used to set globals defined in `vim.globals`
|
||||||
|
3. `basic` - used to set basic configuration options
|
||||||
|
4. `optionsScript` - used to set options defined in `vim.o`
|
||||||
|
5. `theme` (this is simply placed before `pluginConfigs`, meaning that
|
||||||
|
surrounding entries don't depend on it) - used to set up the theme, which has
|
||||||
|
to be done before other plugins
|
||||||
|
6. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option,
|
||||||
|
see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your
|
||||||
|
own plugins) DAG, used to set up internal plugins
|
||||||
|
7. `extraPluginConfigs` - the result of `vim.extraPlugins`, which is not a
|
||||||
|
direct DAG, but is converted to, and resolved as one internally
|
||||||
|
8. `mappings` - the result of `vim.maps`
|
|
@ -6,8 +6,8 @@ addition for certain options is the [**DAG
|
||||||
type which is borrowed from home-manager's extended library. This type is most
|
type which is borrowed from home-manager's extended library. This type is most
|
||||||
used for topologically sorting strings. The DAG type allows the attribute set
|
used for topologically sorting strings. The DAG type allows the attribute set
|
||||||
entries to express dependency relations among themselves. This can, for
|
entries to express dependency relations among themselves. This can, for
|
||||||
example, be used to control the order of configuration sections in your
|
example, be used to control the order of configuration sections in your
|
||||||
`configRC` or `luaConfigRC`.
|
`luaConfigRC`.
|
||||||
|
|
||||||
The below section, mostly taken from the [home-manager
|
The below section, mostly taken from the [home-manager
|
||||||
manual](https://raw.githubusercontent.com/nix-community/home-manager/master/docs/manual/writing-modules/types.md)
|
manual](https://raw.githubusercontent.com/nix-community/home-manager/master/docs/manual/writing-modules/types.md)
|
||||||
|
|
|
@ -17,6 +17,10 @@ configuring.md
|
||||||
hacking.md
|
hacking.md
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```{=include=} appendix html:into-file=//plugins.html
|
||||||
|
plugins.md
|
||||||
|
```
|
||||||
|
|
||||||
```{=include=} appendix html:into-file=//options.html
|
```{=include=} appendix html:into-file=//options.html
|
||||||
options.md
|
options.md
|
||||||
```
|
```
|
||||||
|
|
16
docs/manual/plugins.md
Normal file
16
docs/manual/plugins.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Plugin specific quirks {#ch-plugins}
|
||||||
|
|
||||||
|
At times, certain plugins refuse to play nicely. Be it as a result of generating
|
||||||
|
lua from Nix, or the state of packaging. This page shall list any plugins that
|
||||||
|
are known to misbehave, and potential workarounds.
|
||||||
|
|
||||||
|
```{=include=} chapters
|
||||||
|
plugins/nodejs.md
|
||||||
|
```
|
||||||
|
<!--
|
||||||
|
If adding a new section, uncomment this part and add your page to
|
||||||
|
plugins/<page>.md
|
||||||
|
```{=include=} chapters
|
||||||
|
plugins/page.md
|
||||||
|
```
|
||||||
|
-->
|
18
docs/manual/plugins/nodejs.md
Normal file
18
docs/manual/plugins/nodejs.md
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# NodeJS {#ch-plugins-nodejs}
|
||||||
|
|
||||||
|
## eslint-plugin-prettier {#sec-eslint-plugin-prettier}
|
||||||
|
|
||||||
|
When working with NodeJS, everything works as expected, but some projects have settings that can fool nvf.
|
||||||
|
|
||||||
|
If [this plugin](https://github.com/prettier/eslint-plugin-prettier) or similar is included, you might get a situation where your eslint configuration diagnoses your formatting according to its own config (usually `.eslintrc.js`).
|
||||||
|
|
||||||
|
The issue there is your formatting is made via prettierd.
|
||||||
|
|
||||||
|
This results in auto-formating relying on your prettier config, while your eslint config diagnoses formatting [which it's not supposed to](https://prettier.io/docs/en/comparison.html))
|
||||||
|
|
||||||
|
In the end, you get discrepancies between what your editor does and what it wants.
|
||||||
|
|
||||||
|
Solutions are:
|
||||||
|
|
||||||
|
1. Don't add a formatting config to eslint, and separate prettier and eslint.
|
||||||
|
2. PR this repo to add an ESLint formatter and configure nvf to use it.
|
|
@ -5,7 +5,6 @@ Below are the commands you may run to try out different configurations provided
|
||||||
configurations are provided:
|
configurations are provided:
|
||||||
|
|
||||||
- Nix
|
- Nix
|
||||||
- Tidal
|
|
||||||
- Maximal
|
- Maximal
|
||||||
|
|
||||||
You may try out any of the provided configurations using the `nix run` command on a system where Nix is installed.
|
You may try out any of the provided configurations using the `nix run` command on a system where Nix is installed.
|
||||||
|
@ -22,7 +21,6 @@ once you garbage collect.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix run github:notashelf/nvf#nix
|
$ nix run github:notashelf/nvf#nix
|
||||||
$ nix run github:notashelf/nvf#tidal
|
|
||||||
$ nix run github:notashelf/nvf#maximal
|
$ nix run github:notashelf/nvf#maximal
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -33,10 +31,6 @@ $ nix run github:notashelf/nvf#maximal
|
||||||
`Nix` configuration by default provides LSP/diagnostic support for Nix alongisde a set of visual and functional plugins.
|
`Nix` configuration by default provides LSP/diagnostic support for Nix alongisde a set of visual and functional plugins.
|
||||||
By running `nix run .#`, which is the default package, you will build Neovim with this config.
|
By running `nix run .#`, which is the default package, you will build Neovim with this config.
|
||||||
|
|
||||||
#### Tidal {#sec-configs-tidal}
|
|
||||||
|
|
||||||
Tidal is an alternative config that adds vim-tidal on top of the plugins from the Nix configuration.
|
|
||||||
|
|
||||||
#### Maximal {#sec-configs-maximal}
|
#### Maximal {#sec-configs-maximal}
|
||||||
|
|
||||||
`Maximal` is the ultimate configuration that will enable support for more commonly used language as well as additional
|
`Maximal` is the ultimate configuration that will enable support for more commonly used language as well as additional
|
||||||
|
|
|
@ -10,4 +10,5 @@ rl-0.3.md
|
||||||
rl-0.4.md
|
rl-0.4.md
|
||||||
rl-0.5.md
|
rl-0.5.md
|
||||||
rl-0.6.md
|
rl-0.6.md
|
||||||
|
rl-0.7.md
|
||||||
```
|
```
|
||||||
|
|
|
@ -83,7 +83,7 @@ Release notes for release 0.5
|
||||||
|
|
||||||
- Updated indent-blankine.nvim to v3 - this comes with a few option changes, which will be migrated with `renamedOptionModule`
|
- Updated indent-blankine.nvim to v3 - this comes with a few option changes, which will be migrated with `renamedOptionModule`
|
||||||
|
|
||||||
[jacekpoz](https://github.com/jacekpoz):
|
[jacekpoz](https://jacekpoz.pl):
|
||||||
|
|
||||||
- Fixed scrollOffset not being used
|
- Fixed scrollOffset not being used
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap =
|
||||||
|
|
||||||
- Added rose-pine theme.
|
- Added rose-pine theme.
|
||||||
|
|
||||||
[jacekpoz](https://github.com/jacekpoz):
|
[jacekpoz](https://jacekpoz.pl):
|
||||||
|
|
||||||
- Added `vim.autocomplete.alwaysComplete`. Allows users to have the autocomplete window popup only when manually activated.
|
- Added `vim.autocomplete.alwaysComplete`. Allows users to have the autocomplete window popup only when manually activated.
|
||||||
|
|
||||||
|
|
222
docs/release-notes/rl-0.7.md
Normal file
222
docs/release-notes/rl-0.7.md
Normal file
|
@ -0,0 +1,222 @@
|
||||||
|
# Release 0.7 {#sec-release-0.7}
|
||||||
|
|
||||||
|
Release notes for release 0.7
|
||||||
|
|
||||||
|
## Breaking Changes and Migration Guide {#sec-breaking-changes-and-migration-guide-0-7}
|
||||||
|
|
||||||
|
### `vim.configRC` removed {#sec-vim-configrc-removed}
|
||||||
|
|
||||||
|
In v0.7 we are removing `vim.configRC` in favor of making `vim.luaConfigRC` the
|
||||||
|
top-level DAG, and thereby making the entire configuration Lua based. This
|
||||||
|
change introduces a few breaking changes:
|
||||||
|
|
||||||
|
[DAG entries in nvf manual]: /index.xhtml#ch-dag-entries
|
||||||
|
|
||||||
|
- `vim.configRC` has been removed, which means that you have to convert all of
|
||||||
|
your custom vimscript-based configuration to Lua. As for how to do that, you
|
||||||
|
will have to consult the Neovim documentation and your search engine.
|
||||||
|
- After migrating your Vimscript-based configuration to Lua, you might not be
|
||||||
|
able to use the same entry names in `vim.luaConfigRC`, because those have also
|
||||||
|
slightly changed. See the new [DAG entries in nvf manual] for more details.
|
||||||
|
|
||||||
|
**Why?**
|
||||||
|
|
||||||
|
Neovim being an aggressive refactor of Vim, is designed to be mainly Lua based;
|
||||||
|
making good use of its extensive Lua API. Additionally, Vimscript is slow and
|
||||||
|
brings unnecessary performance overhead while working with different
|
||||||
|
configuration formats.
|
||||||
|
|
||||||
|
### `vim.lsp.nvimCodeActionMenu` removed in favor of `vim.ui.fastaction` {#sec-nvim-code-action-menu-deprecation}
|
||||||
|
|
||||||
|
The nvim-code-action-menu plugin has been archived and broken for a long time,
|
||||||
|
so it's being replaced with a young, but better alternative called
|
||||||
|
fastaction.nvim. Simply remove everything set under
|
||||||
|
`vim.lsp.nvimCodeActionMenu`, and set `vim.ui.fastaction.enable` to `true`.
|
||||||
|
|
||||||
|
Note that we are looking to add more alternatives in the future like
|
||||||
|
dressing.nvim and actions-preview.nvim, in case fastaction doesn't work for
|
||||||
|
everyone.
|
||||||
|
|
||||||
|
## Changelog {#sec-release-0.7-changelog}
|
||||||
|
|
||||||
|
[ItsSorae](https://github.com/ItsSorae):
|
||||||
|
|
||||||
|
- Add support for [typst](https://typst.app/) under `vim.languages.typst` This
|
||||||
|
will enable the `typst-lsp` language server, and the `typstfmt` formatter
|
||||||
|
|
||||||
|
[frothymarrow](https://github.com/frothymarrow):
|
||||||
|
|
||||||
|
- Modified type for
|
||||||
|
[](#opt-vim.visuals.fidget-nvim.setupOpts.progress.display.overrides) from
|
||||||
|
`anything` to a `submodule` for better type checking.
|
||||||
|
|
||||||
|
- Fix null `vim.lsp.mappings` generating an error and not being filtered out.
|
||||||
|
|
||||||
|
- Add basic transparency support for `oxocarbon` theme by setting the highlight
|
||||||
|
group for `Normal`, `NormalFloat`, `LineNr`, `SignColumn` and optionally
|
||||||
|
`NvimTreeNormal` to `none`.
|
||||||
|
|
||||||
|
- Fix [](#opt-vim.ui.smartcolumn.setupOpts.custom_colorcolumn) using the wrong
|
||||||
|
type `int` instead of the expected type `string`.
|
||||||
|
|
||||||
|
[horriblename](https://github.com/horriblename):
|
||||||
|
|
||||||
|
- Fix broken treesitter-context keybinds in visual mode
|
||||||
|
- Deprecate use of `__empty` to define empty tables in Lua. Empty attrset are no
|
||||||
|
longer filtered and thus should be used instead.
|
||||||
|
- Add dap-go for better dap configurations
|
||||||
|
- Make noice.nvim customizable
|
||||||
|
- Standardize border style options and add custom borders
|
||||||
|
|
||||||
|
[rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim
|
||||||
|
[rustaceanvim]: https://github.com/mrcjkb/rustaceanvim
|
||||||
|
|
||||||
|
- Switch from [rust-tools.nvim] to the more feature-packed [rustaceanvim]. This
|
||||||
|
switch entails a whole bunch of new features and options, so you are
|
||||||
|
recommended to go through rustacean.nvim's README to take a closer look at its
|
||||||
|
features and usage
|
||||||
|
|
||||||
|
[jacekpoz](https://jacekpoz.pl):
|
||||||
|
|
||||||
|
[ocaml-lsp]: https://github.com/ocaml/ocaml-lsp
|
||||||
|
[new-file-template.nvim]: https://github.com/otavioschwanck/new-file-template.nvim
|
||||||
|
[neo-tree.nvim]: https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||||
|
|
||||||
|
- Add [ocaml-lsp] support
|
||||||
|
|
||||||
|
- Fix "Emac" typo
|
||||||
|
|
||||||
|
- Add [new-file-template.nvim] to automatically fill new file contents using
|
||||||
|
templates
|
||||||
|
|
||||||
|
- Make [neo-tree.nvim] display file icons properly by enabling
|
||||||
|
`visuals.nvimWebDevicons`
|
||||||
|
|
||||||
|
[diniamo](https://github.com/diniamo):
|
||||||
|
|
||||||
|
- Move the `theme` dag entry to before `luaScript`.
|
||||||
|
|
||||||
|
- Add rustfmt as the default formatter for Rust.
|
||||||
|
|
||||||
|
- Enabled the terminal integration of catppuccin for theming Neovim's built-in
|
||||||
|
terminal (this also affects toggleterm).
|
||||||
|
|
||||||
|
- Migrate bufferline to setupOpts for more customizability
|
||||||
|
|
||||||
|
- Use `clangd` as the default language server for C languages
|
||||||
|
|
||||||
|
- Expose `lib.nvim.types.pluginType`, which for example allows the user to
|
||||||
|
create abstractions for adding plugins
|
||||||
|
|
||||||
|
- Migrate indent-blankline to setupOpts for more customizability. While the
|
||||||
|
plugin's options can now be found under `indentBlankline.setupOpts`, the
|
||||||
|
previous iteration of the module also included out of place/broken options,
|
||||||
|
which have been removed for the time being. These are:
|
||||||
|
|
||||||
|
- `listChar` - this was already unused
|
||||||
|
- `fillChar` - this had nothing to do with the plugin, please configure it
|
||||||
|
yourself by adding `vim.opt.listchars:append({ space = '<char>' })` to your
|
||||||
|
lua configuration
|
||||||
|
- `eolChar` - this also had nothing to do with the plugin, please configure it
|
||||||
|
yourself by adding `vim.opt.listchars:append({ eol = '<char>' })` to your
|
||||||
|
lua configuration
|
||||||
|
|
||||||
|
- Replace `vim.lsp.nvimCodeActionMenu` with `vim.ui.fastaction`, see the
|
||||||
|
breaking changes section above for more details
|
||||||
|
|
||||||
|
[Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd()
|
||||||
|
|
||||||
|
- Make Neovim's configuration file entirely Lua based. This comes with a few
|
||||||
|
breaking changes:
|
||||||
|
- `vim.configRC` has been removed. You will need to migrate your entries to
|
||||||
|
Neovim-compliant Lua code, and add them to `vim.luaConfigRC` instead.
|
||||||
|
Existing vimscript configurations may be preserved in `vim.cmd` functions.
|
||||||
|
Please see [Neovim documentation on `vim.cmd`]
|
||||||
|
- `vim.luaScriptRC` is now the top-level DAG, and the internal `vim.pluginRC`
|
||||||
|
has been introduced for setting up internal plugins. See the "DAG entries in
|
||||||
|
nvf" manual page for more information.
|
||||||
|
|
||||||
|
[NotAShelf](https://github.com/notashelf):
|
||||||
|
|
||||||
|
[ts-error-translator.nvim]: https://github.com/dmmulroy/ts-error-translator.nvim
|
||||||
|
[credo]: https://github.com/rrrene/credo
|
||||||
|
|
||||||
|
- Add `deno fmt` as the default Markdown formatter. This will be enabled
|
||||||
|
automatically if you have autoformatting enabled, but can be disabled manually
|
||||||
|
if you choose to.
|
||||||
|
|
||||||
|
- Add `vim.extraLuaFiles` for optionally sourcing additional lua files in your
|
||||||
|
configuration.
|
||||||
|
|
||||||
|
- Refactor `programs.languages.elixir` to use lspconfig and none-ls for LSP and
|
||||||
|
formatter setups respectively. Diagnostics support is considered, and may be
|
||||||
|
added once the [credo] linter has been added to nixpkgs. A pull request is
|
||||||
|
currently open.
|
||||||
|
|
||||||
|
- Remove vim-tidal and friends.
|
||||||
|
|
||||||
|
- Clean up Lualine module to reduce theme dependency on Catppuccin, and fixed
|
||||||
|
blending issues in component separators.
|
||||||
|
|
||||||
|
- Add [ts-ereror-translator.nvim] extension of the TS language module, under
|
||||||
|
`vim.languages.ts.extensions.ts-error-translator` to aid with Typescript
|
||||||
|
development.
|
||||||
|
|
||||||
|
- Add [neo-tree.nvim] as an alternative file-tree plugin. It will be available
|
||||||
|
under `vim.filetree.neo-tree`, similar to nvimtree.
|
||||||
|
|
||||||
|
- Add `nvf-print-config` & `nvf-print-config-path` helper scripts to Neovim
|
||||||
|
closure. Both of those scripts have been automatically added to your PATH upon
|
||||||
|
using neovimConfig or `programs.nvf.enable`.
|
||||||
|
|
||||||
|
- `nvf-print-config` will display your `init.lua`, in full.
|
||||||
|
- `nvf-print-config-path` will display the path to _a clone_ of your
|
||||||
|
`init.lua`. This is not the path used by the Neovim wrapper, but an
|
||||||
|
identical clone.
|
||||||
|
|
||||||
|
- Add `vim.ui.breadcrumbs.lualine` to allow fine-tuning breadcrumbs behaviour on
|
||||||
|
Lualine. Only `vim.ui.breadcrumbs.lualine.winbar` is supported for the time
|
||||||
|
being.
|
||||||
|
|
||||||
|
- [](#opt-vim.ui.breadcrumbs.lualine.winbar.enable) has been added to allow
|
||||||
|
controlling the default behaviour of the `nvim-navic` component on Lualine,
|
||||||
|
which used to occupy `winbar.lualine_c` as long as breadcrumbs are enabled.
|
||||||
|
- `vim.ui.breadcrumbs.alwaysRender` has been renamed to
|
||||||
|
[](#opt-vim.ui.breadcrumbs.lualine.winbar.alwaysRender) to be conform to the
|
||||||
|
new format.
|
||||||
|
|
||||||
|
- Add [basedpyright](https://github.com/detachhead/basedpyright) as a Python LSP
|
||||||
|
server and make it default.
|
||||||
|
|
||||||
|
- Add [python-lsp-server](https://github.com/python-lsp/python-lsp-server) as an
|
||||||
|
additional Python LSP server.
|
||||||
|
|
||||||
|
- Add [](#opt-vim.options) to set `vim.o` values in in your nvf configuration
|
||||||
|
without using additional Lua. See option documentation for more details.
|
||||||
|
|
||||||
|
- Add [](#opt-vim.dashboard.dashboard-nvim.setupOpts) to allow user
|
||||||
|
configuration for [dashboard.nvim](https://github.com/nvimdev/dashboard-nvim)
|
||||||
|
|
||||||
|
- Update `lualine.nvim` input and add missing themes:
|
||||||
|
- Adds `ayu`, `gruvbox_dark`, `iceberg`, `moonfly`, `onedark`,
|
||||||
|
`powerline_dark` and `solarized_light` themes.
|
||||||
|
|
||||||
|
[ppenguin](https://github.com/ppenguin):
|
||||||
|
|
||||||
|
- Telescope:
|
||||||
|
- Fixed `project-nvim` command and keybinding
|
||||||
|
- Added default ikeybind/command for `Telescope resume` (`<leader>fr`)
|
||||||
|
|
||||||
|
[Soliprem](https://github.com/Soliprem):
|
||||||
|
|
||||||
|
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
||||||
|
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
||||||
|
ccc
|
||||||
|
|
||||||
|
[Bloxx12](https://github.com/Bloxx12):
|
||||||
|
|
||||||
|
- Fix internal breakage in `elixir-tools` setup.
|
||||||
|
|
||||||
|
[Nowaaru](https://github.com/Nowaaru):
|
||||||
|
|
||||||
|
- Add `precognition-nvim`.
|
751
flake.lock
751
flake.lock
File diff suppressed because it is too large
Load diff
140
flake.nix
140
flake.nix
|
@ -1,19 +1,22 @@
|
||||||
{
|
{
|
||||||
description = "A neovim flake with a modular configuration";
|
description = "A neovim flake with a modular configuration";
|
||||||
outputs = {
|
outputs = {
|
||||||
nixpkgs,
|
|
||||||
flake-parts,
|
flake-parts,
|
||||||
self,
|
self,
|
||||||
...
|
...
|
||||||
} @ inputs:
|
} @ inputs: let
|
||||||
flake-parts.lib.mkFlake {inherit inputs;} {
|
# call the extedended library with `inputs`
|
||||||
# provide overridable systems
|
# inputs is used to get the original standard library, and to pass inputs to the plugin autodiscovery function
|
||||||
# https://github.com/nix-systems/nix-systems
|
lib = import ./lib/stdlib-extended.nix inputs;
|
||||||
|
in
|
||||||
|
flake-parts.lib.mkFlake {
|
||||||
|
inherit inputs;
|
||||||
|
specialArgs = {inherit lib;};
|
||||||
|
} {
|
||||||
|
# Allow users to bring their own systems.
|
||||||
|
# «https://github.com/nix-systems/nix-systems»
|
||||||
systems = import inputs.systems;
|
systems = import inputs.systems;
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
# add lib to module args
|
|
||||||
{_module.args = {inherit (nixpkgs) lib;};}
|
|
||||||
./flake/apps.nix
|
./flake/apps.nix
|
||||||
./flake/legacyPackages.nix
|
./flake/legacyPackages.nix
|
||||||
./flake/overlays.nix
|
./flake/overlays.nix
|
||||||
|
@ -22,36 +25,32 @@
|
||||||
|
|
||||||
flake = {
|
flake = {
|
||||||
lib = {
|
lib = {
|
||||||
inherit (import ./lib/stdlib-extended.nix nixpkgs.lib inputs) nvim;
|
inherit (lib) nvim;
|
||||||
inherit (import ./configuration.nix inputs) neovimConfiguration;
|
inherit (lib.nvim) neovimConfiguration;
|
||||||
};
|
};
|
||||||
|
|
||||||
homeManagerModules = {
|
homeManagerModules = {
|
||||||
neovim-flake =
|
neovim-flake =
|
||||||
nixpkgs.lib.warn ''
|
lib.warn ''
|
||||||
homeManagerModules.neovim-flake has been deprecated.
|
homeManagerModules.neovim-flake has been deprecated.
|
||||||
Plese use the homeManagereModules.nvf instead
|
Plese use the homeManagerModules.nvf instead
|
||||||
''
|
''
|
||||||
self.homeManagerModules.nvf;
|
self.homeManagerModules.nvf;
|
||||||
|
|
||||||
nvf = {
|
nvf = import ./flake/modules/home-manager.nix self.packages lib;
|
||||||
imports = [(import ./flake/modules/home-manager.nix self.packages inputs)];
|
|
||||||
};
|
|
||||||
|
|
||||||
default = self.homeManagerModules.nvf;
|
default = self.homeManagerModules.nvf;
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosModules = {
|
nixosModules = {
|
||||||
neovim-flake =
|
neovim-flake =
|
||||||
nixpkgs.lib.warn ''
|
lib.warn ''
|
||||||
nixosModules.neovim-flake has been deprecated.
|
nixosModules.neovim-flake has been deprecated.
|
||||||
Please use the nixosModules.nvf instead
|
Please use the nixosModules.nvf instead
|
||||||
''
|
''
|
||||||
self.nixosModules.neovim-flake;
|
self.nixosModules.nvf;
|
||||||
|
|
||||||
nvf = {
|
nvf = import ./flake/modules/nixos.nix self.packages lib;
|
||||||
imports = [(import ./flake/modules/nixos.nix self.packages inputs)];
|
|
||||||
};
|
|
||||||
|
|
||||||
default = self.nixosModules.nvf;
|
default = self.nixosModules.nvf;
|
||||||
};
|
};
|
||||||
|
@ -63,34 +62,49 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
formatter = pkgs.alejandra;
|
|
||||||
devShells = {
|
devShells = {
|
||||||
default = self'.devShells.lsp;
|
default = self'.devShells.lsp;
|
||||||
nvim-nix = pkgs.mkShell {nativeBuildInputs = [config.packages.nix];};
|
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
|
||||||
lsp = pkgs.mkShell {
|
lsp = pkgs.mkShell {
|
||||||
nativeBuildInputs = with pkgs; [nil statix deadnix alejandra];
|
packages = with pkgs; [nil statix deadnix alejandra];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Provide the default formatter. `nix fmt` in project root
|
||||||
|
# will format available files with the correct formatter.
|
||||||
|
# P.S: Please do not format with nixfmt! It messes with many
|
||||||
|
# syntax elements and results in unreadable code.
|
||||||
|
formatter = pkgs.alejandra;
|
||||||
|
|
||||||
|
# Check if codebase is properly formatted.
|
||||||
|
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
|
||||||
|
# or with `nix flake check`
|
||||||
|
checks = {
|
||||||
|
nix-fmt = pkgs.runCommand "nix-fmt-check" {nativeBuildInputs = [pkgs.alejandra];} ''
|
||||||
|
alejandra --check ${self} < /dev/null | tee $out
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Flake inputs
|
# Flake inputs
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
## Basic Inputs
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
systems.url = "github:nix-systems/default";
|
systems.url = "github:nix-systems/default";
|
||||||
|
|
||||||
|
# Alternate neovim-wrapper
|
||||||
|
mnw.url = "github:Gerg-L/mnw";
|
||||||
|
|
||||||
# For generating documentation website
|
# For generating documentation website
|
||||||
nmd = {
|
nmd = {
|
||||||
url = "sourcehut:~rycee/nmd";
|
url = "sourcehut:~rycee/nmd";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: get zig from the zig overlay instead of nixpkgs
|
# Language servers (use master instead of nixpkgs)
|
||||||
zig.url = "github:mitchellh/zig-overlay";
|
|
||||||
|
|
||||||
# Langauge server (use master instead of nixpkgs)
|
|
||||||
rnix-lsp.url = "github:nix-community/rnix-lsp";
|
rnix-lsp.url = "github:nix-community/rnix-lsp";
|
||||||
nil = {
|
nil = {
|
||||||
url = "github:oxalica/nil";
|
url = "github:oxalica/nil";
|
||||||
|
@ -98,13 +112,7 @@
|
||||||
inputs.flake-utils.follows = "flake-utils";
|
inputs.flake-utils.follows = "flake-utils";
|
||||||
};
|
};
|
||||||
|
|
||||||
### Plugins
|
## Plugins
|
||||||
# Tidal cycles
|
|
||||||
tidalcycles = {
|
|
||||||
url = "github:mitchmindtree/tidalcycles.nix";
|
|
||||||
inputs.vim-tidal-src.url = "github:tidalcycles/vim-tidal";
|
|
||||||
};
|
|
||||||
|
|
||||||
# LSP plugins
|
# LSP plugins
|
||||||
plugin-nvim-lspconfig = {
|
plugin-nvim-lspconfig = {
|
||||||
url = "github:neovim/nvim-lspconfig";
|
url = "github:neovim/nvim-lspconfig";
|
||||||
|
@ -136,8 +144,8 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin-nvim-code-action-menu = {
|
plugin-fastaction-nvim = {
|
||||||
url = "github:weilbith/nvim-code-action-menu";
|
url = "github:Chaitanyabsprip/fastaction.nvim";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -162,14 +170,19 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
# language support
|
plugin-otter-nvim = {
|
||||||
|
url = "github:jmbuhr/otter.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Language support
|
||||||
plugin-sqls-nvim = {
|
plugin-sqls-nvim = {
|
||||||
url = "github:nanotee/sqls.nvim";
|
url = "github:nanotee/sqls.nvim";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin-rust-tools = {
|
plugin-rustaceanvim = {
|
||||||
url = "github:simrat39/rust-tools.nvim";
|
url = "github:mrcjkb/rustaceanvim";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -183,23 +196,13 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin-elixir-ls = {
|
|
||||||
url = "github:elixir-lsp/elixir-ls";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
plugin-elixir-tools = {
|
plugin-elixir-tools = {
|
||||||
url = "github:elixir-tools/elixir-tools.nvim";
|
url = "github:elixir-tools/elixir-tools.nvim";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin-glow-nvim = {
|
plugin-ts-error-translator = {
|
||||||
url = "github:ellisonleao/glow.nvim";
|
url = "github:dmmulroy/ts-error-translator.nvim";
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
plugin-image-nvim = {
|
|
||||||
url = "github:3rd/image.nvim";
|
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -231,12 +234,22 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin-nvim-dap-go = {
|
||||||
|
url = "github:leoluz/nvim-dap-go";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
# Filetrees
|
# Filetrees
|
||||||
plugin-nvim-tree-lua = {
|
plugin-nvim-tree-lua = {
|
||||||
url = "github:nvim-tree/nvim-tree.lua";
|
url = "github:nvim-tree/nvim-tree.lua";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin-neo-tree-nvim = {
|
||||||
|
url = "github:nvim-neo-tree/neo-tree.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
# Tablines
|
# Tablines
|
||||||
plugin-nvim-bufferline-lua = {
|
plugin-nvim-bufferline-lua = {
|
||||||
url = "github:akinsho/nvim-bufferline.lua";
|
url = "github:akinsho/nvim-bufferline.lua";
|
||||||
|
@ -502,6 +515,21 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin-glow-nvim = {
|
||||||
|
url = "github:ellisonleao/glow.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
plugin-image-nvim = {
|
||||||
|
url = "github:3rd/image.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
plugin-precognition-nvim = {
|
||||||
|
url = "github:tris203/precognition.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
# Note-taking
|
# Note-taking
|
||||||
plugin-obsidian-nvim = {
|
plugin-obsidian-nvim = {
|
||||||
url = "github:epwalsh/obsidian.nvim";
|
url = "github:epwalsh/obsidian.nvim";
|
||||||
|
@ -621,9 +649,15 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin-nvim-nio = {
|
plugin-nvim-nio = {
|
||||||
# (required nvim-dap-ui)
|
# (required by nvim-dap-ui)
|
||||||
url = "github:nvim-neotest/nvim-nio";
|
url = "github:nvim-neotest/nvim-nio";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin-new-file-template-nvim = {
|
||||||
|
# (required by new-file-template.nvim)
|
||||||
|
url = "github:otavioschwanck/new-file-template.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
{lib, ...}: {
|
{lib, ...}: let
|
||||||
perSystem = {
|
inherit (lib.meta) getExe;
|
||||||
system,
|
in {
|
||||||
config,
|
perSystem = {config, ...}: {
|
||||||
...
|
apps = {
|
||||||
}: {
|
nix.program = getExe config.packages.nix;
|
||||||
apps =
|
maximal.program = getExe config.packages.maximal;
|
||||||
{
|
default = config.apps.nix;
|
||||||
nix.program = lib.getExe config.packages.nix;
|
};
|
||||||
maximal.program = lib.getExe config.packages.maximal;
|
|
||||||
default = config.apps.nix;
|
|
||||||
}
|
|
||||||
// (
|
|
||||||
if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"])
|
|
||||||
then {
|
|
||||||
tidal.program = lib.getExe config.packages.tidal;
|
|
||||||
}
|
|
||||||
else {}
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
legacyPackages = import inputs.nixpkgs {
|
legacyPackages = import inputs.nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
overlays = [
|
overlays = [
|
||||||
inputs.tidalcycles.overlays.default
|
|
||||||
inputs.self.overlays.default
|
inputs.self.overlays.default
|
||||||
(_: _: {
|
(_: _: {
|
||||||
rnix-lsp = inputs'.rnix-lsp.defaultPackage;
|
rnix-lsp = inputs'.rnix-lsp.defaultPackage;
|
||||||
|
|
|
@ -1,40 +1,44 @@
|
||||||
# Home Manager module
|
# Home Manager module
|
||||||
packages: inputs: {
|
packages: lib: {
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
lib ? pkgs.lib,
|
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) maintainers;
|
inherit (lib) maintainers;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf mkAliasOptionModule;
|
||||||
inherit (lib.lists) optional;
|
inherit (lib.lists) optional;
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.types) attrsOf anything bool;
|
inherit (lib.types) attrsOf anything bool;
|
||||||
|
inherit (lib.nvim) neovimConfiguration;
|
||||||
|
inherit (lib.nvim.types) anythingConcatLists;
|
||||||
|
|
||||||
cfg = config.programs.neovim-flake;
|
cfg = config.programs.nvf;
|
||||||
inherit (import ../../configuration.nix inputs) neovimConfiguration;
|
|
||||||
|
|
||||||
neovimConfigured = neovimConfiguration {
|
neovimConfigured = neovimConfiguration {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
modules = [cfg.settings];
|
modules = [cfg.settings];
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
imports = [
|
||||||
|
(mkAliasOptionModule ["programs" "neovim-flake"] ["programs" "nvf"])
|
||||||
|
];
|
||||||
|
|
||||||
meta.maintainers = with maintainers; [NotAShelf];
|
meta.maintainers = with maintainers; [NotAShelf];
|
||||||
|
|
||||||
options.programs.neovim-flake = {
|
options.programs.nvf = {
|
||||||
enable = mkEnableOption "neovim-flake, the extensible neovim configuration wrapper";
|
enable = mkEnableOption "nvf, the extensible neovim configuration wrapper";
|
||||||
|
|
||||||
enableManpages = mkOption {
|
enableManpages = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Whether to enable manpages for neovim-flake.";
|
description = "Whether to enable manpages for nvf.";
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultEditor = mkOption {
|
defaultEditor = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
Whether to set `neovim-flake` as the default editor.
|
Whether to set `nvf` as the default editor.
|
||||||
|
|
||||||
This will set the `EDITOR` environment variable as `nvim`
|
This will set the `EDITOR` environment variable as `nvim`
|
||||||
if set to true.
|
if set to true.
|
||||||
|
@ -46,14 +50,14 @@ in {
|
||||||
visible = false;
|
visible = false;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
description = ''
|
description = ''
|
||||||
The built neovim-flake package, wrapped with the user's configuration.
|
The built nvf package, wrapped with the user's configuration.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = attrsOf anything;
|
type = attrsOf anythingConcatLists;
|
||||||
default = {};
|
default = {};
|
||||||
description = "Attribute set of neovim-flake preferences.";
|
description = "Attribute set of nvf preferences.";
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
{
|
{
|
||||||
vim.viAlias = false;
|
vim.viAlias = false;
|
||||||
|
@ -63,7 +67,6 @@ in {
|
||||||
formatOnSave = true;
|
formatOnSave = true;
|
||||||
lightbulb.enable = true;
|
lightbulb.enable = true;
|
||||||
lspsaga.enable = false;
|
lspsaga.enable = false;
|
||||||
nvimCodeActionMenu.enable = true;
|
|
||||||
trouble.enable = true;
|
trouble.enable = true;
|
||||||
lspSignature.enable = true;
|
lspSignature.enable = true;
|
||||||
rust.enable = false;
|
rust.enable = false;
|
||||||
|
@ -75,7 +78,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
programs.neovim-flake.finalPackage = neovimConfigured.neovim;
|
programs.nvf.finalPackage = neovimConfigured.neovim;
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
sessionVariables = mkIf cfg.defaultEditor {EDITOR = "nvim";};
|
sessionVariables = mkIf cfg.defaultEditor {EDITOR = "nvim";};
|
||||||
|
@ -84,4 +87,5 @@ in {
|
||||||
++ optional cfg.enableManpages packages.${pkgs.stdenv.system}.docs-manpages;
|
++ optional cfg.enableManpages packages.${pkgs.stdenv.system}.docs-manpages;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
_file = ./home-manager.nix;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +1,44 @@
|
||||||
# NixOS module
|
# NixOS module
|
||||||
packages: inputs: {
|
packages: lib: {
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
lib ? pkgs.lib,
|
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) maintainers;
|
inherit (lib) maintainers;
|
||||||
inherit (lib.modules) mkIf mkOverride;
|
inherit (lib.modules) mkIf mkOverride mkAliasOptionModule;
|
||||||
inherit (lib.lists) optional;
|
inherit (lib.lists) optional;
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.types) attrsOf anything bool;
|
inherit (lib.types) attrsOf anything bool;
|
||||||
|
inherit (lib.nvim) neovimConfiguration;
|
||||||
|
inherit (lib.nvim.types) anythingConcatLists;
|
||||||
|
|
||||||
cfg = config.programs.neovim-flake;
|
cfg = config.programs.nvf;
|
||||||
inherit (import ../../configuration.nix inputs) neovimConfiguration;
|
|
||||||
|
|
||||||
neovimConfigured = neovimConfiguration {
|
neovimConfigured = neovimConfiguration {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
modules = [cfg.settings];
|
modules = [cfg.settings];
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
imports = [
|
||||||
|
(mkAliasOptionModule ["programs" "neovim-flake"] ["programs" "nvf"])
|
||||||
|
];
|
||||||
|
|
||||||
meta.maintainers = with maintainers; [NotAShelf];
|
meta.maintainers = with maintainers; [NotAShelf];
|
||||||
|
|
||||||
options.programs.neovim-flake = {
|
options.programs.nvf = {
|
||||||
enable = mkEnableOption "neovim-flake, the extensible neovim configuration wrapper";
|
enable = mkEnableOption "nvf, the extensible neovim configuration wrapper";
|
||||||
|
|
||||||
enableManpages = mkOption {
|
enableManpages = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Whether to enable manpages for neovim-flake.";
|
description = "Whether to enable manpages for nvf.";
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultEditor = mkOption {
|
defaultEditor = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
Whether to set `neovim-flake` as the default editor.
|
Whether to set `nvf` as the default editor.
|
||||||
|
|
||||||
This will set the `EDITOR` environment variable as `nvim`
|
This will set the `EDITOR` environment variable as `nvim`
|
||||||
if set to true.
|
if set to true.
|
||||||
|
@ -46,14 +50,14 @@ in {
|
||||||
visible = false;
|
visible = false;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
description = ''
|
description = ''
|
||||||
The built neovim-flake package, wrapped with the user's configuration.
|
The built nvf package, wrapped with the user's configuration.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = attrsOf anything;
|
type = attrsOf anythingConcatLists;
|
||||||
default = {};
|
default = {};
|
||||||
description = "Attribute set of neovim-flake preferences.";
|
description = "Attribute set of nvf preferences.";
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
{
|
{
|
||||||
vim.viAlias = false;
|
vim.viAlias = false;
|
||||||
|
@ -63,7 +67,6 @@ in {
|
||||||
formatOnSave = true;
|
formatOnSave = true;
|
||||||
lightbulb.enable = true;
|
lightbulb.enable = true;
|
||||||
lspsaga.enable = false;
|
lspsaga.enable = false;
|
||||||
nvimCodeActionMenu.enable = true;
|
|
||||||
trouble.enable = true;
|
trouble.enable = true;
|
||||||
lspSignature.enable = true;
|
lspSignature.enable = true;
|
||||||
rust.enable = false;
|
rust.enable = false;
|
||||||
|
@ -75,7 +78,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
programs.neovim-flake.finalPackage = neovimConfigured.neovim;
|
programs.nvf.finalPackage = neovimConfigured.neovim;
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
variables.EDITOR = mkIf cfg.defaultEditor (mkOverride 900 "nvim");
|
variables.EDITOR = mkIf cfg.defaultEditor (mkOverride 900 "nvim");
|
||||||
|
@ -84,4 +87,5 @@ in {
|
||||||
++ optional cfg.enableManpages packages.${pkgs.stdenv.system}.docs-manpages;
|
++ optional cfg.enableManpages packages.${pkgs.stdenv.system}.docs-manpages;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
_file = ./nixos.nix;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,19 @@
|
||||||
{
|
{
|
||||||
inputs,
|
|
||||||
pkgs,
|
pkgs,
|
||||||
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (import ../configuration.nix inputs) neovimConfiguration mainConfig;
|
inherit (lib.nvim) neovimConfiguration;
|
||||||
|
|
||||||
buildPkg = pkgs: modules: (neovimConfiguration {inherit pkgs modules;}).neovim;
|
buildPkg = pkgs: modules: (neovimConfiguration {inherit pkgs modules;}).neovim;
|
||||||
|
|
||||||
nixConfig = mainConfig false;
|
nixConfig = import ../configuration.nix false;
|
||||||
maximalConfig = mainConfig true;
|
maximalConfig = import ../configuration.nix true;
|
||||||
tidalConfig = {config.vim.tidal.enable = true;};
|
|
||||||
in {
|
in {
|
||||||
flake.overlays.default = _final: prev: {
|
flake.overlays.default = _final: prev: {
|
||||||
inherit neovimConfiguration;
|
inherit neovimConfiguration;
|
||||||
neovim-nix = buildPkg prev [nixConfig];
|
neovim-nix = buildPkg prev [nixConfig];
|
||||||
neovim-maximal = buildPkg prev [maximalConfig];
|
neovim-maximal = buildPkg prev [maximalConfig];
|
||||||
neovim-tidal = buildPkg prev [tidalConfig];
|
|
||||||
devPkg = buildPkg pkgs [nixConfig {config.vim.languages.html.enable = pkgs.lib.mkForce true;}];
|
devPkg = buildPkg pkgs [nixConfig {config.vim.languages.html.enable = pkgs.lib.mkForce true;}];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,62 +1,57 @@
|
||||||
{inputs, ...}: {
|
{inputs, ...}: {
|
||||||
perSystem = {
|
perSystem = {
|
||||||
system,
|
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
docs = import ../docs {inherit pkgs inputs;};
|
docs = import ../docs {inherit pkgs inputs lib;};
|
||||||
in {
|
in {
|
||||||
packages =
|
packages = {
|
||||||
{
|
inherit (docs.manual) htmlOpenTool;
|
||||||
# Documentation
|
# Documentation
|
||||||
docs = docs.manual.html;
|
docs = docs.manual.html;
|
||||||
docs-html = docs.manual.html;
|
docs-html = docs.manual.html;
|
||||||
docs-manpages = docs.manPages;
|
docs-manpages = docs.manPages;
|
||||||
docs-json = docs.options.json;
|
docs-json = docs.options.json;
|
||||||
|
|
||||||
# Build and open the built manual in your system browser
|
# Build and open the built manual in your system browser
|
||||||
docs-html-wrapped = pkgs.writeScriptBin "docs-html-wrapped" ''
|
docs-html-wrapped = pkgs.writeScriptBin "docs-html-wrapped" ''
|
||||||
#!${pkgs.stdenv.shell}
|
#!${pkgs.stdenv.shell}
|
||||||
# use xdg-open to open the docs in the browser
|
# use xdg-open to open the docs in the browser
|
||||||
${pkgs.xdg_utils}/bin/xdg-open ${docs.manual.html}
|
${pkgs.xdg_utils}/bin/xdg-open ${docs.manual.html}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Exposed neovim configurations
|
# Exposed neovim configurations
|
||||||
nix = config.legacyPackages.neovim-nix;
|
nix = config.legacyPackages.neovim-nix;
|
||||||
maximal = config.legacyPackages.neovim-maximal;
|
maximal = config.legacyPackages.neovim-maximal;
|
||||||
default = config.legacyPackages.neovim-nix;
|
default = config.legacyPackages.neovim-nix;
|
||||||
|
|
||||||
# Published docker images
|
# Published docker images
|
||||||
docker-nix = let
|
docker-nix = let
|
||||||
inherit (pkgs) bash gitFull buildEnv dockerTools;
|
inherit (pkgs) bash gitFull buildEnv dockerTools;
|
||||||
inherit (config.legacyPackages) neovim-nix;
|
inherit (config.legacyPackages) neovim-nix;
|
||||||
in
|
in
|
||||||
dockerTools.buildImage {
|
dockerTools.buildImage {
|
||||||
name = "nvf";
|
name = "nvf";
|
||||||
tag = "latest";
|
tag = "latest";
|
||||||
|
|
||||||
copyToRoot = buildEnv {
|
copyToRoot = buildEnv {
|
||||||
name = "neovim-root";
|
name = "neovim-root";
|
||||||
pathsToLink = ["/bin"];
|
pathsToLink = ["/bin"];
|
||||||
paths = [
|
paths = [
|
||||||
neovim-nix
|
neovim-nix
|
||||||
gitFull
|
gitFull
|
||||||
bash
|
bash
|
||||||
];
|
];
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
|
||||||
Cmd = ["${neovim-nix}/bin/nvim"];
|
|
||||||
WorkingDir = "/home/neovim/demo";
|
|
||||||
Volumes = {"/home/neovim/demo" = {};};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
|
||||||
// (
|
config = {
|
||||||
if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"])
|
Cmd = ["${neovim-nix}/bin/nvim"];
|
||||||
then {tidal = config.legacyPackages.neovim-tidal;}
|
WorkingDir = "/home/neovim/demo";
|
||||||
else {}
|
Volumes = {"/home/neovim/demo" = {};};
|
||||||
);
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
mkSetLuaBinding = binding: action:
|
mkSetLuaBinding = binding: action:
|
||||||
mkLuaBinding binding.value action binding.description;
|
mkLuaBinding binding.value action binding.description;
|
||||||
|
|
||||||
pushDownDefault = attr: mapAttrs (_: value: mkDefault value) attr;
|
pushDownDefault = attr: mapAttrs (_: mkDefault) attr;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
binds
|
binds
|
||||||
|
|
29
lib/dag.nix
29
lib/dag.nix
|
@ -8,10 +8,10 @@
|
||||||
# - the addition of the function `entryBefore` indicating a "wanted
|
# - the addition of the function `entryBefore` indicating a "wanted
|
||||||
# by" relationship.
|
# by" relationship.
|
||||||
{lib}: let
|
{lib}: let
|
||||||
inherit (builtins) isAttrs attrValues attrNames elem all head tail length;
|
inherit (builtins) isAttrs attrValues attrNames elem all head tail length toJSON isString;
|
||||||
inherit (lib.attrsets) filterAttrs mapAttrs;
|
inherit (lib.attrsets) filterAttrs mapAttrs;
|
||||||
inherit (lib.lists) toposort;
|
inherit (lib.lists) toposort;
|
||||||
inherit (lib.nvim.dag) empty isEntry entryBetween entryAfter entriesBetween;
|
inherit (lib.nvim.dag) empty isEntry entryBetween entryAfter entriesBetween entryAnywhere topoSort;
|
||||||
in {
|
in {
|
||||||
empty = {};
|
empty = {};
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ in {
|
||||||
normalizedDag =
|
normalizedDag =
|
||||||
mapAttrs (n: v: {
|
mapAttrs (n: v: {
|
||||||
name = n;
|
name = n;
|
||||||
data = v.data;
|
inherit (v) data;
|
||||||
after = v.after ++ dagBefore dag n;
|
after = v.after ++ dagBefore dag n;
|
||||||
})
|
})
|
||||||
dag;
|
dag;
|
||||||
|
@ -117,7 +117,6 @@ in {
|
||||||
entriesBetween = tag: let
|
entriesBetween = tag: let
|
||||||
go = i: before: after: entries: let
|
go = i: before: after: entries: let
|
||||||
name = "${tag}-${toString i}";
|
name = "${tag}-${toString i}";
|
||||||
i' = i + 1;
|
|
||||||
in
|
in
|
||||||
if entries == []
|
if entries == []
|
||||||
then empty
|
then empty
|
||||||
|
@ -148,8 +147,22 @@ in {
|
||||||
${section.data}
|
${section.data}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
mkVimrcSection = section: ''
|
resolveDag = {
|
||||||
" SECTION: ${section.name}
|
name,
|
||||||
${section.data}
|
dag,
|
||||||
'';
|
mapResult,
|
||||||
|
}: let
|
||||||
|
# When the value is a string, default it to dag.entryAnywhere
|
||||||
|
finalDag = mapAttrs (_: value:
|
||||||
|
if isString value
|
||||||
|
then entryAnywhere value
|
||||||
|
else value)
|
||||||
|
dag;
|
||||||
|
sortedDag = topoSort finalDag;
|
||||||
|
result =
|
||||||
|
if sortedDag ? result
|
||||||
|
then mapResult sortedDag.result
|
||||||
|
else abort ("Dependency cycle in ${name}: " + toJSON sortedDag);
|
||||||
|
in
|
||||||
|
result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,5 +11,5 @@
|
||||||
languages = import ./languages.nix {inherit lib;};
|
languages = import ./languages.nix {inherit lib;};
|
||||||
lists = import ./lists.nix {inherit lib;};
|
lists = import ./lists.nix {inherit lib;};
|
||||||
lua = import ./lua.nix {inherit lib;};
|
lua = import ./lua.nix {inherit lib;};
|
||||||
vim = import ./vim.nix;
|
neovimConfiguration = import ../modules {inherit inputs lib;};
|
||||||
}
|
}
|
||||||
|
|
24
lib/lua.nix
24
lib/lua.nix
|
@ -2,19 +2,9 @@
|
||||||
{lib}: let
|
{lib}: let
|
||||||
inherit (builtins) hasAttr head throw typeOf isList isAttrs isBool isInt isString isPath isFloat toJSON;
|
inherit (builtins) hasAttr head throw typeOf isList isAttrs isBool isInt isString isPath isFloat toJSON;
|
||||||
inherit (lib.attrsets) mapAttrsToList filterAttrs;
|
inherit (lib.attrsets) mapAttrsToList filterAttrs;
|
||||||
inherit (lib.strings) concatStringsSep concatMapStringsSep stringToCharacters;
|
inherit (lib.strings) concatStringsSep concatMapStringsSep stringToCharacters concatLines;
|
||||||
inherit (lib.trivial) boolToString;
|
inherit (lib.trivial) boolToString warn;
|
||||||
in rec {
|
in rec {
|
||||||
wrapLuaConfig = {
|
|
||||||
luaBefore ? "",
|
|
||||||
luaConfig,
|
|
||||||
luaAfter ? "",
|
|
||||||
}: ''
|
|
||||||
lua << EOF
|
|
||||||
${concatStringsSep "\n" [luaBefore luaConfig luaAfter]}
|
|
||||||
EOF
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Convert a null value to lua's nil
|
# Convert a null value to lua's nil
|
||||||
nullString = value:
|
nullString = value:
|
||||||
if value == null
|
if value == null
|
||||||
|
@ -66,7 +56,10 @@ in rec {
|
||||||
if isLuaInline args
|
if isLuaInline args
|
||||||
then args.expr
|
then args.expr
|
||||||
else if hasAttr "__empty" args
|
else if hasAttr "__empty" args
|
||||||
then "{ }"
|
then
|
||||||
|
warn ''
|
||||||
|
Using `__empty` to define an empty lua table is deprecated. Use an empty attrset instead.
|
||||||
|
'' "{ }"
|
||||||
else
|
else
|
||||||
"{"
|
"{"
|
||||||
+ (concatStringsSep ","
|
+ (concatStringsSep ","
|
||||||
|
@ -76,10 +69,7 @@ in rec {
|
||||||
then toLuaObject v
|
then toLuaObject v
|
||||||
else "[${toLuaObject n}] = " + (toLuaObject v))
|
else "[${toLuaObject n}] = " + (toLuaObject v))
|
||||||
(filterAttrs
|
(filterAttrs
|
||||||
(
|
(_: v: v != null)
|
||||||
_: v:
|
|
||||||
(v != null) && (toLuaObject v != "{}")
|
|
||||||
)
|
|
||||||
args)))
|
args)))
|
||||||
+ "}"
|
+ "}"
|
||||||
else if isList args
|
else if isList args
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Convenience function that returns the given Nixpkgs standard library
|
# Convenience function that returns the given Nixpkgs standard library
|
||||||
# extended with our functions using `lib.extend`.
|
# extended with our functions using `lib.extend`.
|
||||||
nixpkgsLib: inputs:
|
inputs:
|
||||||
nixpkgsLib.extend (self: super: {
|
inputs.nixpkgs.lib.extend (self: super: {
|
||||||
# WARNING: New functions should not be added here, but to files
|
# WARNING: New functions should not be added here, but to files
|
||||||
# imported by `./default.nix` under their own categories. If your
|
# imported by `./default.nix` under their own categories. If your
|
||||||
# function does not fit to any of the existing categories, create
|
# function does not fit to any of the existing categories, create
|
||||||
|
|
61
lib/types/custom.nix
Normal file
61
lib/types/custom.nix
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
{lib}: let
|
||||||
|
inherit (lib) isStringLike showOption showFiles getFiles mergeOneOption mergeEqualOption mkOptionType;
|
||||||
|
inherit (lib.types) anything attrsOf;
|
||||||
|
inherit (lib.nvim.types) anythingConcatLists;
|
||||||
|
inherit (builtins) typeOf isAttrs any head concatLists stringLength;
|
||||||
|
in {
|
||||||
|
# HACK: Does this break anything in our case?
|
||||||
|
# A modified version of the nixpkgs anything type that concatenates lists
|
||||||
|
# This isn't the default because the order in which the lists are concatenated depends on the order in which the modules are imported,
|
||||||
|
# which makes it non-deterministic
|
||||||
|
anythingConcatLists =
|
||||||
|
anything
|
||||||
|
// {
|
||||||
|
merge = loc: defs: let
|
||||||
|
getType = value:
|
||||||
|
if isAttrs value && isStringLike value
|
||||||
|
then "stringCoercibleSet"
|
||||||
|
else typeOf value;
|
||||||
|
|
||||||
|
# Throw an error if not all defs have the same type
|
||||||
|
checkType = getType (head defs).value;
|
||||||
|
commonType =
|
||||||
|
if any (def: getType def.value != checkType) defs
|
||||||
|
then throw "The option `${showOption loc}' has conflicting option types in ${showFiles (getFiles defs)}"
|
||||||
|
else checkType;
|
||||||
|
|
||||||
|
mergeFunctions = {
|
||||||
|
# Recursively merge attribute sets
|
||||||
|
set = (attrsOf anythingConcatLists).merge;
|
||||||
|
|
||||||
|
# Overridden behavior for lists, that concatenates lists
|
||||||
|
list = _: defs: concatLists (map (e: e.value) defs);
|
||||||
|
|
||||||
|
# This means it's a package, only accept a single definition
|
||||||
|
stringCoercibleSet = mergeOneOption;
|
||||||
|
|
||||||
|
# This works by passing the argument to the functions,
|
||||||
|
# and merging their returns values instead
|
||||||
|
lambda = loc: defs: arg:
|
||||||
|
anythingConcatLists.merge
|
||||||
|
(loc ++ ["<function body>"])
|
||||||
|
(map (def: {
|
||||||
|
inherit (def) file;
|
||||||
|
value = def.value arg;
|
||||||
|
})
|
||||||
|
defs);
|
||||||
|
};
|
||||||
|
in
|
||||||
|
# Merge the defs with the correct function from above, if available
|
||||||
|
# otherwise only allow equal values
|
||||||
|
(mergeFunctions.${commonType} or mergeEqualOption) loc defs;
|
||||||
|
};
|
||||||
|
|
||||||
|
char = mkOptionType {
|
||||||
|
name = "char";
|
||||||
|
description = "character";
|
||||||
|
descriptionClass = "noun";
|
||||||
|
check = value: stringLength value < 2;
|
||||||
|
merge = mergeEqualOption;
|
||||||
|
};
|
||||||
|
}
|
|
@ -6,8 +6,10 @@
|
||||||
typesDag = import ./dag.nix {inherit lib;};
|
typesDag = import ./dag.nix {inherit lib;};
|
||||||
typesPlugin = import ./plugins.nix {inherit inputs lib;};
|
typesPlugin = import ./plugins.nix {inherit inputs lib;};
|
||||||
typesLanguage = import ./languages.nix {inherit lib;};
|
typesLanguage = import ./languages.nix {inherit lib;};
|
||||||
|
typesCustom = import ./custom.nix {inherit lib;};
|
||||||
in {
|
in {
|
||||||
inherit (typesDag) dagOf;
|
inherit (typesDag) dagOf;
|
||||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline;
|
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
||||||
inherit (typesLanguage) diagnostics mkGrammarOption;
|
inherit (typesLanguage) diagnostics mkGrammarOption;
|
||||||
|
inherit (typesCustom) anythingConcatLists char;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.attrsets) attrNames mapAttrs' filterAttrs nameValuePair;
|
inherit (lib.attrsets) attrNames mapAttrs' filterAttrs nameValuePair;
|
||||||
inherit (lib.strings) hasPrefix removePrefix isString;
|
inherit (lib.strings) hasPrefix removePrefix;
|
||||||
inherit (lib.types) submodule either package enum str lines attrsOf anything listOf nullOr;
|
inherit (lib.types) submodule either package enum str lines attrsOf anything listOf nullOr;
|
||||||
|
|
||||||
# Get the names of all flake inputs that start with the given prefix.
|
# Get the names of all flake inputs that start with the given prefix.
|
||||||
|
@ -51,8 +51,12 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
borderPresets = ["none" "single" "double" "rounded" "solid" "shadow"];
|
||||||
in {
|
in {
|
||||||
inherit extraPluginType fromInputs;
|
inherit extraPluginType fromInputs pluginType;
|
||||||
|
|
||||||
|
borderType = either (enum borderPresets) (listOf (either str (listOf str)));
|
||||||
|
|
||||||
pluginsOpt = {
|
pluginsOpt = {
|
||||||
description,
|
description,
|
||||||
|
@ -93,7 +97,7 @@ in {
|
||||||
|
|
||||||
default = {};
|
default = {};
|
||||||
type = submodule {
|
type = submodule {
|
||||||
freeformType = attrsOf anything;
|
freeformType = anything;
|
||||||
options = opts;
|
options = opts;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
26
lib/vim.nix
26
lib/vim.nix
|
@ -1,26 +0,0 @@
|
||||||
let
|
|
||||||
inherit (builtins) isInt isBool toJSON toString;
|
|
||||||
in rec {
|
|
||||||
# yes? no.
|
|
||||||
yesNo = value:
|
|
||||||
if value
|
|
||||||
then "yes"
|
|
||||||
else "no";
|
|
||||||
|
|
||||||
# convert a boolean to a vim compliant boolean string
|
|
||||||
mkVimBool = val:
|
|
||||||
if val
|
|
||||||
then "1"
|
|
||||||
else "0";
|
|
||||||
|
|
||||||
# convert a literal value to a vim compliant value
|
|
||||||
valToVim = val:
|
|
||||||
if (isInt val)
|
|
||||||
then (toString val)
|
|
||||||
else
|
|
||||||
(
|
|
||||||
if (isBool val)
|
|
||||||
then (mkVimBool val)
|
|
||||||
else (toJSON val)
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,124 +1,134 @@
|
||||||
inputs: {
|
{
|
||||||
configuration,
|
inputs,
|
||||||
|
lib,
|
||||||
|
}: {
|
||||||
pkgs,
|
pkgs,
|
||||||
lib ? pkgs.lib,
|
|
||||||
check ? true,
|
|
||||||
extraSpecialArgs ? {},
|
extraSpecialArgs ? {},
|
||||||
|
modules ? [],
|
||||||
|
# deprecated
|
||||||
extraModules ? [],
|
extraModules ? [],
|
||||||
|
configuration ? {},
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) map filter isString toString getAttr;
|
inherit (pkgs) vimPlugins;
|
||||||
inherit (pkgs) wrapNeovimUnstable vimPlugins;
|
inherit (lib.strings) isString toString;
|
||||||
inherit (pkgs.vimUtils) buildVimPlugin;
|
inherit (lib.lists) filter map concatLists;
|
||||||
inherit (pkgs.neovimUtils) makeNeovimConfig;
|
|
||||||
inherit (lib.strings) makeBinPath escapeShellArgs concatStringsSep;
|
|
||||||
inherit (lib.lists) concatLists optional;
|
|
||||||
inherit (lib.attrsets) recursiveUpdate;
|
|
||||||
inherit (lib.asserts) assertMsg;
|
|
||||||
|
|
||||||
# call the extedended library with `lib` and `inputs` as arguments
|
|
||||||
# lib is used to provide the standard library functions to the extended library
|
|
||||||
# but it can be overridden while this file is being called
|
|
||||||
# inputs is used to pass inputs to the plugin autodiscovery function
|
|
||||||
extendedLib = import ../lib/stdlib-extended.nix lib inputs;
|
|
||||||
|
|
||||||
# import modules.nix with `check`, `pkgs` and `lib` as arguments
|
# import modules.nix with `check`, `pkgs` and `lib` as arguments
|
||||||
# check can be disabled while calling this file is called
|
# check can be disabled while calling this file is called
|
||||||
# to avoid checking in all modules
|
# to avoid checking in all modules
|
||||||
nvimModules = import ./modules.nix {
|
nvimModules = import ./modules.nix {inherit pkgs lib;};
|
||||||
inherit check pkgs;
|
|
||||||
lib = extendedLib;
|
|
||||||
};
|
|
||||||
|
|
||||||
# evaluate the extended library with the modules
|
# evaluate the extended library with the modules
|
||||||
# optionally with any additional modules passed by the user
|
# optionally with any additional modules passed by the user
|
||||||
module = extendedLib.evalModules {
|
module = lib.evalModules {
|
||||||
specialArgs = recursiveUpdate {modulesPath = toString ./.;} extraSpecialArgs;
|
specialArgs = extraSpecialArgs // {modulesPath = toString ./.;};
|
||||||
modules = concatLists [[configuration] nvimModules extraModules];
|
modules = concatLists [
|
||||||
|
nvimModules
|
||||||
|
modules
|
||||||
|
(lib.optional (configuration != {}) (lib.warn ''
|
||||||
|
nvf: passing 'configuration' to lib.neovimConfiguration is deprecated.
|
||||||
|
''
|
||||||
|
configuration))
|
||||||
|
|
||||||
|
(lib.optionals (extraModules != []) (lib.warn ''
|
||||||
|
nvf: passing 'extraModules' to lib.neovimConfiguration is deprecated, use 'modules' instead.
|
||||||
|
''
|
||||||
|
extraModules))
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# alias to the internal configuration
|
# alias to the internal configuration
|
||||||
vimOptions = module.config.vim;
|
vimOptions = module.config.vim;
|
||||||
|
|
||||||
|
noBuildPlug = {pname, ...} @ attrs: let
|
||||||
|
src = inputs."plugin-${attrs.pname}";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
version = src.shortRev or src.shortDirtyRev or "dirty";
|
||||||
|
outPath = src;
|
||||||
|
passthru.vimPlugin = false;
|
||||||
|
}
|
||||||
|
// attrs;
|
||||||
|
|
||||||
# build a vim plugin with the given name and arguments
|
# build a vim plugin with the given name and arguments
|
||||||
# if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug
|
# if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug
|
||||||
# instead
|
# instead
|
||||||
buildPlug = {pname, ...} @ args:
|
buildPlug = attrs: let
|
||||||
assert assertMsg (pname != "nvim-treesitter") "Use buildTreesitterPlug for building nvim-treesitter.";
|
src = inputs."plugin-${attrs.pname}";
|
||||||
buildVimPlugin (args
|
in
|
||||||
// {
|
pkgs.vimUtils.buildVimPlugin (
|
||||||
version = "master";
|
{
|
||||||
src = getAttr ("plugin-" + pname) inputs;
|
version = src.shortRev or src.shortDirtyRev or "dirty";
|
||||||
});
|
inherit src;
|
||||||
|
}
|
||||||
|
// attrs
|
||||||
|
);
|
||||||
|
|
||||||
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
|
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
|
||||||
|
|
||||||
|
pluginBuilders = {
|
||||||
|
nvim-treesitter = buildTreesitterPlug vimOptions.treesitter.grammars;
|
||||||
|
flutter-tools-patched = buildPlug {
|
||||||
|
pname = "flutter-tools";
|
||||||
|
patches = [../patches/flutter-tools.patch];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
buildConfigPlugins = plugins:
|
buildConfigPlugins = plugins:
|
||||||
map
|
map (
|
||||||
(plug: (
|
plug:
|
||||||
if (isString plug)
|
if (isString plug)
|
||||||
then
|
then pluginBuilders.${plug} or (noBuildPlug {pname = plug;})
|
||||||
(
|
else plug
|
||||||
if (plug == "nvim-treesitter")
|
) (filter (f: f != null) plugins);
|
||||||
then (buildTreesitterPlug vimOptions.treesitter.grammars)
|
|
||||||
else if (plug == "flutter-tools-patched")
|
|
||||||
then
|
|
||||||
(buildPlug {
|
|
||||||
pname = "flutter-tools";
|
|
||||||
patches = [../patches/flutter-tools.patch];
|
|
||||||
})
|
|
||||||
else (buildPlug {pname = plug;})
|
|
||||||
)
|
|
||||||
else plug
|
|
||||||
))
|
|
||||||
(filter
|
|
||||||
(f: f != null)
|
|
||||||
plugins);
|
|
||||||
|
|
||||||
# built (or "normalized") plugins that are modified
|
# built (or "normalized") plugins that are modified
|
||||||
builtStartPlugins = buildConfigPlugins vimOptions.startPlugins;
|
builtStartPlugins = buildConfigPlugins vimOptions.startPlugins;
|
||||||
builtOptPlugins = map (package: {
|
builtOptPlugins = map (package: {
|
||||||
plugin = package;
|
plugin = package;
|
||||||
optional = false;
|
optional = true;
|
||||||
}) (buildConfigPlugins vimOptions.optPlugins);
|
}) (buildConfigPlugins vimOptions.optPlugins);
|
||||||
|
|
||||||
# combine built start and optional plugins
|
|
||||||
# into a single list
|
|
||||||
plugins = builtStartPlugins ++ builtOptPlugins;
|
|
||||||
|
|
||||||
# additional Lua and Python3 packages, mapped to their respective functions
|
# additional Lua and Python3 packages, mapped to their respective functions
|
||||||
# to conform to the format makeNeovimConfig expects. end user should
|
# to conform to the format mnw expects. end user should
|
||||||
# only ever need to pass a list of packages, which are modified
|
# only ever need to pass a list of packages, which are modified
|
||||||
# here
|
# here
|
||||||
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
|
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
|
||||||
extraPython3Packages = ps: map (x: ps.${x}) vimOptions.python3Packages;
|
extraPython3Packages = ps: map (x: ps.${x}) vimOptions.python3Packages;
|
||||||
|
|
||||||
extraWrapperArgs =
|
# Wrap the user's desired (unwrapped) Neovim package with arguments that'll be used to
|
||||||
concatStringsSep " " (optional (vimOptions.extraPackages != []) ''--prefix PATH : "${makeBinPath vimOptions.extraPackages}"'');
|
# generate a wrapped Neovim package.
|
||||||
|
neovim-wrapped = inputs.mnw.lib.wrap pkgs {
|
||||||
|
neovim = vimOptions.package;
|
||||||
|
plugins = builtStartPlugins ++ builtOptPlugins;
|
||||||
|
appName = "nvf";
|
||||||
|
extraBinPath = vimOptions.extraPackages;
|
||||||
|
initLua = vimOptions.builtLuaConfigRC;
|
||||||
|
luaFiles = vimOptions.extraLuaFiles;
|
||||||
|
|
||||||
# wrap user's desired neovim package with the desired neovim configuration
|
|
||||||
# using wrapNeovimUnstable and makeNeovimConfig from nixpkgs.
|
|
||||||
# the makeNeovimConfig function takes the following arguments:
|
|
||||||
# - withPython (bool)
|
|
||||||
# - extraPython3Packages (lambda)
|
|
||||||
# - withNodeJs (bool)
|
|
||||||
# - withRuby (bool)
|
|
||||||
# - extraLuaPackages (lambda)
|
|
||||||
# - plugins (list)
|
|
||||||
# - customRC (string)
|
|
||||||
# and returns the wrapped package
|
|
||||||
neovimConfigured = makeNeovimConfig {
|
|
||||||
inherit (vimOptions) viAlias vimAlias withRuby withNodeJs withPython3;
|
inherit (vimOptions) viAlias vimAlias withRuby withNodeJs withPython3;
|
||||||
inherit plugins extraLuaPackages extraPython3Packages;
|
inherit extraLuaPackages extraPython3Packages;
|
||||||
customRC = vimOptions.builtConfigRC;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
neovim-wrapped = wrapNeovimUnstable vimOptions.package (recursiveUpdate neovimConfigured {
|
dummyInit = pkgs.writeText "nvf-init.lua" vimOptions.builtLuaConfigRC;
|
||||||
wrapperArgs = escapeShellArgs neovimConfigured.wrapperArgs + " " + extraWrapperArgs;
|
# Additional helper scripts for printing and displaying nvf configuration
|
||||||
});
|
# in your commandline.
|
||||||
|
printConfig = pkgs.writers.writeDashBin "nvf-print-config" "cat ${dummyInit}";
|
||||||
|
printConfigPath = pkgs.writers.writeDashBin "nvf-print-config-path" "echo -n ${dummyInit}";
|
||||||
in {
|
in {
|
||||||
inherit (module) options config;
|
inherit (module) options config;
|
||||||
inherit (module._module.args) pkgs;
|
inherit (module._module.args) pkgs;
|
||||||
|
|
||||||
# expose wrapped neovim-package
|
# Expose wrapped neovim-package for userspace
|
||||||
neovim = neovim-wrapped;
|
# or module consumption.
|
||||||
|
neovim = pkgs.symlinkJoin {
|
||||||
|
name = "nvf-with-helpers";
|
||||||
|
paths = [neovim-wrapped printConfig printConfigPath];
|
||||||
|
postBuild = "echo Helpers added";
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Wrapped version of Neovim with additional helper scripts";
|
||||||
|
mainProgram = "nvim";
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
18
modules/extra/deprecations.nix
Normal file
18
modules/extra/deprecations.nix
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.modules) mkRemovedOptionModule;
|
||||||
|
in {
|
||||||
|
imports = [
|
||||||
|
# 2024-06-06
|
||||||
|
(mkRemovedOptionModule ["vim" "tidal"] ''
|
||||||
|
Tidalcycles language support has been removed as of 2024-06-06 as it was long unmaintained. If
|
||||||
|
you depended on this functionality, please open an issue.
|
||||||
|
'')
|
||||||
|
|
||||||
|
# 2024-07-20
|
||||||
|
(mkRemovedOptionModule ["vim" "lsp" "nvimCodeActionMenu"] ''
|
||||||
|
nvimCodeActionMenu has been deprecated and removed upstream. As of 0.7, fastaction will be
|
||||||
|
available under `vim.ui.fastaction` as a replacement. Simply remove everything under
|
||||||
|
`vim.lsp.nvimCodeActionMenu`, and set `vim.ui.fastaction.enable` to `true`.
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
}
|
|
@ -1,71 +1,72 @@
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
check ? true,
|
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkDefault;
|
inherit (lib.modules) mkDefault;
|
||||||
inherit (lib.lists) concatLists;
|
inherit (lib.lists) concatLists;
|
||||||
|
allModules = let
|
||||||
|
# The core neovim modules.
|
||||||
|
# Contains configuration for core neovim features
|
||||||
|
# such as spellchecking, mappings, and the init script (init.vim).
|
||||||
|
neovim = map (p: ./neovim + "/${p}") [
|
||||||
|
"init"
|
||||||
|
"mappings"
|
||||||
|
];
|
||||||
|
|
||||||
# The core neovim modules.
|
# Individual plugin modules, separated by the type of plugin.
|
||||||
# Contains configuration for core neovim features
|
# While adding a new type, you must make sure your type is
|
||||||
# such as spellchecking, mappings, and the init script (init.vim).
|
# included in the list below.
|
||||||
neovim = map (p: ./neovim + "/${p}") [
|
plugins = map (p: ./plugins + "/${p}") [
|
||||||
"init"
|
"assistant"
|
||||||
"mappings"
|
"autopairs"
|
||||||
];
|
"comments"
|
||||||
|
"completion"
|
||||||
|
"dashboard"
|
||||||
|
"debugger"
|
||||||
|
"filetree"
|
||||||
|
"git"
|
||||||
|
"languages"
|
||||||
|
"lsp"
|
||||||
|
"minimap"
|
||||||
|
"notes"
|
||||||
|
"projects"
|
||||||
|
"rich-presence"
|
||||||
|
"session"
|
||||||
|
"snippets"
|
||||||
|
# "spellcheck" # FIXME: see neovim/init/spellcheck.nix
|
||||||
|
"statusline"
|
||||||
|
"tabline"
|
||||||
|
"terminal"
|
||||||
|
"theme"
|
||||||
|
"treesitter"
|
||||||
|
"ui"
|
||||||
|
"utility"
|
||||||
|
"visuals"
|
||||||
|
];
|
||||||
|
|
||||||
# Individual plugin modules, separated by the type of plugin.
|
# The neovim wrapper, used to build a wrapped neovim package
|
||||||
# While adding a new type, you must make sure your type is
|
# using the configuration passed in `neovim` and `plugins` modules.
|
||||||
# included in the list below.
|
wrapper = map (p: ./wrapper + "/${p}") [
|
||||||
plugins = map (p: ./plugins + "/${p}") [
|
"build"
|
||||||
"assistant"
|
"rc"
|
||||||
"autopairs"
|
"warnings"
|
||||||
"comments"
|
];
|
||||||
"completion"
|
|
||||||
"dashboard"
|
|
||||||
"debugger"
|
|
||||||
"filetree"
|
|
||||||
"git"
|
|
||||||
"languages"
|
|
||||||
"lsp"
|
|
||||||
"minimap"
|
|
||||||
"notes"
|
|
||||||
"projects"
|
|
||||||
"rich-presence"
|
|
||||||
"session"
|
|
||||||
"snippets"
|
|
||||||
# "spellcheck" # FIXME: see neovim/init/spellcheck.nix
|
|
||||||
"statusline"
|
|
||||||
"tabline"
|
|
||||||
"terminal"
|
|
||||||
"theme"
|
|
||||||
"treesitter"
|
|
||||||
"ui"
|
|
||||||
"utility"
|
|
||||||
"visuals"
|
|
||||||
];
|
|
||||||
|
|
||||||
# The neovim wrapper, used to build a wrapped neovim package
|
# Extra modules, such as deprecation warnings
|
||||||
# using the configuration passed in `neovim` and `plugins` modules.
|
# or renames in one place.
|
||||||
wrapper = map (p: ./wrapper + "/${p}") [
|
extra = map (p: ./extra + "/${p}") [
|
||||||
"build"
|
"deprecations.nix"
|
||||||
"rc"
|
];
|
||||||
"warnings"
|
in
|
||||||
];
|
concatLists [neovim plugins wrapper extra];
|
||||||
|
|
||||||
allModules = concatLists [neovim plugins wrapper];
|
|
||||||
|
|
||||||
pkgsModule = {config, ...}: {
|
|
||||||
config = {
|
|
||||||
_module = {
|
|
||||||
inherit check;
|
|
||||||
args = {
|
|
||||||
baseModules = allModules;
|
|
||||||
pkgsPath = mkDefault pkgs.path;
|
|
||||||
pkgs = mkDefault pkgs;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
allModules ++ [pkgsModule]
|
allModules
|
||||||
|
++ [
|
||||||
|
{
|
||||||
|
_module.args = {
|
||||||
|
baseModules = allModules;
|
||||||
|
pkgsPath = mkDefault pkgs.path;
|
||||||
|
pkgs = mkDefault pkgs;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
|
@ -3,18 +3,21 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression literalMD;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.types) enum bool str int nullOr;
|
inherit (lib.types) enum bool str int either;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (lib.nvim.types) luaInline;
|
||||||
|
|
||||||
cfg = config.vim;
|
cfg = config.vim;
|
||||||
in {
|
in {
|
||||||
options.vim = {
|
options.vim = {
|
||||||
leaderKey = mkOption {
|
leaderKey = mkOption {
|
||||||
type = nullOr str;
|
type = str;
|
||||||
default = null;
|
default = " ";
|
||||||
description = "The leader key to be used internally";
|
description = "The leader key used for `<leader>` mappings";
|
||||||
};
|
};
|
||||||
|
|
||||||
colourTerm = mkOption {
|
colourTerm = mkOption {
|
||||||
|
@ -53,12 +56,6 @@ in {
|
||||||
description = "Enable syntax highlighting";
|
description = "Enable syntax highlighting";
|
||||||
};
|
};
|
||||||
|
|
||||||
mapLeaderSpace = mkOption {
|
|
||||||
type = bool;
|
|
||||||
default = true;
|
|
||||||
description = "Map the space key to leader key";
|
|
||||||
};
|
|
||||||
|
|
||||||
useSystemClipboard = mkOption {
|
useSystemClipboard = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -163,119 +160,138 @@ in {
|
||||||
default = "sensitive";
|
default = "sensitive";
|
||||||
description = "Set the case sensitivity of search";
|
description = "Set the case sensitivity of search";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
undoFile = {
|
||||||
|
enable = mkEnableOption "undofile for persistent undo behaviour";
|
||||||
|
path = mkOption {
|
||||||
|
type = either str luaInline;
|
||||||
|
default = mkLuaInline "vim.fn.stdpath('state') .. '/undo'";
|
||||||
|
defaultText = literalMD ''
|
||||||
|
```nix
|
||||||
|
mkLuaInline "vim.fn.stdpath('state') .. '/undo'"
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
example = literalMD ''
|
||||||
|
```nix
|
||||||
|
mkLuaInline "os.getenv('XDG_DATA_HOME') .. '/nvf/undo'"
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
description = "Path to the directory in which undo history will be stored";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config.vim.configRC.basic = entryAfter ["globalsScript"] ''
|
config = {
|
||||||
" Settings that are set for everything
|
vim.luaConfigRC.basic = entryAfter ["globalsScript"] ''
|
||||||
set encoding=utf-8
|
-- Settings that are set for everything
|
||||||
set hidden
|
vim.o.encoding = "utf-8"
|
||||||
set shortmess+=c
|
vim.o.hidden = true
|
||||||
set expandtab
|
vim.opt.shortmess:append("c")
|
||||||
set mouse=${cfg.mouseSupport}
|
vim.o.expandtab = true
|
||||||
set tabstop=${toString cfg.tabWidth}
|
vim.o.mouse = ${toLuaObject cfg.mouseSupport}
|
||||||
set shiftwidth=${toString cfg.tabWidth}
|
vim.o.tabstop = ${toLuaObject cfg.tabWidth}
|
||||||
set softtabstop=${toString cfg.tabWidth}
|
vim.o.shiftwidth = ${toLuaObject cfg.tabWidth}
|
||||||
set cmdheight=${toString cfg.cmdHeight}
|
vim.o.softtabstop = ${toLuaObject cfg.tabWidth}
|
||||||
set updatetime=${toString cfg.updateTime}
|
vim.o.cmdheight = ${toLuaObject cfg.cmdHeight}
|
||||||
set tm=${toString cfg.mapTimeout}
|
vim.o.updatetime = ${toLuaObject cfg.updateTime}
|
||||||
set cursorlineopt=${toString cfg.cursorlineOpt}
|
vim.o.tm = ${toLuaObject cfg.mapTimeout}
|
||||||
set scrolloff=${toString cfg.scrollOffset}
|
vim.o.cursorlineopt = ${toLuaObject cfg.cursorlineOpt}
|
||||||
|
vim.o.scrolloff = ${toLuaObject cfg.scrollOffset}
|
||||||
|
vim.g.mapleader = ${toLuaObject cfg.leaderKey}
|
||||||
|
vim.g.maplocalleader = ${toLuaObject cfg.leaderKey}
|
||||||
|
|
||||||
${optionalString cfg.splitBelow ''
|
${optionalString cfg.undoFile.enable ''
|
||||||
set splitbelow
|
vim.o.undofile = true
|
||||||
''}
|
vim.o.undodir = ${toLuaObject cfg.undoFile.path}
|
||||||
|
''}
|
||||||
|
|
||||||
${optionalString cfg.splitRight ''
|
${optionalString cfg.splitBelow ''
|
||||||
set splitright
|
vim.o.splitbelow = true
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString cfg.showSignColumn ''
|
${optionalString cfg.splitRight ''
|
||||||
set signcolumn=yes
|
vim.o.splitright = true
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString cfg.autoIndent ''
|
${optionalString cfg.showSignColumn ''
|
||||||
set autoindent
|
vim.o.signcolumn = "yes"
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString cfg.preventJunkFiles ''
|
${optionalString cfg.autoIndent ''
|
||||||
set noswapfile
|
vim.o.autoindent = true
|
||||||
set nobackup
|
''}
|
||||||
set nowritebackup
|
|
||||||
''}
|
|
||||||
|
|
||||||
${optionalString (cfg.bell == "none") ''
|
${optionalString cfg.preventJunkFiles ''
|
||||||
set noerrorbells
|
vim.o.swapfile = false
|
||||||
set novisualbell
|
vim.o.backup = false
|
||||||
''}
|
vim.o.writebackup = false
|
||||||
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.bell == "on") ''
|
${optionalString (cfg.bell == "none") ''
|
||||||
set novisualbell
|
vim.o.errorbells = false
|
||||||
''}
|
vim.o.visualbell = false
|
||||||
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.bell == "visual") ''
|
${optionalString (cfg.bell == "on") ''
|
||||||
set noerrorbells
|
vim.o.visualbell = false
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.lineNumberMode == "relative") ''
|
${optionalString (cfg.bell == "visual") ''
|
||||||
set relativenumber
|
vim.o.errorbells = false
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.lineNumberMode == "number") ''
|
${optionalString (cfg.lineNumberMode == "relative") ''
|
||||||
set number
|
vim.o.relativenumber = true
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.lineNumberMode == "relNumber") ''
|
${optionalString (cfg.lineNumberMode == "number") ''
|
||||||
set number relativenumber
|
vim.o.number = true
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString cfg.useSystemClipboard ''
|
${optionalString (cfg.lineNumberMode == "relNumber") ''
|
||||||
set clipboard+=unnamedplus
|
vim.o.number = true
|
||||||
''}
|
vim.o.relativenumber = true
|
||||||
|
''}
|
||||||
|
|
||||||
${optionalString cfg.mapLeaderSpace ''
|
${optionalString cfg.useSystemClipboard ''
|
||||||
let mapleader=" "
|
vim.opt.clipboard:append("unnamedplus")
|
||||||
let maplocalleader=" "
|
''}
|
||||||
''}
|
|
||||||
|
|
||||||
${optionalString cfg.syntaxHighlighting ''
|
${optionalString cfg.syntaxHighlighting ''
|
||||||
syntax on
|
vim.cmd("syntax on")
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString (!cfg.wordWrap) ''
|
${optionalString (!cfg.wordWrap) ''
|
||||||
set nowrap
|
vim.o.wrap = false
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString cfg.hideSearchHighlight ''
|
${optionalString cfg.hideSearchHighlight ''
|
||||||
set nohlsearch
|
vim.o.hlsearch = false
|
||||||
set incsearch
|
vim.o.incsearch = true
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString cfg.colourTerm ''
|
${optionalString cfg.colourTerm ''
|
||||||
set termguicolors
|
vim.o.termguicolors = true
|
||||||
set t_Co=256
|
''}
|
||||||
''}
|
|
||||||
|
|
||||||
${optionalString (!cfg.enableEditorconfig) ''
|
${optionalString (!cfg.enableEditorconfig) ''
|
||||||
let g:editorconfig = v:false
|
vim.g.editorconfig = false
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.leaderKey != null) ''
|
${optionalString (cfg.searchCase == "ignore") ''
|
||||||
let mapleader = "${toString cfg.leaderKey}"
|
vim.o.smartcase = false
|
||||||
''}
|
vim.o.ignorecase = true
|
||||||
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.searchCase == "ignore") ''
|
${optionalString (cfg.searchCase == "smart") ''
|
||||||
set nosmartcase
|
vim.o.smartcase = true
|
||||||
set ignorecase
|
vim.o.ignorecase = true
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.searchCase == "smart") ''
|
${optionalString (cfg.searchCase == "sensitive") ''
|
||||||
set smartcase
|
vim.o.smartcase = false
|
||||||
set ignorecase
|
vim.o.ignorecase = false
|
||||||
''}
|
''}
|
||||||
|
'';
|
||||||
${optionalString (cfg.searchCase == "sensitive") ''
|
};
|
||||||
set nosmartcase
|
|
||||||
set noignorecase
|
|
||||||
''}
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,32 +9,26 @@
|
||||||
in {
|
in {
|
||||||
config = {
|
config = {
|
||||||
vim.maps = {
|
vim.maps = {
|
||||||
normal =
|
normal = mkIf cfg.disableArrows {
|
||||||
mkIf cfg.disableArrows {
|
"<up>" = {
|
||||||
"<up>" = {
|
action = "<nop>";
|
||||||
action = "<nop>";
|
|
||||||
|
|
||||||
noremap = false;
|
noremap = false;
|
||||||
};
|
|
||||||
"<down>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
|
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
"<left>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
"<right>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// mkIf cfg.mapLeaderSpace {
|
|
||||||
"<space>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
"<down>" = {
|
||||||
|
action = "<nop>";
|
||||||
|
|
||||||
|
noremap = false;
|
||||||
|
};
|
||||||
|
"<left>" = {
|
||||||
|
action = "<nop>";
|
||||||
|
noremap = false;
|
||||||
|
};
|
||||||
|
"<right>" = {
|
||||||
|
action = "<nop>";
|
||||||
|
noremap = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
insert = mkIf cfg.disableArrows {
|
insert = mkIf cfg.disableArrows {
|
||||||
"<up>" = {
|
"<up>" = {
|
||||||
|
|
|
@ -33,7 +33,7 @@ in {
|
||||||
startPlugins = [
|
startPlugins = [
|
||||||
"chatgpt"
|
"chatgpt"
|
||||||
];
|
];
|
||||||
luaConfigRC.chagpt = entryAnywhere ''
|
pluginRC.chagpt = entryAnywhere ''
|
||||||
require("chatgpt").setup(${toLuaObject cfg.setupOpts})
|
require("chatgpt").setup(${toLuaObject cfg.setupOpts})
|
||||||
'';
|
'';
|
||||||
maps.normal = mkMerge [
|
maps.normal = mkMerge [
|
||||||
|
|
|
@ -30,14 +30,14 @@ in {
|
||||||
"copilot-lua"
|
"copilot-lua"
|
||||||
# cfg.copilotNodePackage
|
# cfg.copilotNodePackage
|
||||||
]
|
]
|
||||||
++ optionals (cfg.cmp.enable) [
|
++ optionals cfg.cmp.enable [
|
||||||
"copilot-cmp"
|
"copilot-cmp"
|
||||||
];
|
];
|
||||||
|
|
||||||
vim.luaConfigRC.copilot = entryAnywhere ''
|
vim.pluginRC.copilot = entryAnywhere ''
|
||||||
require("copilot").setup(${toLuaObject cfg.setupOpts})
|
require("copilot").setup(${toLuaObject cfg.setupOpts})
|
||||||
|
|
||||||
${lib.optionalString (cfg.cmp.enable) ''
|
${lib.optionalString cfg.cmp.enable ''
|
||||||
require("copilot_cmp").setup()
|
require("copilot_cmp").setup()
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -4,17 +4,16 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.trivial) boolToString;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
|
||||||
|
|
||||||
cfg = config.vim.autopairs;
|
cfg = config.vim.autopairs;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = ["nvim-autopairs"];
|
vim.startPlugins = ["nvim-autopairs"];
|
||||||
|
|
||||||
vim.luaConfigRC.autopairs = entryAnywhere ''
|
vim.pluginRC.autopairs = entryAnywhere ''
|
||||||
require("nvim-autopairs").setup{}
|
require("nvim-autopairs").setup({ map_cr = ${boolToString (!config.vim.autocomplete.enable)} })
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ in {
|
||||||
(mkBinding cfg.mappings.toggleSelectedBlock "<Plug>(comment_toggle_blockwise_visual)" mappings.toggleSelectedBlock.description)
|
(mkBinding cfg.mappings.toggleSelectedBlock "<Plug>(comment_toggle_blockwise_visual)" mappings.toggleSelectedBlock.description)
|
||||||
];
|
];
|
||||||
|
|
||||||
vim.luaConfigRC.comment-nvim = entryAnywhere ''
|
vim.pluginRC.comment-nvim = entryAnywhere ''
|
||||||
require('Comment').setup({
|
require('Comment').setup({
|
||||||
mappings = { basic = false, extra = false, },
|
mappings = { basic = false, extra = false, },
|
||||||
})
|
})
|
||||||
|
|
|
@ -61,15 +61,19 @@ in {
|
||||||
(mkSetLuaBinding mappings.complete ''
|
(mkSetLuaBinding mappings.complete ''
|
||||||
require('cmp').complete
|
require('cmp').complete
|
||||||
'')
|
'')
|
||||||
(mkSetLuaBinding mappings.confirm ''
|
(let
|
||||||
function()
|
defaultKeys =
|
||||||
if not require('cmp').confirm({ select = true }) then
|
if config.vim.autopairs.enable
|
||||||
local termcode = vim.api.nvim_replace_termcodes(${toJSON mappings.confirm.value}, true, false, true)
|
then "require('nvim-autopairs').autopairs_cr()"
|
||||||
|
else "vim.api.nvim_replace_termcodes(${toJSON mappings.confirm.value}, true, false, true)";
|
||||||
vim.fn.feedkeys(termcode, 'n')
|
in
|
||||||
|
mkSetLuaBinding mappings.confirm ''
|
||||||
|
function()
|
||||||
|
if not require('cmp').confirm({ select = true }) then
|
||||||
|
vim.fn.feedkeys(${defaultKeys}, 'n')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
'')
|
||||||
'')
|
|
||||||
(mkSetLuaBinding mappings.next ''
|
(mkSetLuaBinding mappings.next ''
|
||||||
function()
|
function()
|
||||||
local has_words_before = function()
|
local has_words_before = function()
|
||||||
|
@ -182,7 +186,7 @@ in {
|
||||||
|
|
||||||
# TODO: alternative snippet engines to vsnip
|
# TODO: alternative snippet engines to vsnip
|
||||||
# https://github.com/hrsh7th/nvim-cmp/blob/main/doc/cmp.txt#L82
|
# https://github.com/hrsh7th/nvim-cmp/blob/main/doc/cmp.txt#L82
|
||||||
vim.luaConfigRC.completion = mkIf (cfg.type == "nvim-cmp") (dagPlacement ''
|
vim.pluginRC.completion = mkIf (cfg.type == "nvim-cmp") (dagPlacement ''
|
||||||
local nvim_cmp_menu_map = function(entry, vim_item)
|
local nvim_cmp_menu_map = function(entry, vim_item)
|
||||||
-- name for each source
|
-- name for each source
|
||||||
vim_item.menu = ({
|
vim_item.menu = ({
|
||||||
|
|
|
@ -16,7 +16,7 @@ in {
|
||||||
|
|
||||||
# the entire credit for this dashboard configuration to https://github.com/Rishabh672003
|
# the entire credit for this dashboard configuration to https://github.com/Rishabh672003
|
||||||
# honestly, excellent work
|
# honestly, excellent work
|
||||||
vim.luaConfigRC.alpha = entryAnywhere ''
|
vim.pluginRC.alpha = entryAnywhere ''
|
||||||
local alpha = require("alpha")
|
local alpha = require("alpha")
|
||||||
local plenary_path = require("plenary.path")
|
local plenary_path = require("plenary.path")
|
||||||
local dashboard = require("alpha.themes.dashboard")
|
local dashboard = require("alpha.themes.dashboard")
|
||||||
|
|
|
@ -5,16 +5,17 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.dashboard.dashboard-nvim;
|
cfg = config.vim.dashboard.dashboard-nvim;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim = {
|
||||||
"dashboard-nvim"
|
startPlugins = ["dashboard-nvim"];
|
||||||
];
|
|
||||||
|
|
||||||
vim.luaConfigRC.dashboard-nvim = entryAnywhere ''
|
pluginRC.dashboard-nvim = entryAnywhere ''
|
||||||
require("dashboard").setup{}
|
require("dashboard").setup(${toLuaObject cfg.setupOpts})
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.dashboard.dashboard-nvim = {
|
options.vim.dashboard.dashboard-nvim = {
|
||||||
enable = mkEnableOption "Fancy and Blazing Fast start screen plugin of neovim [dashboard.nvim]";
|
enable = mkEnableOption "Fancy and Blazing Fast start screen plugin of neovim [dashboard.nvim]";
|
||||||
|
setupOpts = mkPluginSetupOption "dashboard.nvim" {};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.vim) mkVimBool;
|
|
||||||
|
|
||||||
cfg = config.vim.dashboard.startify;
|
cfg = config.vim.dashboard.startify;
|
||||||
in {
|
in {
|
||||||
|
@ -23,28 +22,28 @@ in {
|
||||||
else cfg.customFooter;
|
else cfg.customFooter;
|
||||||
"startify_bookmarks" = cfg.bookmarks;
|
"startify_bookmarks" = cfg.bookmarks;
|
||||||
"startify_lists" = cfg.lists;
|
"startify_lists" = cfg.lists;
|
||||||
"startify_change_to_dir" = mkVimBool cfg.changeToDir;
|
"startify_change_to_dir" = cfg.changeToDir;
|
||||||
"startify_change_to_vcs_root" = mkVimBool cfg.changeToVCRoot;
|
"startify_change_to_vcs_root" = cfg.changeToVCRoot;
|
||||||
"startify_change_cmd" = cfg.changeDirCmd;
|
"startify_change_cmd" = cfg.changeDirCmd;
|
||||||
"startify_skiplist" = cfg.skipList;
|
"startify_skiplist" = cfg.skipList;
|
||||||
"startify_update_oldfiles" = mkVimBool cfg.updateOldFiles;
|
"startify_update_oldfiles" = cfg.updateOldFiles;
|
||||||
"startify_session_autoload" = mkVimBool cfg.sessionAutoload;
|
"startify_session_autoload" = cfg.sessionAutoload;
|
||||||
"startify_commands" = cfg.commands;
|
"startify_commands" = cfg.commands;
|
||||||
"startify_files_number" = cfg.filesNumber;
|
"startify_files_number" = cfg.filesNumber;
|
||||||
"startify_custom_indices" = cfg.customIndices;
|
"startify_custom_indices" = cfg.customIndices;
|
||||||
"startify_disable_at_vimenter" = mkVimBool cfg.disableOnStartup;
|
"startify_disable_at_vimenter" = cfg.disableOnStartup;
|
||||||
"startify_enable_unsafe" = mkVimBool cfg.unsafe;
|
"startify_enable_unsafe" = cfg.unsafe;
|
||||||
"startify_padding_left" = cfg.paddingLeft;
|
"startify_padding_left" = cfg.paddingLeft;
|
||||||
"startify_use_env" = mkVimBool cfg.useEnv;
|
"startify_use_env" = cfg.useEnv;
|
||||||
"startify_session_before_save" = cfg.sessionBeforeSave;
|
"startify_session_before_save" = cfg.sessionBeforeSave;
|
||||||
"startify_session_persistence" = mkVimBool cfg.sessionPersistence;
|
"startify_session_persistence" = cfg.sessionPersistence;
|
||||||
"startify_session_delete_buffers" = mkVimBool cfg.sessionDeleteBuffers;
|
"startify_session_delete_buffers" = cfg.sessionDeleteBuffers;
|
||||||
"startify_session_dir" = cfg.sessionDir;
|
"startify_session_dir" = cfg.sessionDir;
|
||||||
"startify_skiplist_server" = cfg.skipListServer;
|
"startify_skiplist_server" = cfg.skipListServer;
|
||||||
"startify_session_remove_lines" = cfg.sessionRemoveLines;
|
"startify_session_remove_lines" = cfg.sessionRemoveLines;
|
||||||
"startify_session_savevars" = cfg.sessionSavevars;
|
"startify_session_savevars" = cfg.sessionSavevars;
|
||||||
"startify_session_savecmds" = cfg.sessionSavecmds;
|
"startify_session_savecmds" = cfg.sessionSavecmds;
|
||||||
"startify_session_sort" = mkVimBool cfg.sessionSort;
|
"startify_session_sort" = cfg.sessionSort;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
{
|
{lib, ...}: let
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.types) listOf attrs bool enum str oneOf int;
|
inherit (lib.types) listOf attrs bool enum str oneOf int;
|
||||||
in {
|
in {
|
||||||
|
|
|
@ -18,7 +18,7 @@ in {
|
||||||
(mkIf cfg.enable {
|
(mkIf cfg.enable {
|
||||||
vim.startPlugins = ["nvim-dap"];
|
vim.startPlugins = ["nvim-dap"];
|
||||||
|
|
||||||
vim.luaConfigRC =
|
vim.pluginRC =
|
||||||
{
|
{
|
||||||
# TODO customizable keymaps
|
# TODO customizable keymaps
|
||||||
nvim-dap = entryAnywhere ''
|
nvim-dap = entryAnywhere ''
|
||||||
|
@ -51,7 +51,7 @@ in {
|
||||||
(mkIf (cfg.enable && cfg.ui.enable) {
|
(mkIf (cfg.enable && cfg.ui.enable) {
|
||||||
vim.startPlugins = ["nvim-dap-ui" "nvim-nio"];
|
vim.startPlugins = ["nvim-dap-ui" "nvim-nio"];
|
||||||
|
|
||||||
vim.luaConfigRC.nvim-dap-ui = entryAfter ["nvim-dap"] (''
|
vim.pluginRC.nvim-dap-ui = entryAfter ["nvim-dap"] (''
|
||||||
local dapui = require("dapui")
|
local dapui = require("dapui")
|
||||||
dapui.setup()
|
dapui.setup()
|
||||||
''
|
''
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./nvimtree
|
./nvimtree
|
||||||
|
./neo-tree
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
30
modules/plugins/filetree/neo-tree/config.nix
Normal file
30
modules/plugins/filetree/neo-tree/config.nix
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
|
cfg = config.vim.filetree.neo-tree;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
startPlugins = [
|
||||||
|
# dependencies
|
||||||
|
"plenary-nvim" # commons library
|
||||||
|
"image-nvim" # optional for image previews
|
||||||
|
"nui-nvim" # ui library
|
||||||
|
# neotree
|
||||||
|
"neo-tree-nvim"
|
||||||
|
];
|
||||||
|
|
||||||
|
visuals.nvimWebDevicons.enable = true;
|
||||||
|
|
||||||
|
pluginRC.neo-tree = entryAnywhere ''
|
||||||
|
require("neo-tree").setup(${toLuaObject cfg.setupOpts})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./dart.nix
|
|
||||||
./config.nix
|
./config.nix
|
||||||
|
./neo-tree.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
155
modules/plugins/filetree/neo-tree/neo-tree.nix
Normal file
155
modules/plugins/filetree/neo-tree/neo-tree.nix
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.types) bool str int submodule enum either listOf;
|
||||||
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
in {
|
||||||
|
options.vim.filetree.neo-tree = {
|
||||||
|
enable = mkEnableOption "filetree via neo-tree.nvim";
|
||||||
|
|
||||||
|
# Permalink:
|
||||||
|
# https://github.com/nvim-neo-tree/neo-tree.nvim/blob/22e566aeb075c94f670f34077e05ba95190dfb4a/lua/neo-tree/defaults.lua
|
||||||
|
setupOpts = mkPluginSetupOption "neo-tree" {
|
||||||
|
add_blank_line_at_top = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to add a blank line at the top of the tree
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
auto_clean_after_session_restore = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to automatically clean up broken neo-tree buffers
|
||||||
|
saved in sessions
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
default_source = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "filesystem";
|
||||||
|
description = ''
|
||||||
|
You can choose a specific source.
|
||||||
|
|
||||||
|
`last` here which indicates the last used source
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
enable_diagnostics = mkEnableOption "diagnostics" // {default = true;};
|
||||||
|
enable_git_status = mkEnableOption "git status" // {default = true;};
|
||||||
|
enable_modified_markers = mkEnableOption "markers for files with unsaved changes." // {default = true;};
|
||||||
|
enable_opened_markers =
|
||||||
|
mkEnableOption ''
|
||||||
|
tracking of opened files.
|
||||||
|
|
||||||
|
Required for `components.name.highlight_opened_files`
|
||||||
|
''
|
||||||
|
// {default = true;};
|
||||||
|
|
||||||
|
enable_refresh_on_write =
|
||||||
|
mkEnableOption ''
|
||||||
|
Refresh the tree when a file is written.
|
||||||
|
|
||||||
|
Only used if `use_libuv_file_watcher` is false.
|
||||||
|
''
|
||||||
|
// {default = true;};
|
||||||
|
|
||||||
|
enable_cursor_hijack = mkEnableOption ''
|
||||||
|
cursor hijacking.
|
||||||
|
|
||||||
|
If enabled neotree will keep the cursor on the first letter of the filename when moving in the tree
|
||||||
|
'';
|
||||||
|
|
||||||
|
git_status_async = mkEnableOption ''
|
||||||
|
async git status.
|
||||||
|
|
||||||
|
This will make the git status check async and will not block the UI.
|
||||||
|
'';
|
||||||
|
|
||||||
|
/*
|
||||||
|
git_status_async_options = mkOption {
|
||||||
|
description = "These options are for people with VERY large git repos";
|
||||||
|
type = submodule {
|
||||||
|
batch_size = mkOption {
|
||||||
|
type = int;
|
||||||
|
default = 1000;
|
||||||
|
description = "How many lines of git status results to process at a time";
|
||||||
|
};
|
||||||
|
|
||||||
|
batch_delay = mkOption {
|
||||||
|
type = int;
|
||||||
|
default = 10;
|
||||||
|
description = "Delay, in ms, between batches. Spreads out the workload to let other processes run";
|
||||||
|
};
|
||||||
|
|
||||||
|
max_lines = mkOption {
|
||||||
|
type = int;
|
||||||
|
default = 10000;
|
||||||
|
description = ''
|
||||||
|
How many lines of git status results to process.
|
||||||
|
|
||||||
|
Anything after this will be dropped. Anything before this will be used.
|
||||||
|
The last items to be processed are the untracked files.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
hide_root_node = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to hide the root node of the tree
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
retain_hidden_root_indent = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to retain the indent of the hidden root node
|
||||||
|
|
||||||
|
IF the root node is hidden, keep the indentation anyhow.
|
||||||
|
This is needed if you use expanders because they render in the indent.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
log_level = mkOption {
|
||||||
|
type = enum ["trace" "debug" "info" "warn" "error" "fatal"];
|
||||||
|
default = "info";
|
||||||
|
description = "Log level for the plugin.";
|
||||||
|
};
|
||||||
|
|
||||||
|
log_to_file = mkOption {
|
||||||
|
type = either bool str;
|
||||||
|
default = false;
|
||||||
|
example = literalExpression "/tmp/neo-tree.log";
|
||||||
|
description = ''
|
||||||
|
Must be either a boolean or a path to your log file.
|
||||||
|
|
||||||
|
Use :NeoTreeLogs to show the file
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
open_files_in_last_window = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Whether to open files in the last window
|
||||||
|
|
||||||
|
If disabled, neo-tree will open files in top left window
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
open_files_do_not_replace_types = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = ["terminal" "Trouble" "qf" "edgy"];
|
||||||
|
description = ''
|
||||||
|
A list of filetypes that should not be replaced when opening a file
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -29,7 +29,7 @@ in {
|
||||||
"<leader>t" = "+NvimTree";
|
"<leader>t" = "+NvimTree";
|
||||||
};
|
};
|
||||||
|
|
||||||
vim.luaConfigRC.nvimtreelua = entryAnywhere ''
|
vim.pluginRC.nvimtreelua = entryAnywhere ''
|
||||||
${
|
${
|
||||||
optionalString cfg.setupOpts.disable_netrw ''
|
optionalString cfg.setupOpts.disable_netrw ''
|
||||||
-- disable netrew completely
|
-- disable netrew completely
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
_: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./config.nix
|
./config.nix
|
||||||
./nvimtree.nix
|
./nvimtree.nix
|
||||||
|
|
|
@ -69,7 +69,7 @@ in {
|
||||||
"<leader>g" = "+Gitsigns";
|
"<leader>g" = "+Gitsigns";
|
||||||
};
|
};
|
||||||
|
|
||||||
luaConfigRC.gitsigns = entryAnywhere ''
|
pluginRC.gitsigns = entryAnywhere ''
|
||||||
require('gitsigns').setup{}
|
require('gitsigns').setup{}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
{
|
{
|
||||||
pkgs,
|
|
||||||
config,
|
config,
|
||||||
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) enum either package listOf str bool;
|
inherit (lib.types) enum either package listOf str bool;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||||
inherit (lib.nvim.types) diagnostics mkGrammarOption;
|
inherit (lib.nvim.types) diagnostics mkGrammarOption;
|
||||||
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
|
||||||
cfg = config.vim.languages.bash;
|
cfg = config.vim.languages.bash;
|
||||||
|
|
||||||
defaultServer = "bash-ls";
|
defaultServer = "bash-ls";
|
||||||
servers = {
|
servers = {
|
||||||
bash-ls = {
|
bash-ls = {
|
||||||
package = pkgs.nodePackages.bash-language-server;
|
package = pkgs.bash-language-server;
|
||||||
lspConfig = ''
|
lspConfig = ''
|
||||||
lspconfig.bashls.setup{
|
lspconfig.bashls.setup{
|
||||||
capabilities = capabilities;
|
capabilities = capabilities;
|
||||||
|
@ -55,6 +57,7 @@
|
||||||
ls_sources,
|
ls_sources,
|
||||||
null_ls.builtins.diagnostics.shellcheck.with({
|
null_ls.builtins.diagnostics.shellcheck.with({
|
||||||
command = "${pkg}/bin/shellcheck",
|
command = "${pkg}/bin/shellcheck",
|
||||||
|
diagnostics_format = "#{m} [#{c}]"
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
@ -82,7 +85,7 @@ in {
|
||||||
description = "bash-language-server package, or the command to run as a list of strings";
|
description = "bash-language-server package, or the command to run as a list of strings";
|
||||||
example = literalExpression ''[lib.getExe pkgs.nodePackages.bash-language-server "start"]'';
|
example = literalExpression ''[lib.getExe pkgs.nodePackages.bash-language-server "start"]'';
|
||||||
type = either package (listOf str);
|
type = either package (listOf str);
|
||||||
default = pkgs.nodePackages.bash-language-server;
|
default = pkgs.bash-language-server;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -114,4 +117,30 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.bash-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.format.enable {
|
||||||
|
vim.lsp.null-ls.enable = true;
|
||||||
|
vim.lsp.null-ls.sources.bash-format = formats.${cfg.format.type}.nullConfig;
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
|
vim.lsp.null-ls.enable = true;
|
||||||
|
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||||
|
lang = "bash";
|
||||||
|
config = cfg.extraDiagnostics.types;
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]);
|
||||||
}
|
}
|
|
@ -1,83 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.lists) isList;
|
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
|
||||||
inherit (lib.nvim.lua) expToLua;
|
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
|
|
||||||
cfg = config.vim.languages.bash;
|
|
||||||
diagnosticsProviders = {
|
|
||||||
shellcheck = {
|
|
||||||
package = pkgs.shellcheck;
|
|
||||||
nullConfig = pkg: ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.diagnostics.shellcheck.with({
|
|
||||||
command = "${pkg}/bin/shellcheck",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
formats = {
|
|
||||||
shfmt = {
|
|
||||||
package = pkgs.shfmt;
|
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.shfmt.with({
|
|
||||||
command = "${pkgs.shfmt}/bin/shfmt",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
servers = {
|
|
||||||
bash-ls = {
|
|
||||||
package = pkgs.nodePackages.bash-language-server;
|
|
||||||
lspConfig = ''
|
|
||||||
lspconfig.bashls.setup{
|
|
||||||
capabilities = capabilities;
|
|
||||||
on_attach = default_on_attach;
|
|
||||||
cmd = ${
|
|
||||||
if isList cfg.lsp.package
|
|
||||||
then expToLua cfg.lsp.package
|
|
||||||
else ''{"${cfg.lsp.package}/bin/bash-language-server", "start"}''
|
|
||||||
};
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
|
||||||
(mkIf cfg.treesitter.enable {
|
|
||||||
vim.treesitter.enable = true;
|
|
||||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
|
||||||
})
|
|
||||||
|
|
||||||
(mkIf cfg.lsp.enable {
|
|
||||||
vim.lsp.lspconfig.enable = true;
|
|
||||||
vim.lsp.lspconfig.sources.bash-lsp = servers.${cfg.lsp.server}.lspConfig;
|
|
||||||
})
|
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
|
||||||
vim.lsp.null-ls.enable = true;
|
|
||||||
vim.lsp.null-ls.sources.bash-format = formats.${cfg.format.type}.nullConfig;
|
|
||||||
})
|
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
|
||||||
vim.lsp.null-ls.enable = true;
|
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
|
||||||
lang = "bash";
|
|
||||||
config = cfg.extraDiagnostics.types;
|
|
||||||
inherit diagnosticsProviders;
|
|
||||||
};
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
}
|
|
|
@ -12,7 +12,7 @@
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
|
||||||
packageToCmd = package: defaultCmd:
|
packageToCmd = package: defaultCmd:
|
||||||
if isList cfg.lsp.package
|
if isList cfg.lsp.package
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
cfg = config.vim.languages.clang;
|
cfg = config.vim.languages.clang;
|
||||||
|
|
||||||
defaultServer = "ccls";
|
defaultServer = "clangd";
|
||||||
servers = {
|
servers = {
|
||||||
ccls = {
|
ccls = {
|
||||||
package = pkgs.ccls;
|
package = pkgs.ccls;
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
clangd = {
|
clangd = {
|
||||||
package = pkgs.clang-tools_16;
|
package = pkgs.clang-tools;
|
||||||
lspConfig = ''
|
lspConfig = ''
|
||||||
local clangd_cap = capabilities
|
local clangd_cap = capabilities
|
||||||
-- use same offsetEncoding as null-ls
|
-- use same offsetEncoding as null-ls
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
dapConfig = ''
|
dapConfig = ''
|
||||||
dap.adapters.lldb = {
|
dap.adapters.lldb = {
|
||||||
type = 'executable',
|
type = 'executable',
|
||||||
command = '${cfg.dap.package}/bin/lldb-vscode',
|
command = '${cfg.dap.package}/bin/lldb-dap',
|
||||||
name = 'lldb'
|
name = 'lldb'
|
||||||
}
|
}
|
||||||
dap.configurations.cpp = {
|
dap.configurations.cpp = {
|
||||||
|
@ -141,7 +141,7 @@ in {
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
(mkIf cfg.cHeader {
|
(mkIf cfg.cHeader {
|
||||||
vim.configRC.c-header = entryAnywhere "let g:c_syntax_for_h = 1";
|
vim.pluginRC.c-header = entryAfter ["basic"] "vim.g.c_syntax_for_h = 1";
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.treesitter.enable {
|
(mkIf cfg.treesitter.enable {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
defaultServer = "vscode-langservers-extracted";
|
defaultServer = "vscode-langservers-extracted";
|
||||||
servers = {
|
servers = {
|
||||||
vscode-langservers-extracted = {
|
vscode-langservers-extracted = {
|
||||||
package = pkgs.nodePackages.vscode-langservers-extracted;
|
package = pkgs.vscode-langservers-extracted;
|
||||||
lspConfig = ''
|
lspConfig = ''
|
||||||
-- enable (broadcasting) snippet capability for completion
|
-- enable (broadcasting) snippet capability for completion
|
||||||
-- see <https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#cssls>
|
-- see <https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#cssls>
|
||||||
|
|
|
@ -1,18 +1,23 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
|
||||||
pkgs,
|
pkgs,
|
||||||
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.trivial) boolToString;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.types) enum either listOf package nullOr str bool;
|
inherit (lib.types) enum either listOf package nullOr str bool;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
||||||
cfg = config.vim.languages.dart;
|
cfg = config.vim.languages.dart;
|
||||||
|
ftcfg = cfg.flutter-tools;
|
||||||
|
|
||||||
defaultServer = "dart";
|
defaultServer = "dart";
|
||||||
servers = {
|
servers = {
|
||||||
dart = {
|
dart = {
|
||||||
|
@ -48,15 +53,16 @@ in {
|
||||||
default = defaultServer;
|
default = defaultServer;
|
||||||
};
|
};
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
description = "Dart 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 = either package (listOf str);
|
type = either package (listOf str);
|
||||||
default = servers.${cfg.lsp.server}.package;
|
default = servers.${cfg.lsp.server}.package;
|
||||||
|
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
|
||||||
|
description = "Dart LSP server package, or the command to run as a list of strings";
|
||||||
};
|
};
|
||||||
|
|
||||||
opts = mkOption {
|
opts = mkOption {
|
||||||
description = "Options to pass to Dart LSP server";
|
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "Options to pass to Dart LSP server";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -70,23 +76,26 @@ in {
|
||||||
|
|
||||||
flutter-tools = {
|
flutter-tools = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
description = "Enable flutter-tools for flutter support";
|
|
||||||
type = bool;
|
type = bool;
|
||||||
default = config.vim.languages.enableLSP;
|
default = config.vim.languages.enableLSP;
|
||||||
|
description = "Enable flutter-tools for flutter support";
|
||||||
};
|
};
|
||||||
|
|
||||||
enableNoResolvePatch = mkOption {
|
enableNoResolvePatch = mkOption {
|
||||||
description = ''
|
|
||||||
Patch flutter-tools so that it doesn't resolve symlinks when detecting flutter path.
|
|
||||||
This is required if you want to use a flutter package built with nix.
|
|
||||||
If you are using a flutter SDK installed from a different source and encounter the error "`dart` missing from PATH", disable this option.
|
|
||||||
'';
|
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Whether to patch flutter-tools so that it doesn't resolve
|
||||||
|
symlinks when detecting flutter path.
|
||||||
|
|
||||||
|
This is required if you want to use a flutter package built with nix.
|
||||||
|
If you are using a flutter SDK installed from a different source
|
||||||
|
and encounter the error "`dart` missing from PATH", disable this option.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
color = {
|
color = {
|
||||||
enable = mkEnableOption "Whether or mot to highlight color variables at all";
|
enable = mkEnableOption "highlighting color variables";
|
||||||
|
|
||||||
highlightBackground = mkOption {
|
highlightBackground = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
|
@ -112,4 +121,47 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
|
||||||
|
vim.lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf ftcfg.enable {
|
||||||
|
vim.startPlugins =
|
||||||
|
if ftcfg.enableNoResolvePatch
|
||||||
|
then ["flutter-tools-patched"]
|
||||||
|
else ["flutter-tools"];
|
||||||
|
|
||||||
|
vim.pluginRC.flutter-tools = entryAnywhere ''
|
||||||
|
require('flutter-tools').setup {
|
||||||
|
lsp = {
|
||||||
|
color = { -- show the derived colours for dart variables
|
||||||
|
enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
|
||||||
|
background = ${boolToString ftcfg.color.highlightBackground}, -- highlight the background
|
||||||
|
foreground = ${boolToString ftcfg.color.highlightForeground}, -- highlight the foreground
|
||||||
|
virtual_text = ${boolToString ftcfg.color.virtualText.enable}, -- show the highlight using virtual text
|
||||||
|
virtual_text_str = ${ftcfg.color.virtualText.character} -- the virtual text character to highlight
|
||||||
|
},
|
||||||
|
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = default_on_attach;
|
||||||
|
flags = lsp_flags,
|
||||||
|
},
|
||||||
|
${optionalString cfg.dap.enable ''
|
||||||
|
debugger = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
''}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
]);
|
||||||
}
|
}
|
|
@ -1,76 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.lists) isList;
|
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
|
||||||
inherit (lib.strings) optionalString;
|
|
||||||
inherit (lib.trivial) boolToString;
|
|
||||||
inherit (lib.nvim.lua) expToLua;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
|
||||||
|
|
||||||
cfg = config.vim.languages.dart;
|
|
||||||
ftcfg = cfg.flutter-tools;
|
|
||||||
servers = {
|
|
||||||
dart = {
|
|
||||||
package = pkgs.dart;
|
|
||||||
lspConfig = ''
|
|
||||||
lspconfig.dartls.setup{
|
|
||||||
capabilities = capabilities;
|
|
||||||
on_attach=default_on_attach;
|
|
||||||
cmd = ${
|
|
||||||
if isList cfg.lsp.package
|
|
||||||
then expToLua cfg.lsp.package
|
|
||||||
else ''{"${cfg.lsp.package}/bin/dart", "language-server", "--protocol=lsp"}''
|
|
||||||
};
|
|
||||||
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.dartOpts}"}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
|
||||||
(mkIf cfg.treesitter.enable {
|
|
||||||
vim.treesitter.enable = true;
|
|
||||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
|
||||||
})
|
|
||||||
|
|
||||||
(mkIf cfg.lsp.enable {
|
|
||||||
vim.lsp.lspconfig.enable = true;
|
|
||||||
|
|
||||||
vim.lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig;
|
|
||||||
})
|
|
||||||
|
|
||||||
(mkIf ftcfg.enable {
|
|
||||||
vim.startPlugins =
|
|
||||||
if ftcfg.enableNoResolvePatch
|
|
||||||
then ["flutter-tools-patched"]
|
|
||||||
else ["flutter-tools"];
|
|
||||||
|
|
||||||
vim.luaConfigRC.flutter-tools = entryAnywhere ''
|
|
||||||
require('flutter-tools').setup {
|
|
||||||
lsp = {
|
|
||||||
color = { -- show the derived colours for dart variables
|
|
||||||
enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
|
|
||||||
background = ${boolToString ftcfg.color.highlightBackground}, -- highlight the background
|
|
||||||
foreground = ${boolToString ftcfg.color.highlightForeground}, -- highlight the foreground
|
|
||||||
virtual_text = ${boolToString ftcfg.color.virtualText.enable}, -- show the highlight using virtual text
|
|
||||||
virtual_text_str = ${ftcfg.color.virtualText.character} -- the virtual text character to highlight
|
|
||||||
},
|
|
||||||
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = default_on_attach;
|
|
||||||
flags = lsp_flags,
|
|
||||||
},
|
|
||||||
${optionalString cfg.dap.enable ''
|
|
||||||
debugger = {
|
|
||||||
enabled = true,
|
|
||||||
},
|
|
||||||
''}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
}
|
|
|
@ -2,28 +2,29 @@
|
||||||
inherit (lib.nvim.languages) mkEnable;
|
inherit (lib.nvim.languages) mkEnable;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
./bash
|
./bash.nix
|
||||||
./dart
|
./dart.nix
|
||||||
./elixir
|
|
||||||
./markdown
|
|
||||||
./tidal
|
|
||||||
|
|
||||||
./clang.nix
|
./clang.nix
|
||||||
./css.nix
|
./css.nix
|
||||||
|
./elixir.nix
|
||||||
./go.nix
|
./go.nix
|
||||||
./html.nix
|
./html.nix
|
||||||
./java.nix
|
./java.nix
|
||||||
./lua.nix
|
./lua.nix
|
||||||
|
./markdown.nix
|
||||||
./nim.nix
|
./nim.nix
|
||||||
./nix.nix
|
./nix.nix
|
||||||
|
./ocaml.nix
|
||||||
./php.nix
|
./php.nix
|
||||||
./python.nix
|
./python.nix
|
||||||
|
./r.nix
|
||||||
./rust.nix
|
./rust.nix
|
||||||
./sql.nix
|
./sql.nix
|
||||||
./svelte.nix
|
./svelte.nix
|
||||||
./tailwind.nix
|
./tailwind.nix
|
||||||
./terraform.nix
|
./terraform.nix
|
||||||
./ts.nix
|
./ts.nix
|
||||||
|
./typst.nix
|
||||||
./zig.nix
|
./zig.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
138
modules/plugins/languages/elixir.nix
Normal file
138
modules/plugins/languages/elixir.nix
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
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;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.elixir;
|
||||||
|
|
||||||
|
defaultServer = "elixirls";
|
||||||
|
servers = {
|
||||||
|
elixirls = {
|
||||||
|
package = pkgs.elixir-ls;
|
||||||
|
lspConfig = ''
|
||||||
|
-- elixirls setup
|
||||||
|
lspconfig.elixirls.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = default_on_attach,
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else ''{"${cfg.lsp.package}/bin/elixir-ls"}''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultFormat = "mix";
|
||||||
|
formats = {
|
||||||
|
mix = {
|
||||||
|
package = pkgs.elixir;
|
||||||
|
nullConfig = ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.formatting.mix.with({
|
||||||
|
command = "${cfg.format.package}/bin/mix",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.languages.elixir = {
|
||||||
|
enable = mkEnableOption "Elixir language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "Elixir treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "elixir";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "Elixir LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
|
||||||
|
server = mkOption {
|
||||||
|
description = "Elixir LSP server to use";
|
||||||
|
type = enum (attrNames servers);
|
||||||
|
default = defaultServer;
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
description = "Elixir 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 = either package (listOf str);
|
||||||
|
default = servers.${cfg.lsp.server}.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
format = {
|
||||||
|
enable = mkEnableOption "Elixir formatting" // {default = config.vim.languages.enableFormat;};
|
||||||
|
|
||||||
|
type = mkOption {
|
||||||
|
description = "Elixir formatter to use";
|
||||||
|
type = enum (attrNames formats);
|
||||||
|
default = defaultFormat;
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
description = "Elixir formatter package";
|
||||||
|
type = package;
|
||||||
|
default = formats.${cfg.format.type}.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
elixir-tools = {
|
||||||
|
enable = mkEnableOption "Elixir tools";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.elixir-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.format.enable {
|
||||||
|
vim.lsp.null-ls.enable = true;
|
||||||
|
vim.lsp.null-ls.sources.elixir-format = formats.${cfg.format.type}.nullConfig;
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.elixir-tools.enable {
|
||||||
|
vim.startPlugins = ["elixir-tools"];
|
||||||
|
vim.pluginRC.elixir-tools = entryAnywhere ''
|
||||||
|
local elixir = require("elixir")
|
||||||
|
local elixirls = require("elixir.elixirls")
|
||||||
|
|
||||||
|
-- disable imperative insstallations of various
|
||||||
|
-- elixir related tools installed by elixir-tools
|
||||||
|
elixir.setup {
|
||||||
|
nextls = {
|
||||||
|
enable = false -- defaults to false
|
||||||
|
},
|
||||||
|
|
||||||
|
credo = {
|
||||||
|
enable = false -- defaults to true
|
||||||
|
},
|
||||||
|
|
||||||
|
elixirls = {
|
||||||
|
enable = false, -- defaults to true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
|
@ -1,67 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.modules) mkIf;
|
|
||||||
inherit (lib.meta) getExe;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
|
||||||
|
|
||||||
cfg = config.vim.languages.elixir;
|
|
||||||
in {
|
|
||||||
config = mkIf (cfg.enable) {
|
|
||||||
vim.startPlugins = [
|
|
||||||
"elixir-tools"
|
|
||||||
];
|
|
||||||
|
|
||||||
vim.luaConfigRC.elixir-tools = entryAnywhere ''
|
|
||||||
local elixir = require("elixir")
|
|
||||||
local elixirls = require("elixir.elixirls")
|
|
||||||
|
|
||||||
elixir.setup {
|
|
||||||
elixirls = {
|
|
||||||
-- alternatively, point to an existing elixir-ls installation (optional)
|
|
||||||
-- not currently supported by elixirls, but can be a table if you wish to pass other args `{"path/to/elixirls", "--foo"}`
|
|
||||||
cmd = "${getExe pkgs.elixir-ls}",
|
|
||||||
|
|
||||||
-- default settings, use the `settings` function to override settings
|
|
||||||
settings = elixirls.settings {
|
|
||||||
dialyzerEnabled = true,
|
|
||||||
fetchDeps = false,
|
|
||||||
enableTestLenses = false,
|
|
||||||
suggestSpecs = false,
|
|
||||||
},
|
|
||||||
|
|
||||||
on_attach = function(client, bufnr)
|
|
||||||
local map_opts = { buffer = true, noremap = true}
|
|
||||||
|
|
||||||
-- run the codelens under the cursor
|
|
||||||
vim.keymap.set("n", "<space>r", vim.lsp.codelens.run, map_opts)
|
|
||||||
-- remove the pipe operator
|
|
||||||
vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", map_opts)
|
|
||||||
-- add the pipe operator
|
|
||||||
vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", map_opts)
|
|
||||||
vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", map_opts)
|
|
||||||
|
|
||||||
-- bindings for standard LSP functions.
|
|
||||||
vim.keymap.set("n", "<space>df", "<cmd>lua vim.lsp.buf.format()<cr>", map_opts)
|
|
||||||
vim.keymap.set("n", "<space>gd", "<cmd>lua vim.diagnostic.open_float()<cr>", map_opts)
|
|
||||||
vim.keymap.set("n", "<space>dt", "<cmd>lua vim.lsp.buf.definition()<cr>", map_opts)
|
|
||||||
vim.keymap.set("n", "<space>K", "<cmd>lua vim.lsp.buf.hover()<cr>", map_opts)
|
|
||||||
vim.keymap.set("n", "<space>gD","<cmd>lua vim.lsp.buf.implementation()<cr>", map_opts)
|
|
||||||
vim.keymap.set("n", "<space>1gD","<cmd>lua vim.lsp.buf.type_definition()<cr>", map_opts)
|
|
||||||
|
|
||||||
-- keybinds for fzf-lsp.nvim: https://github.com/gfanto/fzf-lsp.nvim
|
|
||||||
-- you could also use telescope.nvim: https://github.com/nvim-telescope/telescope.nvim
|
|
||||||
-- there are also core vim.lsp functions that put the same data in the loclist
|
|
||||||
vim.keymap.set("n", "<space>gr", ":References<cr>", map_opts)
|
|
||||||
vim.keymap.set("n", "<space>g0", ":DocumentSymbols<cr>", map_opts)
|
|
||||||
vim.keymap.set("n", "<space>gW", ":WorkspaceSymbols<cr>", map_opts)
|
|
||||||
vim.keymap.set("n", "<leader>d", ":Diagnostics<cr>", map_opts)
|
|
||||||
end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
{lib, ...}: let
|
|
||||||
inherit (lib.options) mkEnableOption;
|
|
||||||
in {
|
|
||||||
options.vim.languages.elixir = {
|
|
||||||
enable = mkEnableOption "Elixir language support";
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -12,6 +12,7 @@
|
||||||
inherit (lib.types) bool enum either listOf package str;
|
inherit (lib.types) bool enum either listOf package str;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
|
||||||
cfg = config.vim.languages.go;
|
cfg = config.vim.languages.go;
|
||||||
|
|
||||||
|
@ -37,40 +38,6 @@
|
||||||
debuggers = {
|
debuggers = {
|
||||||
delve = {
|
delve = {
|
||||||
package = pkgs.delve;
|
package = pkgs.delve;
|
||||||
dapConfig = ''
|
|
||||||
dap.adapters.delve = {
|
|
||||||
type = "server",
|
|
||||||
port = "''${port}",
|
|
||||||
executable = {
|
|
||||||
command = "${getExe cfg.dap.package}",
|
|
||||||
args = { "dap", "-l", "127.0.0.1:''${port}" },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
dap.configurations.go = {
|
|
||||||
{
|
|
||||||
type = "delve",
|
|
||||||
name = "Debug",
|
|
||||||
request = "launch",
|
|
||||||
program = "''${file}",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type = "delve",
|
|
||||||
name = "Debug test", -- configuration for debugging test files
|
|
||||||
request = "launch",
|
|
||||||
mode = "test",
|
|
||||||
program = "''${file}",
|
|
||||||
},
|
|
||||||
-- works with go.mod packages and sub packages
|
|
||||||
{
|
|
||||||
type = "delve",
|
|
||||||
name = "Debug test (go.mod)",
|
|
||||||
request = "launch",
|
|
||||||
mode = "test",
|
|
||||||
program = "./''${relativeFileDirname}",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
@ -102,15 +69,17 @@ in {
|
||||||
|
|
||||||
dap = {
|
dap = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
description = "Enable Go Debug Adapter";
|
description = "Enable Go Debug Adapter via nvim-dap-go plugin";
|
||||||
type = bool;
|
type = bool;
|
||||||
default = config.vim.languages.enableDAP;
|
default = config.vim.languages.enableDAP;
|
||||||
};
|
};
|
||||||
|
|
||||||
debugger = mkOption {
|
debugger = mkOption {
|
||||||
description = "Go debugger to use";
|
description = "Go debugger to use";
|
||||||
type = enum (attrNames debuggers);
|
type = enum (attrNames debuggers);
|
||||||
default = defaultDebugger;
|
default = defaultDebugger;
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
description = "Go debugger package.";
|
description = "Go debugger package.";
|
||||||
type = package;
|
type = package;
|
||||||
|
@ -131,8 +100,17 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.dap.enable {
|
(mkIf cfg.dap.enable {
|
||||||
vim.debugger.nvim-dap.enable = true;
|
vim = {
|
||||||
vim.debugger.nvim-dap.sources.go-debugger = debuggers.${cfg.dap.debugger}.dapConfig;
|
startPlugins = ["nvim-dap-go"];
|
||||||
|
pluginRC.nvim-dap-go = entryAfter ["nvim-dap"] ''
|
||||||
|
require('dap-go').setup {
|
||||||
|
delve = {
|
||||||
|
path = '${getExe cfg.dap.package}',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
debugger.nvim-dap.enable = true;
|
||||||
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ in {
|
||||||
grammars = [cfg.treesitter.package];
|
grammars = [cfg.treesitter.package];
|
||||||
};
|
};
|
||||||
|
|
||||||
luaConfigRC.html-autotag = mkIf cfg.treesitter.autotagHtml (entryAnywhere ''
|
pluginRC.html-autotag = mkIf cfg.treesitter.autotagHtml (entryAnywhere ''
|
||||||
require('nvim-ts-autotag').setup()
|
require('nvim-ts-autotag').setup()
|
||||||
'');
|
'');
|
||||||
};
|
};
|
||||||
|
|
|
@ -61,7 +61,7 @@ in {
|
||||||
|
|
||||||
(mkIf cfg.lsp.neodev.enable {
|
(mkIf cfg.lsp.neodev.enable {
|
||||||
vim.startPlugins = ["neodev-nvim"];
|
vim.startPlugins = ["neodev-nvim"];
|
||||||
vim.luaConfigRC.neodev = entryBefore ["lua-lsp"] ''
|
vim.pluginRC.neodev = entryBefore ["lua-lsp"] ''
|
||||||
require("neodev").setup({})
|
require("neodev").setup({})
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames concatLists;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) bool enum either package listOf str;
|
inherit (lib.types) bool enum either package listOf str;
|
||||||
|
@ -29,15 +30,31 @@
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
defaultFormat = "denofmt";
|
||||||
|
formats = {
|
||||||
|
denofmt = {
|
||||||
|
package = pkgs.deno;
|
||||||
|
nullConfig = ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.formatting.deno_fmt.with({
|
||||||
|
filetypes = ${expToLua (concatLists [cfg.format.extraFiletypes ["markdown"]])},
|
||||||
|
command = "${cfg.format.package}/bin/deno",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
options.vim.languages.markdown = {
|
options.vim.languages.markdown = {
|
||||||
enable = mkEnableOption "Markdown markup language support";
|
enable = mkEnableOption "Markdown markup language support";
|
||||||
|
|
||||||
treesitter = {
|
treesitter = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
description = "Enable Markdown treesitter";
|
|
||||||
type = bool;
|
type = bool;
|
||||||
default = config.vim.languages.enableTreesitter;
|
default = config.vim.languages.enableTreesitter;
|
||||||
|
description = "Enable Markdown treesitter";
|
||||||
};
|
};
|
||||||
mdPackage = mkGrammarOption pkgs "markdown";
|
mdPackage = mkGrammarOption pkgs "markdown";
|
||||||
mdInlinePackage = mkGrammarOption pkgs "markdown-inline";
|
mdInlinePackage = mkGrammarOption pkgs "markdown-inline";
|
||||||
|
@ -47,17 +64,56 @@ in {
|
||||||
enable = mkEnableOption "Enable Markdown LSP support" // {default = config.vim.languages.enableLSP;};
|
enable = mkEnableOption "Enable Markdown LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
|
||||||
server = mkOption {
|
server = mkOption {
|
||||||
description = "Markdown LSP server to use";
|
|
||||||
type = enum (attrNames servers);
|
type = enum (attrNames servers);
|
||||||
default = defaultServer;
|
default = defaultServer;
|
||||||
|
description = "Markdown LSP server to use";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkOption {
|
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 = either package (listOf str);
|
type = either package (listOf str);
|
||||||
default = servers.${cfg.lsp.server}.package;
|
default = servers.${cfg.lsp.server}.package;
|
||||||
|
example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]'';
|
||||||
|
description = "Markdown LSP server package, or the command to run as a list of strings";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
format = {
|
||||||
|
enable = mkEnableOption "Markdown formatting" // {default = config.vim.languages.enableFormat;};
|
||||||
|
|
||||||
|
type = mkOption {
|
||||||
|
type = enum (attrNames formats);
|
||||||
|
default = defaultFormat;
|
||||||
|
description = "Markdown formatter to use";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
default = formats.${cfg.format.type}.package;
|
||||||
|
description = "Markdown formatter package";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraFiletypes = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = [];
|
||||||
|
description = "Extra filetypes to format with the Markdown formatter";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.format.enable {
|
||||||
|
vim.lsp.null-ls.enable = true;
|
||||||
|
vim.lsp.null-ls.sources.markdown-format = formats.${cfg.format.type}.nullConfig;
|
||||||
|
})
|
||||||
|
]);
|
||||||
}
|
}
|
|
@ -1,40 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.nvim.lua) expToLua;
|
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
|
||||||
inherit (lib.lists) isList;
|
|
||||||
|
|
||||||
cfg = config.vim.languages.markdown;
|
|
||||||
servers = {
|
|
||||||
marksman = {
|
|
||||||
package = pkgs.marksman;
|
|
||||||
lspConfig = ''
|
|
||||||
lspconfig.marksman.setup{
|
|
||||||
capabilities = capabilities;
|
|
||||||
on_attach = default_on_attach;
|
|
||||||
cmd = ${
|
|
||||||
if isList cfg.lsp.package
|
|
||||||
then expToLua cfg.lsp.package
|
|
||||||
else ''{"${cfg.lsp.package}/bin/marksman", "server"}''
|
|
||||||
},
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
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;
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
}
|
|
|
@ -11,7 +11,6 @@
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.types) enum either listOf package str;
|
inherit (lib.types) enum either listOf package str;
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||||
|
|
||||||
|
@ -176,8 +175,16 @@ in {
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
{
|
{
|
||||||
vim.configRC.nix = entryAnywhere ''
|
vim.pluginRC.nix = ''
|
||||||
autocmd filetype nix setlocal tabstop=2 shiftwidth=2 softtabstop=2
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "nix",
|
||||||
|
callback = function(opts)
|
||||||
|
local bo = vim.bo[opts.buf]
|
||||||
|
bo.tabstop = 2
|
||||||
|
bo.shiftwidth = 2
|
||||||
|
bo.softtabstop = 2
|
||||||
|
end
|
||||||
|
})
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
105
modules/plugins/languages/ocaml.nix
Normal file
105
modules/plugins/languages/ocaml.nix
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
|
inherit (lib.lists) isList;
|
||||||
|
inherit (lib.types) either enum listOf package str;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.ocaml;
|
||||||
|
|
||||||
|
defaultServer = "ocaml-lsp";
|
||||||
|
servers = {
|
||||||
|
ocaml-lsp = {
|
||||||
|
package = pkgs.ocamlPackages.ocaml-lsp;
|
||||||
|
lspConfig = ''
|
||||||
|
lspconfig.ocamllsp.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = default_on_attach,
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else ''{"${getExe cfg.lsp.package}"}''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultFormat = "ocamlformat";
|
||||||
|
formats = {
|
||||||
|
ocamlformat = {
|
||||||
|
package = pkgs.ocamlPackages.ocamlformat;
|
||||||
|
nullConfig = ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.formatting.ocamlformat.with({
|
||||||
|
command = "${cfg.format.package}/bin/ocamlformat",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.languages.ocaml = {
|
||||||
|
enable = mkEnableOption "OCaml language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "OCaml treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "ocaml";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "OCaml LSP support (ocaml-lsp)" // {default = config.vim.languages.enableLSP;};
|
||||||
|
server = mkOption {
|
||||||
|
description = "OCaml LSP server to user";
|
||||||
|
type = enum (attrNames servers);
|
||||||
|
default = defaultServer;
|
||||||
|
};
|
||||||
|
package = mkOption {
|
||||||
|
description = "OCaml language server package, or the command to run as a list of strings";
|
||||||
|
type = either package (listOf str);
|
||||||
|
default = servers.${cfg.lsp.server}.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
format = {
|
||||||
|
enable = mkEnableOption "OCaml formatting support (ocamlformat)" // {default = config.vim.languages.enableFormat;};
|
||||||
|
type = mkOption {
|
||||||
|
description = "OCaml formatter to use";
|
||||||
|
type = enum (attrNames formats);
|
||||||
|
default = defaultFormat;
|
||||||
|
};
|
||||||
|
package = mkOption {
|
||||||
|
description = "OCaml formatter package";
|
||||||
|
type = package;
|
||||||
|
default = formats.${cfg.format.type}.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.ocaml-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.format.enable {
|
||||||
|
vim.lsp.null-ls.enable = true;
|
||||||
|
vim.lsp.null-ls.sources.ocamlformat = formats.${cfg.format.type}.nullConfig;
|
||||||
|
vim.extraPackages = [formats.${cfg.format.type}.package];
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
|
@ -14,10 +14,10 @@
|
||||||
|
|
||||||
cfg = config.vim.languages.python;
|
cfg = config.vim.languages.python;
|
||||||
|
|
||||||
defaultServer = "pyright";
|
defaultServer = "basedpyright";
|
||||||
servers = {
|
servers = {
|
||||||
pyright = {
|
pyright = {
|
||||||
package = pkgs.nodePackages.pyright;
|
package = pkgs.pyright;
|
||||||
lspConfig = ''
|
lspConfig = ''
|
||||||
lspconfig.pyright.setup{
|
lspconfig.pyright.setup{
|
||||||
capabilities = capabilities;
|
capabilities = capabilities;
|
||||||
|
@ -30,6 +30,36 @@
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
basedpyright = {
|
||||||
|
package = pkgs.basedpyright;
|
||||||
|
lspConfig = ''
|
||||||
|
lspconfig.basedpyright.setup{
|
||||||
|
capabilities = capabilities;
|
||||||
|
on_attach = default_on_attach;
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else ''{"${cfg.lsp.package}/bin/basedpyright-langserver", "--stdio"}''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
python-lsp-server = {
|
||||||
|
package = pkgs.python-lsp-server;
|
||||||
|
lspConfig = ''
|
||||||
|
lspconfig.pylsp.setup{
|
||||||
|
capabilities = capabilities;
|
||||||
|
on_attach = default_on_attach;
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else ''{"${cfg.lsp.package}/bin/pylsp"}''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultFormat = "black";
|
defaultFormat = "black";
|
||||||
|
@ -61,11 +91,12 @@
|
||||||
black-and-isort = {
|
black-and-isort = {
|
||||||
package = pkgs.writeShellApplication {
|
package = pkgs.writeShellApplication {
|
||||||
name = "black";
|
name = "black";
|
||||||
|
runtimeInputs = [pkgs.black pkgs.isort];
|
||||||
text = ''
|
text = ''
|
||||||
black --quiet - "$@" | isort --profile black -
|
black --quiet - "$@" | isort --profile black -
|
||||||
'';
|
'';
|
||||||
runtimeInputs = [pkgs.black pkgs.isort];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nullConfig = ''
|
nullConfig = ''
|
||||||
table.insert(
|
table.insert(
|
||||||
ls_sources,
|
ls_sources,
|
||||||
|
|
78
modules/plugins/languages/r.nix
Normal file
78
modules/plugins/languages/r.nix
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
|
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.types) mkGrammarOption;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.r;
|
||||||
|
|
||||||
|
r-with-languageserver = pkgs.rWrapper.override {
|
||||||
|
packages = with pkgs.rPackages; [languageserver];
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultServer = "r_language_server";
|
||||||
|
servers = {
|
||||||
|
r_language_server = {
|
||||||
|
package = pkgs.writeShellScriptBin "r_lsp" ''
|
||||||
|
${r-with-languageserver}/bin/R --slave -e "languageserver::run()"
|
||||||
|
'';
|
||||||
|
lspConfig = ''
|
||||||
|
lspconfig.r_language_server.setup{
|
||||||
|
capabilities = capabilities;
|
||||||
|
on_attach = default_on_attach;
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else ''{"${lib.getExe cfg.lsp.package}"}''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.languages.r = {
|
||||||
|
enable = mkEnableOption "R language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "R treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "r";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "R LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
|
||||||
|
server = mkOption {
|
||||||
|
description = "R LSP server to use";
|
||||||
|
type = enum (attrNames servers);
|
||||||
|
default = defaultServer;
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
description = "R LSP server package, or the command to run as a list of strings";
|
||||||
|
example = literalExpression "[ (lib.getExe pkgs.jdt-language-server) \"-data\" \"~/.cache/jdtls/workspace\" ]";
|
||||||
|
type = either package (listOf str);
|
||||||
|
default = servers.${cfg.lsp.server}.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.r-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
|
@ -4,17 +4,33 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.trivial) boolToString;
|
inherit (lib.trivial) boolToString;
|
||||||
inherit (lib.lists) isList optionals;
|
inherit (lib.lists) isList optionals;
|
||||||
inherit (lib.types) bool package str listOf either;
|
inherit (lib.types) bool package str listOf either enum;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
||||||
cfg = config.vim.languages.rust;
|
cfg = config.vim.languages.rust;
|
||||||
|
|
||||||
|
defaultFormat = "rustfmt";
|
||||||
|
formats = {
|
||||||
|
rustfmt = {
|
||||||
|
package = pkgs.rustfmt;
|
||||||
|
nullConfig = ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.formatting.rustfmt.with({
|
||||||
|
command = "${cfg.format.package}/bin/rustfmt",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
options.vim.languages.rust = {
|
options.vim.languages.rust = {
|
||||||
enable = mkEnableOption "Rust language support";
|
enable = mkEnableOption "Rust language support";
|
||||||
|
@ -49,6 +65,22 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
format = {
|
||||||
|
enable = mkEnableOption "Rust formatting" // {default = config.vim.languages.enableFormat;};
|
||||||
|
|
||||||
|
type = mkOption {
|
||||||
|
description = "Rust formatter to use";
|
||||||
|
type = enum (attrNames formats);
|
||||||
|
default = defaultFormat;
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
description = "Rust formatter package";
|
||||||
|
type = package;
|
||||||
|
default = formats.${cfg.format.type}.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
dap = {
|
dap = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
description = "Rust Debug Adapter support";
|
description = "Rust Debug Adapter support";
|
||||||
|
@ -70,7 +102,7 @@ in {
|
||||||
startPlugins = ["crates-nvim"];
|
startPlugins = ["crates-nvim"];
|
||||||
lsp.null-ls.enable = mkIf cfg.crates.codeActions true;
|
lsp.null-ls.enable = mkIf cfg.crates.codeActions true;
|
||||||
autocomplete.sources = {"crates" = "[Crates]";};
|
autocomplete.sources = {"crates" = "[Crates]";};
|
||||||
luaConfigRC.rust-crates = entryAnywhere ''
|
pluginRC.rust-crates = entryAnywhere ''
|
||||||
require('crates').setup {
|
require('crates').setup {
|
||||||
null_ls = {
|
null_ls = {
|
||||||
enabled = ${boolToString cfg.crates.codeActions},
|
enabled = ${boolToString cfg.crates.codeActions},
|
||||||
|
@ -86,74 +118,68 @@ in {
|
||||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.format.enable {
|
||||||
|
vim.lsp.null-ls.enable = true;
|
||||||
|
vim.lsp.null-ls.sources.rust-format = formats.${cfg.format.type}.nullConfig;
|
||||||
|
})
|
||||||
|
|
||||||
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
|
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["rust-tools"] ++ optionals cfg.dap.enable [cfg.dap.package];
|
startPlugins = ["rustaceanvim"];
|
||||||
|
|
||||||
lsp.lspconfig = {
|
luaConfigRC.rustaceanvim = entryAnywhere ''
|
||||||
enable = true;
|
vim.g.rustaceanvim = {
|
||||||
sources.rust-lsp = ''
|
${optionalString cfg.lsp.enable ''
|
||||||
local rt = require('rust-tools')
|
-- LSP
|
||||||
rust_on_attach = function(client, bufnr)
|
tools = {
|
||||||
default_on_attach(client, bufnr)
|
hover_actions = {
|
||||||
local opts = { noremap=true, silent=true, buffer = bufnr }
|
replace_builtin_hover = false
|
||||||
vim.keymap.set("n", "<leader>ris", rt.inlay_hints.set, opts)
|
|
||||||
vim.keymap.set("n", "<leader>riu", rt.inlay_hints.unset, opts)
|
|
||||||
vim.keymap.set("n", "<leader>rr", rt.runnables.runnables, opts)
|
|
||||||
vim.keymap.set("n", "<leader>rp", rt.parent_module.parent_module, opts)
|
|
||||||
vim.keymap.set("n", "<leader>rm", rt.expand_macro.expand_macro, opts)
|
|
||||||
vim.keymap.set("n", "<leader>rc", rt.open_cargo_toml.open_cargo_toml, opts)
|
|
||||||
vim.keymap.set("n", "<leader>rg", function() rt.crate_graph.view_crate_graph("x11", nil) end, opts)
|
|
||||||
${optionalString cfg.dap.enable ''
|
|
||||||
vim.keymap.set("n", "<leader>rd", ":RustDebuggables<cr>", 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,
|
server = {
|
||||||
on_attach = rust_on_attach,
|
cmd = ${
|
||||||
cmd = ${
|
|
||||||
if isList cfg.lsp.package
|
if isList cfg.lsp.package
|
||||||
then expToLua cfg.lsp.package
|
then expToLua cfg.lsp.package
|
||||||
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
||||||
},
|
},
|
||||||
settings = {
|
on_attach = function(client, bufnr)
|
||||||
${cfg.lsp.opts}
|
default_on_attach(client, bufnr)
|
||||||
}
|
local opts = { noremap=true, silent=true, buffer = bufnr }
|
||||||
},
|
vim.keymap.set("n", "<leader>rr", ":RustLsp runnables<CR>", opts)
|
||||||
|
vim.keymap.set("n", "<leader>rp", ":RustLsp parentModule<CR>", opts)
|
||||||
${optionalString cfg.dap.enable ''
|
vim.keymap.set("n", "<leader>rm", ":RustLsp expandMacro<CR>", opts)
|
||||||
dap = {
|
vim.keymap.set("n", "<leader>rc", ":RustLsp openCargo", opts)
|
||||||
adapter = {
|
vim.keymap.set("n", "<leader>rg", ":RustLsp crateGraph x11", opts)
|
||||||
type = "executable",
|
${optionalString cfg.dap.enable ''
|
||||||
command = "${cfg.dap.package}/bin/lldb-vscode",
|
vim.keymap.set("n", "<leader>rd", ":RustLsp debuggables<cr>", opts)
|
||||||
name = "rt_lldb",
|
vim.keymap.set(
|
||||||
},
|
"n", "${config.vim.debugger.nvim-dap.mappings.continue}",
|
||||||
},
|
function()
|
||||||
|
local dap = require("dap")
|
||||||
|
if dap.status() == "" then
|
||||||
|
vim.cmd "RustLsp debuggables"
|
||||||
|
else
|
||||||
|
dap.continue()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
opts
|
||||||
|
)
|
||||||
''}
|
''}
|
||||||
}
|
end
|
||||||
rt.setup(rustopts)
|
},
|
||||||
'';
|
''}
|
||||||
};
|
|
||||||
|
${optionalString cfg.dap.enable ''
|
||||||
|
dap = {
|
||||||
|
adapter = {
|
||||||
|
type = "executable",
|
||||||
|
command = "${cfg.dap.package}/bin/lldb-dap",
|
||||||
|
name = "rustacean_lldb",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
''}
|
||||||
|
}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
defaultDiagnosticsProvider = ["eslint_d"];
|
defaultDiagnosticsProvider = ["eslint_d"];
|
||||||
diagnosticsProviders = {
|
diagnosticsProviders = {
|
||||||
eslint_d = {
|
eslint_d = {
|
||||||
package = pkgs.nodePackages.eslint_d;
|
package = pkgs.eslint_d;
|
||||||
nullConfig = pkg: ''
|
nullConfig = pkg: ''
|
||||||
table.insert(
|
table.insert(
|
||||||
ls_sources,
|
ls_sources,
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.modules) mkIf;
|
|
||||||
|
|
||||||
cfg = config.vim.tidal;
|
|
||||||
in {
|
|
||||||
config = mkIf (cfg.enable) {
|
|
||||||
vim.startPlugins = [
|
|
||||||
# From tidalcycles flake
|
|
||||||
pkgs.vimPlugins.vim-tidal
|
|
||||||
];
|
|
||||||
|
|
||||||
vim.globals = {
|
|
||||||
"tidal_target" = "terminal";
|
|
||||||
"tidal_flash_duration" = 150;
|
|
||||||
"tidal_sc_enable" = cfg.openSC;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
{...}: {
|
|
||||||
imports = [
|
|
||||||
./tidal.nix
|
|
||||||
./config.nix
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
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 = int;
|
|
||||||
default = 150;
|
|
||||||
};
|
|
||||||
|
|
||||||
openSC = mkOption {
|
|
||||||
description = "Automatically run the supercollider CLI, sclang, alongside the Tidal GHCI terminal.";
|
|
||||||
type = bool;
|
|
||||||
default = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -9,19 +9,20 @@
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.types) enum either listOf package str;
|
inherit (lib.types) enum either listOf package str bool;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics mkPluginSetupOption;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
||||||
cfg = config.vim.languages.ts;
|
cfg = config.vim.languages.ts;
|
||||||
|
|
||||||
defaultServer = "tsserver";
|
defaultServer = "ts_ls";
|
||||||
servers = {
|
servers = {
|
||||||
tsserver = {
|
ts_ls = {
|
||||||
package = pkgs.nodePackages.typescript-language-server;
|
package = pkgs.typescript-language-server;
|
||||||
lspConfig = ''
|
lspConfig = ''
|
||||||
lspconfig.tsserver.setup {
|
lspconfig.ts_ls.setup {
|
||||||
capabilities = capabilities;
|
capabilities = capabilities;
|
||||||
on_attach = attach_keymaps,
|
on_attach = attach_keymaps,
|
||||||
cmd = ${
|
cmd = ${
|
||||||
|
@ -32,6 +33,7 @@
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
denols = {
|
denols = {
|
||||||
package = pkgs.deno;
|
package = pkgs.deno;
|
||||||
lspConfig = ''
|
lspConfig = ''
|
||||||
|
@ -47,6 +49,24 @@
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Here for backwards compatibility. Still consider tsserver a valid
|
||||||
|
# configuration in the enum, but assert if it's set to *properly*
|
||||||
|
# redirect the user to the correct server.
|
||||||
|
tsserver = {
|
||||||
|
package = pkgs.typescript-language-server;
|
||||||
|
lspConfig = ''
|
||||||
|
lspconfig.ts_ls.setup {
|
||||||
|
capabilities = capabilities;
|
||||||
|
on_attach = attach_keymaps,
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else ''{"${cfg.lsp.package}/bin/typescript-language-server", "--stdio"}''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: specify packages
|
# TODO: specify packages
|
||||||
|
@ -63,6 +83,7 @@
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
prettierd = {
|
prettierd = {
|
||||||
package = pkgs.prettierd;
|
package = pkgs.prettierd;
|
||||||
nullConfig = ''
|
nullConfig = ''
|
||||||
|
@ -80,7 +101,7 @@
|
||||||
defaultDiagnosticsProvider = ["eslint_d"];
|
defaultDiagnosticsProvider = ["eslint_d"];
|
||||||
diagnosticsProviders = {
|
diagnosticsProviders = {
|
||||||
eslint_d = {
|
eslint_d = {
|
||||||
package = pkgs.nodePackages.eslint_d;
|
package = pkgs.eslint_d;
|
||||||
nullConfig = pkg: ''
|
nullConfig = pkg: ''
|
||||||
table.insert(
|
table.insert(
|
||||||
ls_sources,
|
ls_sources,
|
||||||
|
@ -92,6 +113,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
_file = ./ts.nix;
|
||||||
options.vim.languages.ts = {
|
options.vim.languages.ts = {
|
||||||
enable = mkEnableOption "Typescript/Javascript language support";
|
enable = mkEnableOption "Typescript/Javascript language support";
|
||||||
|
|
||||||
|
@ -143,6 +165,24 @@ in {
|
||||||
inherit defaultDiagnosticsProvider;
|
inherit defaultDiagnosticsProvider;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extensions = {
|
||||||
|
ts-error-translator = {
|
||||||
|
enable = mkEnableOption ''
|
||||||
|
Typescript error translation with
|
||||||
|
[ts-error-translator.nvim](github.com/dmmulroy/ts-error-translator.nvim)
|
||||||
|
'';
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "ts-error-translator" {
|
||||||
|
# This is the default configuration behaviour.
|
||||||
|
auto_override_publish_diagnostics = mkOption {
|
||||||
|
description = "Automatically override the publish_diagnostics handler";
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
@ -169,5 +209,33 @@ in {
|
||||||
inherit diagnosticsProviders;
|
inherit diagnosticsProviders;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# Extensions
|
||||||
|
(mkIf cfg.extensions."ts-error-translator".enable {
|
||||||
|
vim.startPlugins = ["ts-error-translator"];
|
||||||
|
vim.pluginRC.ts-error-translator = entryAnywhere ''
|
||||||
|
require("ts-error-translator").setup(${toLuaObject cfg.extensions.ts-error-translator.setupOpts})
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
|
||||||
|
# Warn the user if they have set the default server name to tsserver to match upstream (us)
|
||||||
|
# The name "tsserver" has been deprecated in lspconfig, and now should be called ts_ls. This
|
||||||
|
# is a purely cosmetic change, but emits a warning if not accounted for.
|
||||||
|
{
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = cfg.lsp.enable -> cfg.lsp.server != "tsserver";
|
||||||
|
message = ''
|
||||||
|
As of a recent lspconfig update, the `tsserver` configuration has been renamed
|
||||||
|
to `ts_ls` to match upstream behaviour of `lspconfig`, and the name `tsserver`
|
||||||
|
is no longer considered valid by nvf. Please set `vim.languages.ts.lsp.server`
|
||||||
|
to `"ts_ls"` instead of to `${cfg.lsp.server}`
|
||||||
|
|
||||||
|
Please see <https://github.com/neovim/nvim-lspconfig/pull/3232> for more details
|
||||||
|
about this change.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
100
modules/plugins/languages/typst.nix
Normal file
100
modules/plugins/languages/typst.nix
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.lists) isList;
|
||||||
|
inherit (lib.types) enum either listOf package str;
|
||||||
|
inherit (lib.attrsets) attrNames;
|
||||||
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.typst;
|
||||||
|
|
||||||
|
defaultFormat = "typstfmt";
|
||||||
|
formats = {
|
||||||
|
typstfmt = {
|
||||||
|
package = pkgs.typstfmt;
|
||||||
|
nullConfig = ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.formatting.typstfmt.with({
|
||||||
|
command = "${cfg.format.package}/bin/typstfmt",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
# https://github.com/Enter-tainer/typstyle
|
||||||
|
typstyle = {
|
||||||
|
package = pkgs.typstyle;
|
||||||
|
nullConfig = ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.formatting.typstfmt.with({
|
||||||
|
command = "${cfg.format.package}/bin/typstyle",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.languages.typst = {
|
||||||
|
enable = mkEnableOption "Typst language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "Typst treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "typst";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "Typst LSP support (typst-lsp)" // {default = config.vim.languages.enableLSP;};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
description = "typst-lsp package, or the command to run as a list of strings";
|
||||||
|
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
|
||||||
|
type = either package (listOf str);
|
||||||
|
default = pkgs.typst-lsp;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
format = {
|
||||||
|
enable = mkEnableOption "Typst document formatting" // {default = config.vim.languages.enableFormat;};
|
||||||
|
|
||||||
|
type = mkOption {
|
||||||
|
description = "Typst formatter to use";
|
||||||
|
type = enum (attrNames formats);
|
||||||
|
default = defaultFormat;
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
description = "Typst formatter package";
|
||||||
|
type = package;
|
||||||
|
default = formats.${cfg.format.type}.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.typst-lsp = ''
|
||||||
|
lspconfig.typst_lsp.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach=default_on_attach,
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else ''{"${cfg.lsp.package}/bin/typst-lsp"}''
|
||||||
|
},
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
|
@ -16,7 +16,10 @@
|
||||||
|
|
||||||
mappingDefinitions = self.options.vim.lsp.mappings;
|
mappingDefinitions = self.options.vim.lsp.mappings;
|
||||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||||
mkBinding = binding: action: "vim.api.nvim_buf_set_keymap(bufnr, 'n', '${binding.value}', '<cmd>lua ${action}<CR>', {noremap=true, silent=true, desc='${binding.description}'})";
|
mkBinding = binding: action:
|
||||||
|
if binding.value != null
|
||||||
|
then "vim.api.nvim_buf_set_keymap(bufnr, 'n', '${binding.value}', '<cmd>lua ${action}<CR>', {noremap=true, silent=true, desc='${binding.description}'})"
|
||||||
|
else "";
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
|
@ -24,7 +27,7 @@ in {
|
||||||
|
|
||||||
autocomplete.sources = {"nvim_lsp" = "[LSP]";};
|
autocomplete.sources = {"nvim_lsp" = "[LSP]";};
|
||||||
|
|
||||||
luaConfigRC.lsp-setup = ''
|
pluginRC.lsp-setup = ''
|
||||||
vim.g.formatsave = ${boolToString cfg.formatOnSave};
|
vim.g.formatsave = ${boolToString cfg.formatOnSave};
|
||||||
|
|
||||||
local attach_keymaps = function(client, bufnr)
|
local attach_keymaps = function(client, bufnr)
|
||||||
|
@ -100,11 +103,11 @@ in {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
${optionalString (config.vim.ui.breadcrumbs.enable) ''local navic = require("nvim-navic")''}
|
${optionalString config.vim.ui.breadcrumbs.enable ''local navic = require("nvim-navic")''}
|
||||||
default_on_attach = function(client, bufnr)
|
default_on_attach = function(client, bufnr)
|
||||||
attach_keymaps(client, bufnr)
|
attach_keymaps(client, bufnr)
|
||||||
format_callback(client, bufnr)
|
format_callback(client, bufnr)
|
||||||
${optionalString (config.vim.ui.breadcrumbs.enable) ''
|
${optionalString config.vim.ui.breadcrumbs.enable ''
|
||||||
-- let navic attach to buffers
|
-- let navic attach to buffers
|
||||||
if client.server_capabilities.documentSymbolProvider then
|
if client.server_capabilities.documentSymbolProvider then
|
||||||
navic.attach(client, bufnr)
|
navic.attach(client, bufnr)
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
|
|
||||||
# lsp plugins
|
# lsp plugins
|
||||||
./lspsaga
|
./lspsaga
|
||||||
./nvim-code-action-menu
|
|
||||||
./trouble
|
./trouble
|
||||||
./lsp-signature
|
./lsp-signature
|
||||||
./lightbulb
|
./lightbulb
|
||||||
|
./otter
|
||||||
./lspkind
|
./lspkind
|
||||||
./lsplines
|
./lsplines
|
||||||
./nvim-docs-view
|
./nvim-docs-view
|
||||||
|
|
|
@ -12,7 +12,7 @@ in {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["nvim-lightbulb"];
|
startPlugins = ["nvim-lightbulb"];
|
||||||
|
|
||||||
luaConfigRC.lightbulb = entryAnywhere ''
|
pluginRC.lightbulb = entryAnywhere ''
|
||||||
vim.api.nvim_command('autocmd CursorHold,CursorHoldI * lua require\'nvim-lightbulb\'.update_lightbulb()')
|
vim.api.nvim_command('autocmd CursorHold,CursorHoldI * lua require\'nvim-lightbulb\'.update_lightbulb()')
|
||||||
|
|
||||||
-- Enable trouble diagnostics viewer
|
-- Enable trouble diagnostics viewer
|
||||||
|
|
|
@ -20,7 +20,7 @@ in {
|
||||||
handler_opts.border = config.vim.ui.borders.plugins.lsp-signature.style;
|
handler_opts.border = config.vim.ui.borders.plugins.lsp-signature.style;
|
||||||
};
|
};
|
||||||
|
|
||||||
luaConfigRC.lsp-signature = entryAnywhere ''
|
pluginRC.lsp-signature = entryAnywhere ''
|
||||||
-- Enable lsp signature viewer
|
-- Enable lsp signature viewer
|
||||||
require("lsp_signature").setup(${toLuaObject cfg.lspSignature.setupOpts})
|
require("lsp_signature").setup(${toLuaObject cfg.lspSignature.setupOpts})
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.attrsets) mapAttrs;
|
inherit (lib.attrsets) mapAttrs;
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp;
|
||||||
in {
|
in {
|
||||||
|
@ -17,19 +18,19 @@ in {
|
||||||
|
|
||||||
startPlugins = ["nvim-lspconfig"];
|
startPlugins = ["nvim-lspconfig"];
|
||||||
|
|
||||||
luaConfigRC.lspconfig = entryAfter ["lsp-setup"] ''
|
pluginRC.lspconfig = entryAfter ["lsp-setup"] ''
|
||||||
local lspconfig = require('lspconfig')
|
local lspconfig = require('lspconfig')
|
||||||
|
|
||||||
${
|
${
|
||||||
optionalString config.vim.ui.borders.enable ''
|
optionalString config.vim.ui.borders.enable ''
|
||||||
require('lspconfig.ui.windows').default_options.border = '${config.vim.ui.borders.globalStyle}'
|
require('lspconfig.ui.windows').default_options.border = ${toLuaObject config.vim.ui.borders.globalStyle}
|
||||||
''
|
''
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
vim.luaConfigRC = mapAttrs (_: v: (entryAfter ["lspconfig"] v)) cfg.lspconfig.sources;
|
vim.pluginRC = mapAttrs (_: v: (entryAfter ["lspconfig"] v)) cfg.lspconfig.sources;
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable && cfg.lspkind.enable) {
|
config = mkIf (cfg.enable && cfg.lspkind.enable) {
|
||||||
vim.startPlugins = ["lspkind"];
|
vim.startPlugins = ["lspkind"];
|
||||||
vim.luaConfigRC.lspkind = entryAnywhere ''
|
vim.pluginRC.lspkind = entryAnywhere ''
|
||||||
local lspkind = require'lspkind'
|
local lspkind = require'lspkind'
|
||||||
local lspkind_opts = {
|
local lspkind_opts = {
|
||||||
mode = '${cfg.lspkind.mode}'
|
mode = '${cfg.lspkind.mode}'
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable && cfg.lsplines.enable) {
|
config = mkIf (cfg.enable && cfg.lsplines.enable) {
|
||||||
vim.startPlugins = ["lsp-lines"];
|
vim.startPlugins = ["lsp-lines"];
|
||||||
vim.luaConfigRC.lsplines = entryAfter ["lspconfig"] ''
|
vim.pluginRC.lsplines = entryAfter ["lspconfig"] ''
|
||||||
require("lsp_lines").setup()
|
require("lsp_lines").setup()
|
||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue