mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-07 18:25:57 +01:00
Merge b397dcb430
into eb76f5fbd5
This commit is contained in:
commit
05b3a868a4
414 changed files with 12985 additions and 8860 deletions
177
.github/README.md
vendored
177
.github/README.md
vendored
|
@ -1,41 +1,40 @@
|
|||
<div align="center">
|
||||
<img src="../assets/neovim-flake-logo-work.svg" alt="neovim-flake Logo" width="200">
|
||||
<img src=".github/assets/nvf-logo-work.svg" alt="nvf Logo" width="200">
|
||||
</div>
|
||||
|
||||
<h1 align="center">❄️ neovim-flake</h1>
|
||||
|
||||
<div align="center">
|
||||
<a>
|
||||
A highly modular, configurable, extensible and easy to use Neovim configuration wrapper written in Nix. Designed for flexibility and ease of use and with code quality in mind.
|
||||
</a>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<h1 align="center">❄️ nvf</h1>
|
||||
<div align="center">
|
||||
<p>
|
||||
<a href="https://github.com/NotAShelf/neovim-flake/releases/latest">
|
||||
<img alt="Latest release" src="https://img.shields.io/github/v/release/NotAShelf/neovim-flake?style=for-the-badge&logo=nixos&color=C9CBFF&logoColor=D9E0EE&labelColor=302D41" />
|
||||
<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" />
|
||||
</a>
|
||||
<a href="https://github.com/NotAShelf/neovim-flake/pulse">
|
||||
<img alt="Last commit" src="https://img.shields.io/github/last-commit/NotAShelf/neovim-flake?style=for-the-badge&logo=starship&color=8bd5ca&logoColor=D9E0EE&labelColor=302D41"/>
|
||||
<a href="https://github.com/NotAShelf/nvf/pulse">
|
||||
<img alt="Last commit" src="https://img.shields.io/github/last-commit/NotAShelf/nvf?style=for-the-badge&logo=starship&color=8bd5ca&logoColor=D9E0EE&labelColor=302D41"/>
|
||||
</a>
|
||||
<a href="https://github.com/NotAShelf/neovim-flake/blob/main/LICENSE">
|
||||
<img alt="License" src="https://img.shields.io/github/license/NotAShelf/neovim-flake?style=for-the-badge&logo=nixos&color=ee999f&logoColor=D9E0EE&labelColor=302D41" />
|
||||
<a href="https://github.com/NotAShelf/nvf/blob/main/LICENSE">
|
||||
<img alt="License" src="https://img.shields.io/github/license/NotAShelf/nvf?style=for-the-badge&logo=nixos&color=ee999f&logoColor=D9E0EE&labelColor=302D41" />
|
||||
</a>
|
||||
<a href="https://github.com/NotAShelf/neovim-flake/stargazers">
|
||||
<img alt="Stars" src="https://img.shields.io/github/stars/NotAShelf/neovim-flake?style=for-the-badge&logo=nixos&color=c69ff5&logoColor=D9E0EE&labelColor=302D41" />
|
||||
<a href="https://github.com/NotAShelf/nvf/stargazers">
|
||||
<img alt="Stars" src="https://img.shields.io/github/stars/NotAShelf/nvf?style=for-the-badge&logo=nixos&color=c69ff5&logoColor=D9E0EE&labelColor=302D41" />
|
||||
</a>
|
||||
<a href="https://github.com/NotAShelf/neovim-flake/issues">
|
||||
<img alt="Issues" src="https://img.shields.io/github/issues/NotAShelf/neovim-flake?style=for-the-badge&logo=bilibili&color=F5E0DC&logoColor=D9E0EE&labelColor=302D41" />
|
||||
<a href="https://github.com/NotAShelf/nvf/issues">
|
||||
<img alt="Issues" src="https://img.shields.io/github/issues/NotAShelf/nvf?style=for-the-badge&logo=bilibili&color=F5E0DC&logoColor=D9E0EE&labelColor=302D41" />
|
||||
</a>
|
||||
<a href="https://github.com/NotAShelf/neovim-flake">
|
||||
<img alt="Repo Size" src="https://img.shields.io/github/repo-size/NotAShelf/neovim-flake?color=%23DDB6F2&label=SIZE&logo=codesandbox&style=for-the-badge&logoColor=D9E0EE&labelColor=302D41" />
|
||||
<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" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://stars.medv.io/NotAShelf/neovim-flake.svg", title="stars"/>
|
||||
<img src="https://stars.medv.io/NotAShelf/nvf.svg", title="stars"/>
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
<a>
|
||||
A highly modular, configurable, extensible and easy to use Neovim configuration
|
||||
framework in Nix. Designed for flexibility and ease of use, this flake
|
||||
allows you to easily configure your Neovim instance with a few lines of
|
||||
Nix code.
|
||||
</a>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
|
@ -72,109 +71,81 @@
|
|||
|
||||
### Using `nix` CLI
|
||||
|
||||
If you would like to try out the configuration before even thinking about installing it, you can run the following command
|
||||
If you would like to try out the configuration before even thinking about
|
||||
installing it, you can run the following command
|
||||
|
||||
```console
|
||||
nix run github:notashelf/neovim-flake
|
||||
nix run github:notashelf/nvf
|
||||
```
|
||||
|
||||
This will get you a feel for the base configuration and UI design. The flake exposes `#nix` as the default package, providing minimal language support and various
|
||||
utilities.You may also use `#nix`, `#tidal` or `#maximal` to get try out different configurations.
|
||||
This will get you a feel for the base configuration and UI design.
|
||||
The flake exposes `#nix` as the default package, providing minimal
|
||||
language support and various utilities.You may also use `#nix`,
|
||||
`#tidal` or `#maximal` to get try out different configurations.
|
||||
|
||||
It is as simple as changing the target output to get a different configuration. For example, to get a configuration with `tidal` support, run:
|
||||
It is as simple as changing the target output to get a different
|
||||
configuration. For example, to get a configuration with `tidal` support, run:
|
||||
|
||||
```console
|
||||
nix run github:notashelf/neovim-flake#tidal
|
||||
nix run github:notashelf/nvf#tidal
|
||||
```
|
||||
|
||||
Similar instructions will apply for `nix profile install`. However, you are recommended to instead use the module system as described in the manual.
|
||||
Similar instructions will apply for `nix profile install`. However, you are
|
||||
recommended to instead use the module system as described in the manual.
|
||||
|
||||
> [!NOTE]
|
||||
> The `maximal` configuration is _massive_ and will take a while to build.
|
||||
> To get a feel for the configuration, use the default `nix` or `tidal` configurations.
|
||||
> Should you choose to try out the `maximal` configuration, using the binary cache as described
|
||||
> in the manual is _strongly_ recommended.
|
||||
|
||||
### Docker
|
||||
|
||||
As of version 0.5, an image for the `nix` output is published to Dockerhub and GitHub packages with each tagged release. If you do not have Docker installed
|
||||
on your system, you may run neovim within a container using your favorite tool. You are still recommended to use `nix` instead of Docker.
|
||||
|
||||
The following command will open the current directory in neovim with necessary tools bootstrapped.
|
||||
|
||||
```console
|
||||
docker run -v `pwd`:/home/neovim/demo --rm -it notashelf/neovim-flake:latest
|
||||
```
|
||||
|
||||
The available registeres are `ghcr.io` and `dockerhub` for the time being. Adjust to your liking.
|
||||
> To get a feel for the configuration, use the default `nix` or `tidal`
|
||||
> configurations. Should you choose to try out the `maximal` configuration,
|
||||
> using the binary cache as described in the manual is _strongly_ recommended.
|
||||
|
||||
## Documentation
|
||||
|
||||
See the [neovim-flake Manual](https://notashelf.github.io/neovim-flake/) for detailed installation guides, configurations, available options, release notes
|
||||
and more.
|
||||
See the [**nvf** Manual](https://notashelf.github.io/nvf/) for
|
||||
detailed installation guides, configurations, available options, release notes
|
||||
and more. Tips for installing userspace plugins is also contained in the
|
||||
documentation.
|
||||
|
||||
If you want to dive right into trying **neovim-flake** you can get a fully featured configuration with `nix`
|
||||
language support by running:
|
||||
If you want to dive right into trying **nvf** you can get a fully
|
||||
featured configuration with `nix` language support by running:
|
||||
|
||||
```console
|
||||
nix run github:notashelf/neovim-flake
|
||||
nix run github:notashelf/nvf#nix
|
||||
```
|
||||
|
||||
Please create an issue on the [issue tracker](../../../issues) if you find the documentation lacking or confusing.
|
||||
I also appreciate any contributions to the documentation.
|
||||
Please create an issue on the [issue tracker](../../../issues) if you find
|
||||
the documentation lacking or confusing. I also appreciate any contributions
|
||||
to the documentation.
|
||||
|
||||
## Help
|
||||
|
||||
You can create an issue on the [issue tracker](../../../issues) to ask questions or report bugs.
|
||||
I am not yet on spaces like matrix or IRC, so please use the issue tracker for now.
|
||||
You can create an issue on the [issue tracker](../../../issues) to ask questions
|
||||
or report bugs. I am not yet on spaces like matrix or IRC, so please use the issue
|
||||
tracker for now.
|
||||
|
||||
## Contributing
|
||||
|
||||
I am always looking for new ways to help improve this flake. If you would like to contribute, please read
|
||||
the [contributing guide](CONTRIBUTING.md) before submitting a pull request. You can also create an
|
||||
issue on the [issue tracker](../../../issues) before submitting a pull request if you would like to discuss
|
||||
a feature or bug fix.
|
||||
|
||||
## Philosophy
|
||||
|
||||
The philosophy behind this flake configuration is to create an easily configurable and reproducible Neovim environment.
|
||||
While it does sacrifice in size (which I know some users will find _disagreeable_), it offers a lot of flexibility and customizability in
|
||||
exchange for the large size of the flake inputs. The "KISS" (Keep it simple, stupid) principle has mostly been abandoned here, however, you _can_
|
||||
ultimately leverage the flexibility of this flake to declare a configuration that follows KISS principles, as it is very easy to bring your
|
||||
own plugins and configurations from non-nix. What this flake is meant to be does eventually fall into your hands. Whether you are a
|
||||
developer, writer, or live coder, you can quickly craft a config that suits every project's need. Think of it like a distribution of Neovim that you have
|
||||
full control over. A distribution that takes advantage of pinning vim plugins and third party dependencies (such as tree-sitter grammars, language servers, and more).
|
||||
|
||||
One should never get a broken config when setting options. If setting multiple options results in a broken Neovim, file an issue!
|
||||
Each plugin knows when another plugin which allows for smart configuration of keybindings and automatic setup of things
|
||||
like completion sources and languages.
|
||||
I am always looking for new ways to help improve this flake. If you would like
|
||||
to contribute, please read the [contributing guide](CONTRIBUTING.md) before
|
||||
submitting a pull request. You can also create an issue on the
|
||||
[issue tracker](../../../issues) before submitting a pull request if you would
|
||||
like to discuss a feature or bug fix.
|
||||
|
||||
## FAQ
|
||||
|
||||
**Q**: Why is this flake so big?
|
||||
<br/>
|
||||
**A**: I have sacrificed in size in order to provide a highly configurable and reproducible Neovim environment. A binary cache is provided to
|
||||
eleminate the need to build the flake from source, but it is still a large flake. If you do not need all the features, you can use the default `nix` output
|
||||
instead of the `maximal` output. This will reduce size by a lot, but you will lose some language specific features.
|
||||
<br/><br/>
|
||||
|
||||
**Q**: Will you try to make this flake smaller?
|
||||
<br/>
|
||||
**A**: Yes. As a matter of fact, I am actively working on making this flake smaller. Unfortunately the process of providing everything
|
||||
possible by itself makes the flake large. Best I can do is to optimize the flake as much as possible by selecting plugins that
|
||||
are small and fast. And the binary cache, so at least you don't have to build it from source.
|
||||
<br/><br/>
|
||||
|
||||
**Q**: Will you use a plugin manager/language server installer?
|
||||
<br/>
|
||||
**A**: No. If you feel the need to ask that question, then you have missed the whole point of using nix and ultimately this flake.
|
||||
The whole reason we use nix is to be able to handle EVERYTHING declaratively, well including the LSP and plugin installations.
|
||||
<br/><br/>
|
||||
|
||||
**Q**: Can you add _X_?
|
||||
<br/>
|
||||
**A**: Maybe. Open an issue using the appropriate template and I will consider it. I do not intend to
|
||||
add _every plugin that is in existence_, but I will consider it, should it offer something useful to the flake.
|
||||
**A**: Maybe! 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 **nvf**. Use the [appropritate issue
|
||||
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?
|
||||
<br/>
|
||||
**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.
|
||||
|
||||
## Credits
|
||||
|
||||
|
@ -186,23 +157,31 @@ Special thanks to
|
|||
- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to work
|
||||
- [@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 neovim-flake logo
|
||||
- [@Yavko](https://github.com/Yavko) - For the amazing **nvf** logo
|
||||
- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I could not
|
||||
|
||||
and everyone who has submitted issues or pull requests!
|
||||
|
||||
### Inspiration
|
||||
|
||||
This configuration borrows from and is based on a few other configurations, including:
|
||||
This configuration borrows from and is based on a few other configurations,
|
||||
including:
|
||||
|
||||
- [@jordanisaacs's](https://github.com/jordanisaacs) [neovim-flake](https://github.com/jordanisaacs/neovim-flake) that this flake is originally based on.
|
||||
- [@sioodmy's](https://github.com/sioodmy) [dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design choices.
|
||||
- [@wiltaylor's](https://github.com/wiltaylor) [neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and design ideas.
|
||||
- [@gvolpe's](https://github.com/gvolpe) [neovim-flake](https://github.com/gvolpe/neovim-flake) for plugin, design and nix concepts.
|
||||
|
||||
I am grateful for their previous work and inspiration, and I wholeheartedly recommend checking their work out.
|
||||
I am grateful for their previous work and inspiration, and I wholeheartedly
|
||||
recommend checking their work out.
|
||||
<br/>
|
||||
|
||||
## License
|
||||
|
||||
Following the [original neovim-flake](https://github.com/jordanisaacs/neovim-flake)
|
||||
**nvf** has been made available under the **MIT License**. However, all assets
|
||||
are published under the [CC BY License].
|
||||
|
||||
---
|
||||
|
||||
<div align="right">
|
||||
|
|
395
.github/assets/LICENSE
vendored
Normal file
395
.github/assets/LICENSE
vendored
Normal file
|
@ -0,0 +1,395 @@
|
|||
Attribution 4.0 International
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
||||
does not provide legal services or legal advice. Distribution of
|
||||
Creative Commons public licenses does not create a lawyer-client or
|
||||
other relationship. Creative Commons makes its licenses and related
|
||||
information available on an "as-is" basis. Creative Commons gives no
|
||||
warranties regarding its licenses, any material licensed under their
|
||||
terms and conditions, or any related information. Creative Commons
|
||||
disclaims all liability for damages resulting from their use to the
|
||||
fullest extent possible.
|
||||
|
||||
Using Creative Commons Public Licenses
|
||||
|
||||
Creative Commons public licenses provide a standard set of terms and
|
||||
conditions that creators and other rights holders may use to share
|
||||
original works of authorship and other material subject to copyright
|
||||
and certain other rights specified in the public license below. The
|
||||
following considerations are for informational purposes only, are not
|
||||
exhaustive, and do not form part of our licenses.
|
||||
|
||||
Considerations for licensors: Our public licenses are
|
||||
intended for use by those authorized to give the public
|
||||
permission to use material in ways otherwise restricted by
|
||||
copyright and certain other rights. Our licenses are
|
||||
irrevocable. Licensors should read and understand the terms
|
||||
and conditions of the license they choose before applying it.
|
||||
Licensors should also secure all rights necessary before
|
||||
applying our licenses so that the public can reuse the
|
||||
material as expected. Licensors should clearly mark any
|
||||
material not subject to the license. This includes other CC-
|
||||
licensed material, or material used under an exception or
|
||||
limitation to copyright. More considerations for licensors:
|
||||
wiki.creativecommons.org/Considerations_for_licensors
|
||||
|
||||
Considerations for the public: By using one of our public
|
||||
licenses, a licensor grants the public permission to use the
|
||||
licensed material under specified terms and conditions. If
|
||||
the licensor's permission is not necessary for any reason--for
|
||||
example, because of any applicable exception or limitation to
|
||||
copyright--then that use is not regulated by the license. Our
|
||||
licenses grant only permissions under copyright and certain
|
||||
other rights that a licensor has authority to grant. Use of
|
||||
the licensed material may still be restricted for other
|
||||
reasons, including because others have copyright or other
|
||||
rights in the material. A licensor may make special requests,
|
||||
such as asking that all changes be marked or described.
|
||||
Although not required by our licenses, you are encouraged to
|
||||
respect those requests where reasonable. More considerations
|
||||
for the public:
|
||||
wiki.creativecommons.org/Considerations_for_licensees
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons Attribution 4.0 International Public License
|
||||
|
||||
By exercising the Licensed Rights (defined below), You accept and agree
|
||||
to be bound by the terms and conditions of this Creative Commons
|
||||
Attribution 4.0 International Public License ("Public License"). To the
|
||||
extent this Public License may be interpreted as a contract, You are
|
||||
granted the Licensed Rights in consideration of Your acceptance of
|
||||
these terms and conditions, and the Licensor grants You such rights in
|
||||
consideration of benefits the Licensor receives from making the
|
||||
Licensed Material available under these terms and conditions.
|
||||
|
||||
|
||||
Section 1 -- Definitions.
|
||||
|
||||
a. Adapted Material means material subject to Copyright and Similar
|
||||
Rights that is derived from or based upon the Licensed Material
|
||||
and in which the Licensed Material is translated, altered,
|
||||
arranged, transformed, or otherwise modified in a manner requiring
|
||||
permission under the Copyright and Similar Rights held by the
|
||||
Licensor. For purposes of this Public License, where the Licensed
|
||||
Material is a musical work, performance, or sound recording,
|
||||
Adapted Material is always produced where the Licensed Material is
|
||||
synched in timed relation with a moving image.
|
||||
|
||||
b. Adapter's License means the license You apply to Your Copyright
|
||||
and Similar Rights in Your contributions to Adapted Material in
|
||||
accordance with the terms and conditions of this Public License.
|
||||
|
||||
c. Copyright and Similar Rights means copyright and/or similar rights
|
||||
closely related to copyright including, without limitation,
|
||||
performance, broadcast, sound recording, and Sui Generis Database
|
||||
Rights, without regard to how the rights are labeled or
|
||||
categorized. For purposes of this Public License, the rights
|
||||
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
||||
Rights.
|
||||
|
||||
d. Effective Technological Measures means those measures that, in the
|
||||
absence of proper authority, may not be circumvented under laws
|
||||
fulfilling obligations under Article 11 of the WIPO Copyright
|
||||
Treaty adopted on December 20, 1996, and/or similar international
|
||||
agreements.
|
||||
|
||||
e. Exceptions and Limitations means fair use, fair dealing, and/or
|
||||
any other exception or limitation to Copyright and Similar Rights
|
||||
that applies to Your use of the Licensed Material.
|
||||
|
||||
f. Licensed Material means the artistic or literary work, database,
|
||||
or other material to which the Licensor applied this Public
|
||||
License.
|
||||
|
||||
g. Licensed Rights means the rights granted to You subject to the
|
||||
terms and conditions of this Public License, which are limited to
|
||||
all Copyright and Similar Rights that apply to Your use of the
|
||||
Licensed Material and that the Licensor has authority to license.
|
||||
|
||||
h. Licensor means the individual(s) or entity(ies) granting rights
|
||||
under this Public License.
|
||||
|
||||
i. Share means to provide material to the public by any means or
|
||||
process that requires permission under the Licensed Rights, such
|
||||
as reproduction, public display, public performance, distribution,
|
||||
dissemination, communication, or importation, and to make material
|
||||
available to the public including in ways that members of the
|
||||
public may access the material from a place and at a time
|
||||
individually chosen by them.
|
||||
|
||||
j. Sui Generis Database Rights means rights other than copyright
|
||||
resulting from Directive 96/9/EC of the European Parliament and of
|
||||
the Council of 11 March 1996 on the legal protection of databases,
|
||||
as amended and/or succeeded, as well as other essentially
|
||||
equivalent rights anywhere in the world.
|
||||
|
||||
k. You means the individual or entity exercising the Licensed Rights
|
||||
under this Public License. Your has a corresponding meaning.
|
||||
|
||||
|
||||
Section 2 -- Scope.
|
||||
|
||||
a. License grant.
|
||||
|
||||
1. Subject to the terms and conditions of this Public License,
|
||||
the Licensor hereby grants You a worldwide, royalty-free,
|
||||
non-sublicensable, non-exclusive, irrevocable license to
|
||||
exercise the Licensed Rights in the Licensed Material to:
|
||||
|
||||
a. reproduce and Share the Licensed Material, in whole or
|
||||
in part; and
|
||||
|
||||
b. produce, reproduce, and Share Adapted Material.
|
||||
|
||||
2. Exceptions and Limitations. For the avoidance of doubt, where
|
||||
Exceptions and Limitations apply to Your use, this Public
|
||||
License does not apply, and You do not need to comply with
|
||||
its terms and conditions.
|
||||
|
||||
3. Term. The term of this Public License is specified in Section
|
||||
6(a).
|
||||
|
||||
4. Media and formats; technical modifications allowed. The
|
||||
Licensor authorizes You to exercise the Licensed Rights in
|
||||
all media and formats whether now known or hereafter created,
|
||||
and to make technical modifications necessary to do so. The
|
||||
Licensor waives and/or agrees not to assert any right or
|
||||
authority to forbid You from making technical modifications
|
||||
necessary to exercise the Licensed Rights, including
|
||||
technical modifications necessary to circumvent Effective
|
||||
Technological Measures. For purposes of this Public License,
|
||||
simply making modifications authorized by this Section 2(a)
|
||||
(4) never produces Adapted Material.
|
||||
|
||||
5. Downstream recipients.
|
||||
|
||||
a. Offer from the Licensor -- Licensed Material. Every
|
||||
recipient of the Licensed Material automatically
|
||||
receives an offer from the Licensor to exercise the
|
||||
Licensed Rights under the terms and conditions of this
|
||||
Public License.
|
||||
|
||||
b. No downstream restrictions. You may not offer or impose
|
||||
any additional or different terms or conditions on, or
|
||||
apply any Effective Technological Measures to, the
|
||||
Licensed Material if doing so restricts exercise of the
|
||||
Licensed Rights by any recipient of the Licensed
|
||||
Material.
|
||||
|
||||
6. No endorsement. Nothing in this Public License constitutes or
|
||||
may be construed as permission to assert or imply that You
|
||||
are, or that Your use of the Licensed Material is, connected
|
||||
with, or sponsored, endorsed, or granted official status by,
|
||||
the Licensor or others designated to receive attribution as
|
||||
provided in Section 3(a)(1)(A)(i).
|
||||
|
||||
b. Other rights.
|
||||
|
||||
1. Moral rights, such as the right of integrity, are not
|
||||
licensed under this Public License, nor are publicity,
|
||||
privacy, and/or other similar personality rights; however, to
|
||||
the extent possible, the Licensor waives and/or agrees not to
|
||||
assert any such rights held by the Licensor to the limited
|
||||
extent necessary to allow You to exercise the Licensed
|
||||
Rights, but not otherwise.
|
||||
|
||||
2. Patent and trademark rights are not licensed under this
|
||||
Public License.
|
||||
|
||||
3. To the extent possible, the Licensor waives any right to
|
||||
collect royalties from You for the exercise of the Licensed
|
||||
Rights, whether directly or through a collecting society
|
||||
under any voluntary or waivable statutory or compulsory
|
||||
licensing scheme. In all other cases the Licensor expressly
|
||||
reserves any right to collect such royalties.
|
||||
|
||||
|
||||
Section 3 -- License Conditions.
|
||||
|
||||
Your exercise of the Licensed Rights is expressly made subject to the
|
||||
following conditions.
|
||||
|
||||
a. Attribution.
|
||||
|
||||
1. If You Share the Licensed Material (including in modified
|
||||
form), You must:
|
||||
|
||||
a. retain the following if it is supplied by the Licensor
|
||||
with the Licensed Material:
|
||||
|
||||
i. identification of the creator(s) of the Licensed
|
||||
Material and any others designated to receive
|
||||
attribution, in any reasonable manner requested by
|
||||
the Licensor (including by pseudonym if
|
||||
designated);
|
||||
|
||||
ii. a copyright notice;
|
||||
|
||||
iii. a notice that refers to this Public License;
|
||||
|
||||
iv. a notice that refers to the disclaimer of
|
||||
warranties;
|
||||
|
||||
v. a URI or hyperlink to the Licensed Material to the
|
||||
extent reasonably practicable;
|
||||
|
||||
b. indicate if You modified the Licensed Material and
|
||||
retain an indication of any previous modifications; and
|
||||
|
||||
c. indicate the Licensed Material is licensed under this
|
||||
Public License, and include the text of, or the URI or
|
||||
hyperlink to, this Public License.
|
||||
|
||||
2. You may satisfy the conditions in Section 3(a)(1) in any
|
||||
reasonable manner based on the medium, means, and context in
|
||||
which You Share the Licensed Material. For example, it may be
|
||||
reasonable to satisfy the conditions by providing a URI or
|
||||
hyperlink to a resource that includes the required
|
||||
information.
|
||||
|
||||
3. If requested by the Licensor, You must remove any of the
|
||||
information required by Section 3(a)(1)(A) to the extent
|
||||
reasonably practicable.
|
||||
|
||||
4. If You Share Adapted Material You produce, the Adapter's
|
||||
License You apply must not prevent recipients of the Adapted
|
||||
Material from complying with this Public License.
|
||||
|
||||
|
||||
Section 4 -- Sui Generis Database Rights.
|
||||
|
||||
Where the Licensed Rights include Sui Generis Database Rights that
|
||||
apply to Your use of the Licensed Material:
|
||||
|
||||
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
||||
to extract, reuse, reproduce, and Share all or a substantial
|
||||
portion of the contents of the database;
|
||||
|
||||
b. if You include all or a substantial portion of the database
|
||||
contents in a database in which You have Sui Generis Database
|
||||
Rights, then the database in which You have Sui Generis Database
|
||||
Rights (but not its individual contents) is Adapted Material; and
|
||||
|
||||
c. You must comply with the conditions in Section 3(a) if You Share
|
||||
all or a substantial portion of the contents of the database.
|
||||
|
||||
For the avoidance of doubt, this Section 4 supplements and does not
|
||||
replace Your obligations under this Public License where the Licensed
|
||||
Rights include other Copyright and Similar Rights.
|
||||
|
||||
|
||||
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
||||
|
||||
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
||||
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
||||
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
||||
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
||||
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
||||
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
||||
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
||||
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
||||
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
||||
|
||||
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
||||
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
||||
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
||||
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
||||
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
||||
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
||||
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
||||
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
||||
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
||||
|
||||
c. The disclaimer of warranties and limitation of liability provided
|
||||
above shall be interpreted in a manner that, to the extent
|
||||
possible, most closely approximates an absolute disclaimer and
|
||||
waiver of all liability.
|
||||
|
||||
|
||||
Section 6 -- Term and Termination.
|
||||
|
||||
a. This Public License applies for the term of the Copyright and
|
||||
Similar Rights licensed here. However, if You fail to comply with
|
||||
this Public License, then Your rights under this Public License
|
||||
terminate automatically.
|
||||
|
||||
b. Where Your right to use the Licensed Material has terminated under
|
||||
Section 6(a), it reinstates:
|
||||
|
||||
1. automatically as of the date the violation is cured, provided
|
||||
it is cured within 30 days of Your discovery of the
|
||||
violation; or
|
||||
|
||||
2. upon express reinstatement by the Licensor.
|
||||
|
||||
For the avoidance of doubt, this Section 6(b) does not affect any
|
||||
right the Licensor may have to seek remedies for Your violations
|
||||
of this Public License.
|
||||
|
||||
c. For the avoidance of doubt, the Licensor may also offer the
|
||||
Licensed Material under separate terms or conditions or stop
|
||||
distributing the Licensed Material at any time; however, doing so
|
||||
will not terminate this Public License.
|
||||
|
||||
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
||||
License.
|
||||
|
||||
|
||||
Section 7 -- Other Terms and Conditions.
|
||||
|
||||
a. The Licensor shall not be bound by any additional or different
|
||||
terms or conditions communicated by You unless expressly agreed.
|
||||
|
||||
b. Any arrangements, understandings, or agreements regarding the
|
||||
Licensed Material not stated herein are separate from and
|
||||
independent of the terms and conditions of this Public License.
|
||||
|
||||
|
||||
Section 8 -- Interpretation.
|
||||
|
||||
a. For the avoidance of doubt, this Public License does not, and
|
||||
shall not be interpreted to, reduce, limit, restrict, or impose
|
||||
conditions on any use of the Licensed Material that could lawfully
|
||||
be made without permission under this Public License.
|
||||
|
||||
b. To the extent possible, if any provision of this Public License is
|
||||
deemed unenforceable, it shall be automatically reformed to the
|
||||
minimum extent necessary to make it enforceable. If the provision
|
||||
cannot be reformed, it shall be severed from this Public License
|
||||
without affecting the enforceability of the remaining terms and
|
||||
conditions.
|
||||
|
||||
c. No term or condition of this Public License will be waived and no
|
||||
failure to comply consented to unless expressly agreed to by the
|
||||
Licensor.
|
||||
|
||||
d. Nothing in this Public License constitutes or may be interpreted
|
||||
as a limitation upon, or waiver of, any privileges and immunities
|
||||
that apply to the Licensor or You, including from the legal
|
||||
processes of any jurisdiction or authority.
|
||||
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons is not a party to its public licenses.
|
||||
Notwithstanding, Creative Commons may elect to apply one of its public
|
||||
licenses to material it publishes and in those instances will be
|
||||
considered the “Licensor.” The text of the Creative Commons public
|
||||
licenses is dedicated to the public domain under the CC0 Public Domain
|
||||
Dedication. Except for the limited purpose of indicating that material
|
||||
is shared under a Creative Commons public license or as otherwise
|
||||
permitted by the Creative Commons policies published at
|
||||
creativecommons.org/policies, Creative Commons does not authorize the
|
||||
use of the trademark "Creative Commons" or any other trademark or logo
|
||||
of Creative Commons without its prior written consent including,
|
||||
without limitation, in connection with any unauthorized modifications
|
||||
to any of its public licenses or any other arrangements,
|
||||
understandings, or agreements concerning use of licensed material. For
|
||||
the avoidance of doubt, this paragraph does not form part of the public
|
||||
licenses.
|
||||
|
||||
Creative Commons may be contacted at creativecommons.org.
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 NotAShelf
|
||||
Copyright (c) 2023-2024 NotAShelf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -7,9 +7,11 @@ inputs: let
|
|||
lib ? pkgs.lib,
|
||||
check ? true,
|
||||
extraSpecialArgs ? {},
|
||||
extraModules ? [],
|
||||
...
|
||||
}:
|
||||
modulesWithInputs {
|
||||
inherit pkgs lib check extraSpecialArgs;
|
||||
inherit pkgs lib check extraSpecialArgs extraModules;
|
||||
configuration.imports = modules;
|
||||
};
|
||||
|
||||
|
@ -18,18 +20,21 @@ inputs: let
|
|||
};
|
||||
|
||||
mainConfig = isMaximal: {
|
||||
config = {
|
||||
vim = {
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
debugMode = {
|
||||
enable = false;
|
||||
level = 20;
|
||||
logFile = "/tmp/nvim.log";
|
||||
};
|
||||
config.vim = {
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
debugMode = {
|
||||
enable = false;
|
||||
level = 16;
|
||||
logFile = "/tmp/nvim.log";
|
||||
};
|
||||
|
||||
vim.lsp = {
|
||||
spellcheck = {
|
||||
enable = isMaximal;
|
||||
programmingWordlist.enable = isMaximal;
|
||||
};
|
||||
|
||||
lsp = {
|
||||
formatOnSave = true;
|
||||
lspkind.enable = false;
|
||||
lightbulb.enable = true;
|
||||
|
@ -41,14 +46,14 @@ inputs: let
|
|||
nvim-docs-view.enable = isMaximal;
|
||||
};
|
||||
|
||||
vim.debugger = {
|
||||
debugger = {
|
||||
nvim-dap = {
|
||||
enable = true;
|
||||
ui.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
vim.languages = {
|
||||
languages = {
|
||||
enableLSP = true;
|
||||
enableFormat = true;
|
||||
enableTreesitter = true;
|
||||
|
@ -81,7 +86,7 @@ inputs: let
|
|||
};
|
||||
};
|
||||
|
||||
vim.visuals = {
|
||||
visuals = {
|
||||
enable = true;
|
||||
nvimWebDevicons.enable = true;
|
||||
scrollBar.enable = true;
|
||||
|
@ -105,70 +110,71 @@ inputs: let
|
|||
};
|
||||
};
|
||||
|
||||
vim.statusline = {
|
||||
statusline = {
|
||||
lualine = {
|
||||
enable = true;
|
||||
theme = "catppuccin";
|
||||
};
|
||||
};
|
||||
|
||||
vim.theme = {
|
||||
theme = {
|
||||
enable = true;
|
||||
name = "catppuccin";
|
||||
style = "mocha";
|
||||
transparent = false;
|
||||
};
|
||||
vim.autopairs.enable = true;
|
||||
|
||||
vim.autocomplete = {
|
||||
autopairs.enable = true;
|
||||
|
||||
autocomplete = {
|
||||
enable = true;
|
||||
type = "nvim-cmp";
|
||||
};
|
||||
|
||||
vim.filetree = {
|
||||
filetree = {
|
||||
nvimTree = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
vim.tabline = {
|
||||
tabline = {
|
||||
nvimBufferline.enable = true;
|
||||
};
|
||||
|
||||
vim.treesitter.context.enable = true;
|
||||
treesitter.context.enable = true;
|
||||
|
||||
vim.binds = {
|
||||
binds = {
|
||||
whichKey.enable = true;
|
||||
cheatsheet.enable = true;
|
||||
};
|
||||
|
||||
vim.telescope.enable = true;
|
||||
telescope.enable = true;
|
||||
|
||||
vim.git = {
|
||||
git = {
|
||||
enable = true;
|
||||
gitsigns.enable = true;
|
||||
gitsigns.codeActions = false; # throws an annoying debug message
|
||||
gitsigns.codeActions.enable = false; # throws an annoying debug message
|
||||
};
|
||||
|
||||
vim.minimap = {
|
||||
minimap = {
|
||||
minimap-vim.enable = false;
|
||||
codewindow.enable = isMaximal; # lighter, faster, and uses lua for configuration
|
||||
};
|
||||
|
||||
vim.dashboard = {
|
||||
dashboard = {
|
||||
dashboard-nvim.enable = false;
|
||||
alpha.enable = isMaximal;
|
||||
};
|
||||
|
||||
vim.notify = {
|
||||
notify = {
|
||||
nvim-notify.enable = true;
|
||||
};
|
||||
|
||||
vim.projects = {
|
||||
projects = {
|
||||
project-nvim.enable = isMaximal;
|
||||
};
|
||||
|
||||
vim.utility = {
|
||||
utility = {
|
||||
ccc.enable = isMaximal;
|
||||
vim-wakatime.enable = isMaximal;
|
||||
icon-picker.enable = isMaximal;
|
||||
|
@ -178,23 +184,27 @@ inputs: let
|
|||
hop.enable = true;
|
||||
leap.enable = true;
|
||||
};
|
||||
|
||||
images = {
|
||||
image-nvim.enable = false;
|
||||
};
|
||||
};
|
||||
|
||||
vim.notes = {
|
||||
obsidian.enable = false; # FIXME neovim fails to build if obsidian is enabled
|
||||
notes = {
|
||||
obsidian.enable = false; # FIXME: neovim fails to build if obsidian is enabled
|
||||
orgmode.enable = false;
|
||||
mind-nvim.enable = isMaximal;
|
||||
todo-comments.enable = true;
|
||||
};
|
||||
|
||||
vim.terminal = {
|
||||
terminal = {
|
||||
toggleterm = {
|
||||
enable = true;
|
||||
lazygit.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
vim.ui = {
|
||||
ui = {
|
||||
borders.enable = true;
|
||||
noice.enable = true;
|
||||
colorizer.enable = true;
|
||||
|
@ -206,7 +216,7 @@ inputs: let
|
|||
};
|
||||
smartcolumn = {
|
||||
enable = true;
|
||||
columnAt.languages = {
|
||||
setupOpts.custom_colorcolumn = {
|
||||
# this is a freeform module, it's `buftype = int;` for configuring column position
|
||||
nix = 110;
|
||||
ruby = 120;
|
||||
|
@ -216,26 +226,27 @@ inputs: let
|
|||
};
|
||||
};
|
||||
|
||||
vim.assistant = {
|
||||
assistant = {
|
||||
chatgpt.enable = false;
|
||||
copilot = {
|
||||
enable = isMaximal;
|
||||
enable = false;
|
||||
cmp.enable = isMaximal;
|
||||
};
|
||||
};
|
||||
|
||||
vim.session = {
|
||||
session = {
|
||||
nvim-session-manager.enable = false;
|
||||
};
|
||||
|
||||
vim.gestures = {
|
||||
gestures = {
|
||||
gesture-nvim.enable = false;
|
||||
};
|
||||
|
||||
vim.comments = {
|
||||
comments = {
|
||||
comment-nvim.enable = true;
|
||||
};
|
||||
|
||||
vim.presence = {
|
||||
presence = {
|
||||
neocord.enable = true;
|
||||
};
|
||||
};
|
||||
|
|
132
docs/default.nix
132
docs/default.nix
|
@ -1,21 +1,46 @@
|
|||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
lib ? import ../lib/stdlib-extended.nix pkgs.lib,
|
||||
nmdSrc,
|
||||
lib ? import ../lib/stdlib-extended.nix pkgs.lib inputs,
|
||||
manpageUrls ? pkgs.path + "/doc/manpage-urls.json",
|
||||
...
|
||||
}: let
|
||||
nmd = import nmdSrc {
|
||||
inherit lib;
|
||||
# The DocBook output of `nixos-render-docs` doesn't have the change
|
||||
# `nmd` uses to work around the broken stylesheets in
|
||||
# `docbook-xsl-ns`, so we restore the patched version here.
|
||||
pkgs =
|
||||
pkgs
|
||||
// {
|
||||
docbook-xsl-ns =
|
||||
pkgs.docbook-xsl-ns.override {withManOptDedupPatch = true;};
|
||||
};
|
||||
};
|
||||
inherit (lib.modules) mkForce evalModules;
|
||||
inherit (lib.strings) hasPrefix removePrefix;
|
||||
inherit (lib.attrsets) isAttrs mapAttrs optionalAttrs recursiveUpdate isDerivation;
|
||||
inherit (builtins) fromJSON readFile;
|
||||
|
||||
# release data
|
||||
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.
|
||||
|
@ -23,46 +48,51 @@
|
|||
imports = [
|
||||
{
|
||||
_module.args = {
|
||||
pkgs = lib.mkForce (nmd.scrubDerivations "pkgs" pkgs);
|
||||
pkgs_i686 = lib.mkForce {};
|
||||
pkgs = mkForce (scrubDerivations "pkgs" pkgs);
|
||||
pkgs_i686 = mkForce {};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
dontCheckDefinitions = {_module.check = false;};
|
||||
|
||||
githubDeclaration = user: repo: subpath: let
|
||||
urlRef = "main";
|
||||
in {
|
||||
url = "https://github.com/${user}/${repo}/blob/${urlRef}/${subpath}";
|
||||
name = "<${repo}/${subpath}>";
|
||||
};
|
||||
|
||||
# Specify the path to the module entrypoint
|
||||
nvimPath = toString ./..;
|
||||
|
||||
buildOptionsDocs = args @ {
|
||||
modules,
|
||||
includeModuleSystemOptions ? true,
|
||||
warningsAreErrors ? true,
|
||||
...
|
||||
}: let
|
||||
inherit ((lib.evalModules {inherit modules;})) options;
|
||||
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:
|
||||
opt
|
||||
// {
|
||||
# Clean up declaration sites to not refer to the Home Manager
|
||||
recursiveUpdate opt {
|
||||
# Clean up declaration sites to not refer to the nvf
|
||||
# source tree.
|
||||
declarations = map (decl:
|
||||
if lib.hasPrefix nvimPath (toString decl)
|
||||
if hasPrefix nvimPath (toString decl)
|
||||
then
|
||||
githubDeclaration "notashelf" "neovim-flake"
|
||||
(lib.removePrefix "/" (lib.removePrefix nvimPath (toString decl)))
|
||||
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
|
||||
|
@ -75,61 +105,65 @@
|
|||
// builtins.removeAttrs args ["modules" "includeModuleSystemOptions"]);
|
||||
|
||||
nvimModuleDocs = buildOptionsDocs {
|
||||
variablelistId = "nvf-options";
|
||||
|
||||
modules =
|
||||
import ../modules/modules.nix {
|
||||
inherit lib pkgs;
|
||||
check = false;
|
||||
}
|
||||
++ [scrubbedPkgsModule];
|
||||
variablelistId = "neovim-flake-options";
|
||||
};
|
||||
|
||||
release-config = builtins.fromJSON (builtins.readFile ../release.json);
|
||||
revision = "release-${release-config.release}";
|
||||
# Generate the `man home-configuration.nix` package
|
||||
nvf-configuration-manual =
|
||||
pkgs.runCommand "neovim-flake-reference-manpage" {
|
||||
pkgs.runCommand "nvf-reference-manpage" {
|
||||
nativeBuildInputs = [pkgs.buildPackages.installShellFiles pkgs.nixos-render-docs];
|
||||
allowedReferences = ["out"];
|
||||
} ''
|
||||
# Generate manpages.
|
||||
mkdir -p $out/share/man/man5
|
||||
mkdir -p $out/share/man/man1
|
||||
|
||||
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
|
||||
--revision ${revision} \
|
||||
--header ${./man/header.5} \
|
||||
--footer ${./man/footer.5} \
|
||||
${nvimModuleDocs.optionsJSON}/share/doc/nixos/options.json \
|
||||
$out/share/man/man5/neovim-flake.5
|
||||
cp ${./neovim-flake.1} $out/share/man/man1/neovim-flake.1
|
||||
$out/share/man/man5/nvf.5
|
||||
|
||||
cp ${./man/nvf.1} $out/share/man/man1/nvf.1
|
||||
'';
|
||||
|
||||
# Generate the HTML manual pages
|
||||
neovim-flake-manual = pkgs.callPackage ./manual.nix {
|
||||
inherit revision;
|
||||
outputPath = "share/doc/neovim-flake";
|
||||
nmd = nmdSrc;
|
||||
nvf-manual = pkgs.callPackage ./manual.nix {
|
||||
inherit revision manpageUrls;
|
||||
outputPath = "share/doc/nvf";
|
||||
options = {
|
||||
neovim-flake = nvimModuleDocs.optionsJSON;
|
||||
nvf = nvimModuleDocs.optionsJSON;
|
||||
};
|
||||
};
|
||||
html = neovim-flake-manual;
|
||||
|
||||
html = nvf-manual;
|
||||
htmlOpenTool = pkgs.callPackage ./html-open-tool.nix {} {inherit html;};
|
||||
in {
|
||||
inherit nmdSrc;
|
||||
inherit (inputs) nmd;
|
||||
|
||||
options = {
|
||||
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
|
||||
# `nixosOptionsDoc` is more customizable.
|
||||
json =
|
||||
pkgs.runCommand "options.json" {
|
||||
meta.description = "List of Home Manager options in JSON format";
|
||||
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/neovim-flake
|
||||
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/neovim-flake"
|
||||
"$out/share/doc/nvf"
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
.SH "AUTHORS"
|
||||
.PP
|
||||
neovim-flake contributors
|
|
@ -1,8 +0,0 @@
|
|||
pre {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
pre code.hljs {
|
||||
border: none;
|
||||
margin: 0;
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
symlinkJoin,
|
||||
}: {
|
||||
html,
|
||||
pathName ? "neovim-flake",
|
||||
pathName ? "nvf",
|
||||
projectName ? pathName,
|
||||
name ? "${pathName}-help",
|
||||
}: let
|
||||
|
|
3
docs/man/footer.5
Normal file
3
docs/man/footer.5
Normal file
|
@ -0,0 +1,3 @@
|
|||
.SH "AUTHORS"
|
||||
.PP
|
||||
nvf contributors
|
|
@ -1,4 +1,4 @@
|
|||
.TH "neovim-flake" "5" "01/01/1980" "neovim-flake"
|
||||
.TH "nvf" "5" "01/01/1980" "nvf"
|
||||
.\" disable hyphenation
|
||||
.nh
|
||||
.\" disable justification (adjust text to left margin only)
|
||||
|
@ -6,9 +6,8 @@
|
|||
.\" enable line breaks after slashes
|
||||
.cflags 4 /
|
||||
.SH "NAME"
|
||||
neovim-flake configuration specification
|
||||
nvf configuration specification
|
||||
.SH "OPTIONS"
|
||||
.PP
|
||||
You can use the following options in
|
||||
home\-configuration\&.nix:
|
||||
You can use the following options to configure nvf:
|
||||
.PP
|
|
@ -1,6 +1,6 @@
|
|||
.Dd January 1, 1980
|
||||
.Dt neovim-flake 1
|
||||
.Os neovim-flake
|
||||
.Dt nvf 1
|
||||
.Os nvf
|
||||
.\" disable hyphenation
|
||||
.nh
|
||||
.\" disable justification (adjust text to left margin only)
|
||||
|
@ -8,22 +8,26 @@
|
|||
.\" enable line breaks after slashes
|
||||
.cflags 4 /
|
||||
.Sh NAME
|
||||
.Nm neovim-flake
|
||||
.Nd a extensible and distro-agonistic Neovim configuration wrapper in Nix
|
||||
.Nm nvf
|
||||
.Nd A highly modular, extensible and distro-agnostic Neovim configuration framework for Nix/NixOS.
|
||||
.
|
||||
.Sh BUGS
|
||||
.Pp
|
||||
Please report any bugs on the
|
||||
Please report any bugs that you might encounter on the
|
||||
\m[blue]\fBproject issue tracker\fR\m[]\&.
|
||||
|
||||
.Sh SEE ALSO
|
||||
.Pp
|
||||
\fBnvf\fR(5)
|
||||
|
||||
.Sh AUTHOR
|
||||
.Pp
|
||||
\fBneovim-flake contributors\fR
|
||||
\fBnvf contributors\fR
|
||||
.RS 4
|
||||
Author.
|
||||
.RE
|
||||
|
||||
.Sh COPYRIGHT
|
||||
.br
|
||||
Copyright \(co 2017\(en2022 neovim-flake contributors
|
||||
Copyright \(co 2023\(en2024 nvf contributors
|
||||
.br
|
|
@ -1,54 +1,57 @@
|
|||
{
|
||||
stdenv,
|
||||
lib,
|
||||
documentation-highlighter,
|
||||
nmd,
|
||||
revision,
|
||||
outputPath ? "share/doc/neovim-flake",
|
||||
options,
|
||||
stdenvNoCC,
|
||||
# build inputs
|
||||
nixos-render-docs,
|
||||
documentation-highlighter,
|
||||
# nrd configuration
|
||||
manpageUrls,
|
||||
revision,
|
||||
options,
|
||||
outputPath ? "share/doc/nvf",
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
name = "neovim-flake-manual";
|
||||
src = ./manual;
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "nvf-manual";
|
||||
src = builtins.path {
|
||||
path = lib.sourceFilesBySuffices ./manual [".md"];
|
||||
name = "nvf-manual";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [nixos-render-docs];
|
||||
|
||||
buildPhase = ''
|
||||
mkdir -p out/media
|
||||
mkdir -p out/{highlightjs,media}
|
||||
|
||||
mkdir -p out/highlightjs
|
||||
cp -t out/highlightjs \
|
||||
cp -vt out/highlightjs \
|
||||
${documentation-highlighter}/highlight.pack.js \
|
||||
${documentation-highlighter}/LICENSE \
|
||||
${documentation-highlighter}/mono-blue.css \
|
||||
${documentation-highlighter}/loader.js
|
||||
|
||||
substituteInPlace ./options.md \
|
||||
--replace \
|
||||
'@OPTIONS_JSON@' \
|
||||
${options.neovim-flake}/share/doc/nixos/options.json
|
||||
--subst-var-by \
|
||||
OPTIONS_JSON \
|
||||
${options.nvf}/share/doc/nixos/options.json
|
||||
|
||||
substituteInPlace ./manual.md \
|
||||
--replace \
|
||||
'@VERSION@' \
|
||||
--subst-var-by \
|
||||
NVF_VERSION \
|
||||
${revision}
|
||||
|
||||
cp -v ${nmd}/static/style.css out/style.css
|
||||
cp -vt out/highlightjs ${nmd}/static/highlightjs/tomorrow-night.min.css
|
||||
cp -v ${./highlight-style.css} out/highlightjs/highlight-style.css
|
||||
# copy stylesheet
|
||||
cp ${./static/style.css} out/style.css
|
||||
|
||||
# copy release notes
|
||||
cp -vr ${./release-notes} release-notes
|
||||
|
||||
# generate manual from
|
||||
nixos-render-docs manual html \
|
||||
--manpage-urls ./manpage-urls.json \
|
||||
--manpage-urls ${manpageUrls} \
|
||||
--revision ${lib.trivial.revisionWithDefault revision} \
|
||||
--stylesheet style.css \
|
||||
--stylesheet highlightjs/tomorrow-night.min.css \
|
||||
--stylesheet highlightjs/highlight-style.css \
|
||||
--script highlightjs/highlight.pack.js \
|
||||
--script highlightjs/loader.js \
|
||||
--toc-depth 1 \
|
||||
--toc-depth 2 \
|
||||
--section-toc-depth 1 \
|
||||
manual.md \
|
||||
out/index.xhtml
|
||||
|
|
8
docs/manual/configuring.md
Normal file
8
docs/manual/configuring.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Configuring nvf {#ch-configuring}
|
||||
|
||||
```{=include=} chapters
|
||||
configuring/custom-package.md
|
||||
configuring/custom-plugins.md
|
||||
configuring/languages.md
|
||||
configuring/dags.md
|
||||
```
|
22
docs/manual/configuring/custom-package.md
Normal file
22
docs/manual/configuring/custom-package.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Custom Neovim Package {#ch-custom-package}
|
||||
|
||||
As of v0.5, you may now specify the Neovim package that will be wrapped with
|
||||
your configuration. This is done with the `vim.package` option.
|
||||
|
||||
```nix
|
||||
{inputs, pkgs, ...}: {
|
||||
# using the neovim-nightly overlay
|
||||
vim.package = inputs.neovim-overlay.packages.${pkgs.system}.neovim;
|
||||
}
|
||||
```
|
||||
|
||||
The neovim-nightly-overlay always exposes an unwrapped package. If using a
|
||||
different source, you are highly recommended to get an "unwrapped" version of
|
||||
the neovim package, similar to `neovim-unwrapped` in nixpkgs.
|
||||
|
||||
```nix
|
||||
{ pkgs, ...}: {
|
||||
# using the neovim-nightly overlay
|
||||
vim.package = pkgs.neovim-unwrapped;
|
||||
}
|
||||
```
|
25
docs/manual/configuring/custom-plugins.md
Normal file
25
docs/manual/configuring/custom-plugins.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Custom Plugins {#ch-custom-plugins}
|
||||
|
||||
**nvf**, by default, exposes a wide variety of plugins as module options
|
||||
for your convience and bundles necessary dependencies into **nvf**'s runtime.
|
||||
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
|
||||
configuration locally.
|
||||
|
||||
## Adding Plugins {#ch-adding-plugins}
|
||||
|
||||
There are multiple ways of adding custom plugins to your **nvf** configuration.
|
||||
|
||||
You can use custom plugins, before they are implemented in the flake. To add a
|
||||
plugin to the runtime, you need to add it to the `vim.startPlugins` list in
|
||||
your configuration.
|
||||
|
||||
Adding a plugin to `startPlugins` will not allow you to configure the plugin
|
||||
that you have adeed, but **nvf** provides multiple way of configuring any
|
||||
custom plugins that you might have added to your configuration.
|
||||
|
||||
```{=include=} sections
|
||||
custom-plugins/configuring.md
|
||||
custom-plugins/new-method.md
|
||||
custom-plugins/old-method.md
|
||||
```
|
26
docs/manual/configuring/custom-plugins/configuring.md
Normal file
26
docs/manual/configuring/custom-plugins/configuring.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
# Configuring {#sec-configuring-plugins}
|
||||
|
||||
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
|
||||
either `config.vim.configRC` or `config.vim.luaConfigRC` respectively. Both of
|
||||
these options are attribute sets, and you need to give the configuration you're
|
||||
adding some name, like this:
|
||||
|
||||
```nix
|
||||
{
|
||||
# this will create an "aquarium" section in your init.vim with the contents of your custom config
|
||||
# which will be *appended* to the rest of your configuration, inside your init.vim
|
||||
config.vim.configRC.aquarium = "colorscheme aquiarum";
|
||||
}
|
||||
```
|
||||
|
||||
:::{.note}
|
||||
If your configuration needs to be put in a specific place in the config, you
|
||||
can use functions from `inputs.nvf.lib.nvim.dag` to order it. Refer to
|
||||
https://github.com/nix-community/home-manager/blob/master/modules/lib/dag.nix
|
||||
to find out more about the DAG system.
|
||||
:::
|
||||
|
||||
If you successfully made your plugin work, please feel free to create a PR to
|
||||
add it to **nvf** or open an issue with your findings so that we can make it
|
||||
available for everyone easily.
|
|
@ -1,8 +1,8 @@
|
|||
# New Method {#sec-new-method}
|
||||
|
||||
As of version 0.5, we have a more extensive API for configuring plugins, under `vim.extraPlugins`.
|
||||
|
||||
Instead of using DAGs exposed by the library, you may use the extra plugin module as follows:
|
||||
As of version **0.5**, we have a more extensive API for configuring plugins,
|
||||
under `vim.extraPlugins`. Instead of using DAGs exposed by the library, you may
|
||||
use the extra plugin module as follows:
|
||||
|
||||
```nix
|
||||
{
|
35
docs/manual/configuring/custom-plugins/old-method.md
Normal file
35
docs/manual/configuring/custom-plugins/old-method.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Old Method {#sec-old-method}
|
||||
|
||||
Prior to version 0.5, the method of adding new plugins was adding the plugin
|
||||
package to `vim.startPlugins` and add its configuration as a DAG under one of
|
||||
`vim.configRC` or `vim.luaConfigRC`. Users who have not yet updated to 0.5, or
|
||||
prefer a more hands-on approach may use the old method where the load order of
|
||||
the plugins is determined by DAGs.
|
||||
|
||||
## Adding plugins {#sec-adding-plugins}
|
||||
|
||||
To add a plugin to **nvf**'s runtime, you may add it
|
||||
|
||||
```nix
|
||||
{pkgs, ...}: {
|
||||
# add a package from nixpkgs to startPlugins
|
||||
vim.startPlugins = [
|
||||
pkgs.vimPlugins.aerial-nvim ];
|
||||
}
|
||||
```
|
||||
|
||||
And to configure the added plugin, you can use the `luaConfigRC` option to
|
||||
provide configuration as a DAG using the **nvf** extended library.
|
||||
|
||||
```nix
|
||||
{inputs, ...}: let
|
||||
# assuming you have an input called nvf pointing at the nvf repository
|
||||
inherit (inputs.nvf.lib.nvim.dag) entryAnywhere;
|
||||
in {
|
||||
vim.luaConfigRC.aerial-nvim= entryAnywhere ''
|
||||
require('aerial').setup {
|
||||
-- your configuration here
|
||||
}
|
||||
'';
|
||||
}
|
||||
```
|
185
docs/manual/configuring/dags.md
Normal file
185
docs/manual/configuring/dags.md
Normal file
|
@ -0,0 +1,185 @@
|
|||
# Using DAGs {#ch-using-dags}
|
||||
|
||||
We conform to the NixOS options types for the most part, however, a noteworthy
|
||||
addition for certain options is the [**DAG
|
||||
(Directed acyclic graph)**](https://en.wikipedia.org/wiki/Directed_acyclic_graph)
|
||||
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
|
||||
entries to express dependency relations among themselves. This can, for
|
||||
example, be used to control the order of configuration sections in your
|
||||
`configRC` or `luaConfigRC`.
|
||||
|
||||
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)
|
||||
explains in more detail the overall usage logic of the DAG type.
|
||||
|
||||
## entryAnywhere {#sec-types-dag-entryAnywhere}
|
||||
|
||||
> `lib.dag.entryAnywhere (value: T) : DagEntry<T>`
|
||||
|
||||
Indicates that `value` can be placed anywhere within the DAG.
|
||||
This is also the default for plain attribute set entries, that
|
||||
is
|
||||
|
||||
```nix
|
||||
foo.bar = {
|
||||
a = lib.dag.entryAnywhere 0;
|
||||
}
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```nix
|
||||
foo.bar = {
|
||||
a = 0;
|
||||
}
|
||||
```
|
||||
|
||||
are equivalent.
|
||||
|
||||
## entryAfter {#ch-types-dag-entryAfter}
|
||||
|
||||
> `lib.dag.entryAfter (afters: list string) (value: T) : DagEntry<T>`
|
||||
|
||||
Indicates that `value` must be placed _after_ each of the
|
||||
attribute names in the given list. For example
|
||||
|
||||
```nix
|
||||
foo.bar = {
|
||||
a = 0;
|
||||
b = lib.dag.entryAfter [ "a" ] 1;
|
||||
}
|
||||
```
|
||||
|
||||
would place `b` after `a` in the graph.
|
||||
|
||||
## entryBefore {#ch-types-dag-entryBefore}
|
||||
|
||||
> `lib.dag.entryBefore (befores: list string) (value: T) : DagEntry<T>`
|
||||
|
||||
Indicates that `value` must be placed _before_ each of the
|
||||
attribute names in the given list. For example
|
||||
|
||||
```nix
|
||||
foo.bar = {
|
||||
b = lib.dag.entryBefore [ "a" ] 1;
|
||||
a = 0;
|
||||
}
|
||||
```
|
||||
|
||||
would place `b` before `a` in the graph.
|
||||
|
||||
## entryBetween {#sec-types-dag-entryBetween}
|
||||
|
||||
> `lib.dag.entryBetween (befores: list string) (afters: list string) (value: T) : DagEntry<T>`
|
||||
|
||||
Indicates that `value` must be placed _before_ the attribute
|
||||
names in the first list and _after_ the attribute names in the
|
||||
second list. For example
|
||||
|
||||
```nix
|
||||
foo.bar = {
|
||||
a = 0;
|
||||
c = lib.dag.entryBetween [ "b" ] [ "a" ] 2;
|
||||
b = 1;
|
||||
}
|
||||
```
|
||||
|
||||
would place `c` before `b` and after `a` in the graph.
|
||||
|
||||
There are also a set of functions that generate a DAG from a list.
|
||||
These are convenient when you just want to have a linear list of DAG
|
||||
entries, without having to manually enter the relationship between
|
||||
each entry. Each of these functions take a `tag` as argument and the
|
||||
DAG entries will be named `${tag}-${index}`.
|
||||
|
||||
## entriesAnywhere {#sec-types-dag-entriesAnywhere}
|
||||
|
||||
> `lib.dag.entriesAnywhere (tag: string) (values: [T]) : Dag<T>`
|
||||
|
||||
Creates a DAG with the given values with each entry labeled
|
||||
using the given tag. For example
|
||||
|
||||
```nix
|
||||
foo.bar = lib.dag.entriesAnywhere "a" [ 0 1 ];
|
||||
```
|
||||
|
||||
is equivalent to
|
||||
|
||||
```nix
|
||||
foo.bar = {
|
||||
a-0 = 0;
|
||||
a-1 = lib.dag.entryAfter [ "a-0" ] 1;
|
||||
}
|
||||
```
|
||||
|
||||
## entriesAfter {#sec-types-dag-entriesAfter}
|
||||
|
||||
> `lib.dag.entriesAfter (tag: string) (afters: list string) (values: [T]) : Dag<T>`
|
||||
|
||||
Creates a DAG with the given values with each entry labeled
|
||||
using the given tag. The list of values are placed are placed
|
||||
_after_ each of the attribute names in `afters`. For example
|
||||
|
||||
```nix
|
||||
foo.bar =
|
||||
{ b = 0; } // lib.dag.entriesAfter "a" [ "b" ] [ 1 2 ];
|
||||
```
|
||||
|
||||
is equivalent to
|
||||
|
||||
```nix
|
||||
foo.bar = {
|
||||
b = 0;
|
||||
a-0 = lib.dag.entryAfter [ "b" ] 1;
|
||||
a-1 = lib.dag.entryAfter [ "a-0" ] 2;
|
||||
}
|
||||
```
|
||||
|
||||
## entriesBefore {#sec-types-dag-entriesBefore}
|
||||
|
||||
> `lib.dag.entriesBefore (tag: string) (befores: list string) (values: [T]) : Dag<T>`
|
||||
|
||||
Creates a DAG with the given values with each entry labeled
|
||||
using the given tag. The list of values are placed _before_ each
|
||||
of the attribute names in `befores`. For example
|
||||
|
||||
```nix
|
||||
foo.bar =
|
||||
{ b = 0; } // lib.dag.entriesBefore "a" [ "b" ] [ 1 2 ];
|
||||
```
|
||||
|
||||
is equivalent to
|
||||
|
||||
```nix
|
||||
foo.bar = {
|
||||
b = 0;
|
||||
a-0 = 1;
|
||||
a-1 = lib.dag.entryBetween [ "b" ] [ "a-0" ] 2;
|
||||
}
|
||||
```
|
||||
|
||||
## entriesBetween {#sec-types-dag-entriesBetween}
|
||||
|
||||
> `lib.dag.entriesBetween (tag: string) (befores: list string) (afters: list string) (values: [T]) : Dag<T>`
|
||||
|
||||
Creates a DAG with the given values with each entry labeled
|
||||
using the given tag. The list of values are placed _before_ each
|
||||
of the attribute names in `befores` and _after_ each of the
|
||||
attribute names in `afters`. For example
|
||||
|
||||
```nix
|
||||
foo.bar =
|
||||
{ b = 0; c = 3; } // lib.dag.entriesBetween "a" [ "b" ] [ "c" ] [ 1 2 ];
|
||||
```
|
||||
|
||||
is equivalent to
|
||||
|
||||
```nix
|
||||
foo.bar = {
|
||||
b = 0;
|
||||
c = 3;
|
||||
a-0 = lib.dag.entryAfter [ "c" ] 1;
|
||||
a-1 = lib.dag.entryBetween [ "b" ] [ "a-0" ] 2;
|
||||
}
|
||||
```
|
|
@ -1,6 +1,10 @@
|
|||
# Language Support {#ch-languages}
|
||||
|
||||
Language specific support means there is a combination of language specific plugins, `treesitter` support, `nvim-lspconfig` language servers, and `null-ls` integration. This gets you capabilities ranging from autocompletion to formatting to diagnostics. The following languages have sections under the `vim.languages` attribute. See the configuration docs for details.
|
||||
Language specific support means there is a combination of language specific
|
||||
plugins, `treesitter` support, `nvim-lspconfig` language servers, and `null-ls`
|
||||
integration. This gets you capabilities ranging from autocompletion to formatting
|
||||
to diagnostics. The following languages have sections under the `vim.languages`
|
||||
attribute.
|
||||
|
||||
- Rust: [vim.languages.rust.enable](#opt-vim.languages.rust.enable)
|
||||
- Nix: [vim.languages.nix.enable](#opt-vim.languages.nix.enable)
|
18
docs/manual/configuring/languages/lsp.md
Normal file
18
docs/manual/configuring/languages/lsp.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
# LSP Custom Packages/Command {#sec-languages-custom-lsp-packages}
|
||||
|
||||
In any of the `opt.languages.<language>.lsp.package` options you can provide
|
||||
your own LSP package, or provide the command to launch the language server, as
|
||||
a list of strings. You can use this to skip automatic installation of a language
|
||||
server, and instead use the one found in your `$PATH` during runtime, for
|
||||
example:
|
||||
|
||||
```nix
|
||||
vim.languages.java = {
|
||||
lsp = {
|
||||
enable = true;
|
||||
# this expects jdt-language-server to be in your PATH
|
||||
# or in `vim.extraPackages`
|
||||
package = ["jdt-language-server" "-data" "~/.cache/jdtls/workspace"];
|
||||
};
|
||||
}
|
||||
```
|
|
@ -1,63 +0,0 @@
|
|||
# Custom Configuration {#ch-custom-configuration}
|
||||
|
||||
Custom configuration is done with the `neovimConfiguration` while using the flake as a standalone package.
|
||||
It takes in the configuration as a module. The output of the configuration function is an attrset.
|
||||
|
||||
```nix
|
||||
{
|
||||
options = "The options that were available to configure";
|
||||
config = "The outputted configuration";
|
||||
pkgs = "The package set used to evaluate the module";
|
||||
neovim = "The built neovim package";
|
||||
}
|
||||
```
|
||||
|
||||
The following is an example of a barebones vim configuration with the default theme enabled.
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs.neovim-flake = {
|
||||
url = "github:notashelf/neovim-flake";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = {nixpkgs, neovim-flake, ...}: let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
configModule = {
|
||||
# Add any custom options (and feel free to upstream them!)
|
||||
# options = ...
|
||||
|
||||
config.vim = {
|
||||
theme.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
customNeovim = neovim-flake.lib.neovimConfiguration {
|
||||
modules = [configModule];
|
||||
inherit pkgs;
|
||||
};
|
||||
in {
|
||||
# this will make the package available as a flake input
|
||||
packages.${system}.neovim = customNeovim.neovim;
|
||||
|
||||
# this is an example nixosConfiguration using the built neovim package
|
||||
nixosConfigurations = {
|
||||
yourHostName = nixpkgs.lib.nixosSystem {
|
||||
# ...
|
||||
modules = [
|
||||
./configuration.nix # or whatever your configuration is
|
||||
|
||||
# this will make wrapped neovim available in your system packages
|
||||
{environment.systemPackages = [customNeovim.neovim];}
|
||||
];
|
||||
# ...
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Your built neovim configuration can be exposed as a flake output, or be added to your system packages to make
|
||||
it available across your system. You may also consider passing the flake output to home-manager to make it available
|
||||
to a specific user _without_ using the home-manager module.
|
|
@ -1,12 +0,0 @@
|
|||
# Custom Neovim Package {#ch-custom-package}
|
||||
|
||||
As of v0.5, you may now specify the neovim package that will be wrapped with your configuration. This is done with the `vim.package` option.
|
||||
|
||||
```nix
|
||||
{inputs, pkgs, ...}: {
|
||||
# using the neovim-nightly overlay
|
||||
config.vim.package = inputs.neovim-overlay.packages.${pkgs.system}.neovim;
|
||||
}
|
||||
```
|
||||
|
||||
The neovim-nightly-overlay always exposes an unwrapped package. If using a different source, you are highly recommended to get an "unwrapped" version of the neovim package,similar to `neovim-unwrapped` in nixpkgs.
|
|
@ -1,10 +0,0 @@
|
|||
# Custom Plugins {#ch-custom-plugins}
|
||||
|
||||
You can use custom plugins, before they are implemented in the flake.
|
||||
To add a plugin, you need to add it to your config's `config.vim.startPlugins` array.
|
||||
|
||||
```{=include=} sections
|
||||
custom-plugins/new-method.md
|
||||
custom-plugins/old-method.md
|
||||
custom-plugins/configuring.md
|
||||
```
|
|
@ -1,23 +0,0 @@
|
|||
# Configuring {#configuring-plugins}
|
||||
|
||||
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 `config.vim.configRC` or `config.vim.luaConfigRC`
|
||||
respectively. These options are attribute sets, and you need to give the configuration you're adding some name, like this:
|
||||
|
||||
```nix
|
||||
{
|
||||
# this will create an "aquarium" section in your init.vim with the contents of your custom config
|
||||
# which will be *appended* to the rest of your configuration, inside your init.vim
|
||||
config.vim.configRC.aquarium = "colorscheme aquiarum";
|
||||
}
|
||||
```
|
||||
|
||||
:::{.note}
|
||||
If your configuration needs to be put in a specific place in the config, you can use functions from
|
||||
`inputs.neovim-flake.lib.nvim.dag` to order it.
|
||||
Refer to https://github.com/nix-community/home-manager/blob/master/modules/lib/dag.nix to find out more about
|
||||
the DAG system.
|
||||
:::
|
||||
|
||||
Also, if you successfully made your plugin work, please make a PR to add it to the flake, or open an issue
|
||||
with your findings so that we can make it available for everyone easily.
|
|
@ -1,18 +0,0 @@
|
|||
# Old Method {#sec-old-method}
|
||||
|
||||
Users who have not yet updated to 0.5, or prefer a more hands-on approach may use the old method where the load order
|
||||
of the plugins is determined by DAGs.
|
||||
|
||||
```nix
|
||||
{
|
||||
# fetch plugin source from GitHub and add it to startPlugins
|
||||
config.vim.startPlugins = [
|
||||
(pkgs.fetchFromGitHub {
|
||||
owner = "FrenzyExists";
|
||||
repo = "aquarium-vim";
|
||||
rev = "d09b1feda1148797aa5ff0dbca8d8e3256d028d5";
|
||||
sha256 = "CtyEhCcGxxok6xFQ09feWpdEBIYHH+GIFVOaNZx10Bs=";
|
||||
})
|
||||
];
|
||||
}
|
||||
```
|
|
@ -1,10 +1,9 @@
|
|||
# Default Configs {#ch-default-configs}
|
||||
|
||||
While you can configure neovim-flake yourself using the builder, you can also use the pre-built configs that are available.
|
||||
While you can configure **nvf** yourself using the builder, you can also use the pre-built configs that are available.
|
||||
Here are a few default configurations you can use.
|
||||
|
||||
```{=include=} sections
|
||||
```{=include=} chapters
|
||||
default-configs/maximal.md
|
||||
default-configs/nix.md
|
||||
default-configs/tidal.md
|
||||
```
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# Maximal {#sec-default-maximal}
|
||||
|
||||
```bash
|
||||
$ nix shell github:notashelf/neovim-flake#maximal test.nix
|
||||
$ nix shell github:notashelf/nvf#maximal test.nix
|
||||
```
|
||||
|
||||
It is the same fully configured neovim as with the [Nix](#sec-default-nix) config, but with every supported language enabled.
|
||||
|
||||
:::{.note}
|
||||
|
||||
Running the maximal config will download _a lot_ of packages as it is downloading language servers, formatters, and more.
|
||||
It is the same fully configured Neovim as with the [Nix](#sec-default-nix)
|
||||
configuration, but with every supported language enabled.
|
||||
|
||||
::: {.note}
|
||||
Running the maximal config will download _a lot_ of packages as it is
|
||||
downloading language servers, formatters, and more.
|
||||
:::
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# Nix {#sec-default-nix}
|
||||
|
||||
```bash
|
||||
$ nix run github:notashelf/neovim-flake#nix test.nix
|
||||
$ nix run github:notashelf/nvf#nix test.nix
|
||||
```
|
||||
|
||||
Enables all the of neovim plugins, with language support for specifically Nix. This lets you see what a fully configured neovim setup looks like without downloading a whole bunch of language servers and associated tools.
|
||||
Enables all the of Neovim plugins, with language support for specifically Nix.
|
||||
This lets you see what a fully configured neovim setup looks like without
|
||||
downloading a whole bunch of language servers and associated tools.
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
# Tidal Cycles {#sec-default-tidal}
|
||||
|
||||
```bash
|
||||
$ nix run github:notashelf/neovim-flake#tidal file.tidal
|
||||
```
|
||||
|
||||
Utilizing [vim-tidal](https://github.com/tidalcycles/vim-tidal) and mitchmindtree's fantastic
|
||||
[tidalcycles.nix](https://github.com/mitchmindtree/tidalcycles.nix) start playing with tidal cycles in a single command.
|
||||
|
||||
In your tidal file, type a cycle e.g. `d1 $ s "drum"` and then press _ctrl+enter_. Super collider with superdirt, and a
|
||||
modified GHCI with tidal will start up and begin playing. Note, you need jack enabled on your system. If you are using
|
||||
pipewire, its as easy as setting `services.pipewire.jack.enable = true` in your configuration.
|
|
@ -1,14 +1,14 @@
|
|||
# Hacking neovim-flake {#ch-hacking}
|
||||
# Hacking nvf {#ch-hacking}
|
||||
|
||||
neovim-flake is designed for developers as much as it is for the end user. I would like any potential contributor
|
||||
**nvf** is designed for developers as much as it is for the end user. I would like any potential contributor
|
||||
to be able to propagate their desired changes into the repository without the extra effort. As such, below are guides
|
||||
(and guidelines) to streamline the contribution process and ensure that your valuable input seamlessly integrates
|
||||
into neovim-flake's development without leaving question marks in your head.
|
||||
into **nvf**'s development without leaving question marks in your head.
|
||||
|
||||
This section is mainly directed towards those who wish to contribute code into neovim-flake. If you wish to instead
|
||||
This section is mainly directed towards those who wish to contribute code into **nvf**. If you wish to instead
|
||||
report a bug or discuss a potential feature implementation, first look among the
|
||||
already [open issues](https://github.com/notashelf/neovim-flake/issues) and if no matching issue exists you may open
|
||||
a [new issue](https://github.com/notashelf/neovim-flake/issues/new) and describe your problem/request. While creating an
|
||||
already [open issues](https://github.com/notashelf/nvf/issues) and if no matching issue exists you may open
|
||||
a [new issue](https://github.com/notashelf/nvf/issues/new) and describe your problem/request. While creating an
|
||||
issue, please try to include as much information as you can, ideally also include relevant context in which an issue
|
||||
occurs or a feature should be implemented.
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
# Adding Plugins {#sec-additional-plugins}
|
||||
|
||||
To add a new neovim plugin, first add the source url in the inputs section of `flake.nix`
|
||||
To add a new Neovim plugin, first add the source url in the inputs section of `flake.nix`
|
||||
with the prefix `plugin-`
|
||||
|
||||
```nix
|
||||
|
||||
{
|
||||
inputs = {
|
||||
# ...
|
||||
neodev-nvim = {
|
||||
plugin-neodev-nvim = {
|
||||
url = "github:folke/neodev.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
@ -16,18 +17,110 @@ To add a new neovim plugin, first add the source url in the inputs section of `f
|
|||
}
|
||||
```
|
||||
|
||||
Then add the name of the plugin into the `availablePlugins` variable in `lib/types/plugins.nix`:
|
||||
The addition of the `plugin-` prefix will allow **nvf** to autodiscover the
|
||||
input from the flake inputs automatically, allowing you to refer to it in areas
|
||||
that require a very specific plugin type as defined in `lib/types/plugins.nix`
|
||||
|
||||
```nix
|
||||
# ...
|
||||
availablePlugins = [
|
||||
# ...
|
||||
"neodev-nvim"
|
||||
];
|
||||
```
|
||||
|
||||
You can now reference this plugin using its string name:
|
||||
You can now reference this plugin using its string name, the plugin will be
|
||||
built with the name and source URL from the flake input, allowing you to
|
||||
refer to it as a **string**.
|
||||
|
||||
```nix
|
||||
config.vim.startPlugins = ["neodev-nvim"];
|
||||
```
|
||||
|
||||
## Modular setup options {#sec-modular-setup-options}
|
||||
|
||||
Most plugins is initialized with a call to `require('plugin').setup({...})`.
|
||||
|
||||
We use a special function that lets you easily add support for such setup options in a modular way:
|
||||
`mkPluginSetupOption`.
|
||||
|
||||
Once you have added the source of the plugin as shown above, you can define the setup options like
|
||||
this:
|
||||
|
||||
```nix
|
||||
# in modules/.../your-plugin/your-plugin.nix
|
||||
|
||||
{lib, ...}:
|
||||
let
|
||||
inherit (lib.types) bool int;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.your-plugin = {
|
||||
setupOpts = mkPluginSetupOption "plugin name" {
|
||||
enable_feature_a = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
# ...
|
||||
};
|
||||
|
||||
number_option = mkOption {
|
||||
type = int;
|
||||
default = 3;
|
||||
# ...
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
```nix
|
||||
# in modules/.../your-plugin/config.nix
|
||||
{lib, config, ...}:
|
||||
let
|
||||
cfg = config.vim.your-plugin;
|
||||
in {
|
||||
vim.luaConfigRC = lib.nvim.dag.entryAnywhere ''
|
||||
require('plugin-name').setup(${lib.nvim.lua.toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
This above config will result in this lua script:
|
||||
|
||||
```lua
|
||||
require('plugin-name').setup({
|
||||
enable_feature_a = false,
|
||||
number_option = 3,
|
||||
})
|
||||
```
|
||||
|
||||
Now users can set any of the pre-defined option field, and can also add their own fields!
|
||||
|
||||
```nix
|
||||
# in user's config
|
||||
{
|
||||
vim.your-plugin.setupOpts = {
|
||||
enable_feature_a = true;
|
||||
number_option = 4;
|
||||
another_field = "hello";
|
||||
size = { # nested fields work as well
|
||||
top = 10;
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Details of toLuaObject {#sec-details-of-toluaobject}
|
||||
|
||||
As you've seen above, `toLuaObject` is used to convert our nix attrSet
|
||||
`cfg.setupOpts`, into a lua table. Here are some rules of the conversion:
|
||||
|
||||
1. nix `null` converts to lua `nil`
|
||||
2. number and strings convert to their lua counterparts
|
||||
3. nix attrSet/list convert into lua tables
|
||||
4. you can write raw lua code using `lib.generators.mkLuaInline`. This
|
||||
function is part of nixpkgs.
|
||||
|
||||
Example:
|
||||
|
||||
```nix
|
||||
vim.your-plugin.setupOpts = {
|
||||
on_init = lib.generators.mkLuaInline ''
|
||||
function()
|
||||
print('we can write lua!')
|
||||
end
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
# Getting Started {#sec-contrib-getting-started}
|
||||
|
||||
You naturally would like to start by forking the repository. If you are new to git, have a look at GitHub's
|
||||
[Fork a repo guide](https://help.github.com/articles/fork-a-repo/) for instructions on how you can do this. Once you have a fork of neovim-flake
|
||||
you should create a branch starting at the most recent `main` branch.
|
||||
Give your branch a reasonably descriptive name, suffixed by its type - i.e `feature/debugger` or `fix/pesky-bug`.
|
||||
You, naturally, would like to start by forking the repository to get started. If
|
||||
you are new to Git and GitHub, do have a look at GitHub's [Fork a repo guide](https://help.github.com/articles/fork-a-repo/)
|
||||
for instructions on how you can do this. Once you have a fork of **nvf**, you
|
||||
should create a separate branch based on the msot recent `main` branch. Give
|
||||
your branch a reasonably descriptive name (e.g. `feature/debugger` or
|
||||
`fix/pesky-bug`) and you are ready to work on your changes
|
||||
|
||||
Implement your changes and commit them to the newly created branch and when you are happy with the result and positive
|
||||
that it fulfills [Guidelines](#sec-guidelines). Once you are confident everything is in order, push the branch to GitHub and
|
||||
[create a pull request](https://help.github.com/articles/creating-a-pull-request), following the template that you will be prompted to fill.
|
||||
Implement your changes and commit them to the newly created branch and when you
|
||||
are happy with the result, and positive that it fullfills our [Contributing
|
||||
Guidelines](#sec-guidelines), push the branch to GitHub and [create a pull
|
||||
request](https://help.github.com/articles/creating-a-pull-request). The default
|
||||
pull request template available on the **nvf** repository will guide you through
|
||||
the rest of the process, and we'll gently nudge you in the correct direction if
|
||||
there are any mistakes.
|
||||
|
|
|
@ -1,55 +1,65 @@
|
|||
# Guidelines {#sec-guidelines}
|
||||
|
||||
If your contribution tightly follows the guidelines, then there is a good chance it will be merged without too much
|
||||
trouble. Some of the guidelines will be strictly enforced, others will remain as gentle nudges towards the correct
|
||||
direction. As we have no automated system enforcing those guidelines, please try to double check your changes before
|
||||
making your pull request in order to avoid "faulty" code slipping by.
|
||||
If your contribution tightly follows the guidelines, then there is a good chance
|
||||
it will be merged without too much trouble. Some of the guidelines will be
|
||||
strictly enforced, others will remain as gentle nudges towards the correct
|
||||
direction. As we have no automated system enforcing those guidelines, please
|
||||
try to double check your changes before making your pull request in order to
|
||||
avoid "faulty" code slipping by.
|
||||
|
||||
If you are uncertain how these rules affect the change you would like to make then feel free to start a
|
||||
discussion in the [discussions tab](https://github.com/NotAShelf/neovim-flake/discussions) ideally (but not necessarily)
|
||||
before you start developing.
|
||||
If you are uncertain how these rules affect the change you would like to make
|
||||
then feel free to start a discussion in the [discussions tab](https://github.com/NotAShelf/nvf/discussions)
|
||||
ideally (but not necessarily) before you start developing.
|
||||
|
||||
## Adding Documentation {#sec-guidelines-documentation}
|
||||
|
||||
Most, if not all, changes warrant changes to the documentation. Module options should be documented with
|
||||
[Nixpkgs-flavoured Markdown](https://nixos.org/manual/nixpkgs/unstable/#sec-contributing-markup), albeit with exceptions.
|
||||
|
||||
:::{.note}
|
||||
|
||||
As of v0.5, neovim-flake is itself documented using full markdown in both module options and the manual. With
|
||||
v0.6, this manual has also been converted to markdown in full.
|
||||
Most, if not all, changes warrant changes to the documentation. Module options
|
||||
should be documented with [Nixpkgs-flavoured Markdown](https://nixos.org/manual/nixpkgs/unstable/#sec-contributing-markup),
|
||||
albeit with exceptions.
|
||||
|
||||
::: {.note}
|
||||
As of **v0.5**, **vf** is itself documented using full markdown in both module
|
||||
options and the manual. With **v0.6**, this manual has also been converted to
|
||||
markdown in full.
|
||||
:::
|
||||
|
||||
The HTML version of this manual containing both the module option descriptions and the documentation of neovim-flake
|
||||
(such as this page) can be generated and opened by typing the following in a shell within a clone of the
|
||||
neovim-flake Git repository:
|
||||
The HTML version of this manual containing both the module option descriptions
|
||||
and the documentation of **nvf** (such as this page) can be generated and
|
||||
opened by typing the following in a shell within a clone of the **nvf** Git
|
||||
repository:
|
||||
|
||||
```console
|
||||
$ nix build .#docs-html
|
||||
$ xdg-open $PWD/result/share/doc/neovim-flake/index.html
|
||||
$ xdg-open $PWD/result/share/doc/nvf/index.html
|
||||
```
|
||||
|
||||
## Formatting Code {#sec-guidelines-formatting}
|
||||
|
||||
Make sure your code is formatted as described in [code-style section](#sec-guidelines-code-style). To maintain consistency throughout
|
||||
the project you are encouraged to browse through existing code and adopt its style also in new code.
|
||||
Make sure your code is formatted as described in [code-style
|
||||
section](#sec-guidelines-code-style). To maintain consistency throughout the
|
||||
project you are encouraged to browse through existing code and adopt its style
|
||||
also in new code.
|
||||
|
||||
## Formatting Commits {#sec-guidelines-commit-message-style}
|
||||
|
||||
Similar to [code style guidelines](#sec-guidelines-code-style) we encourage a consistent commit message format as described
|
||||
in [commit style guidelines](#sec-guidelines-commit-style).
|
||||
Similar to [code style guidelines](#sec-guidelines-code-style) we encourage a
|
||||
consistent commit message format as described in [commit style
|
||||
guidelines](#sec-guidelines-commit-style).
|
||||
|
||||
## Commit Style {#sec-guidelines-commit-style}
|
||||
|
||||
The commits in your pull request should be reasonably self-contained. Which means each and every commit in
|
||||
a pull request should make sense both on its own and in general context. That is, a second commit should not resolve
|
||||
an issue that is introduced in an earlier commit. In particular, you will be asked to amend any commit that
|
||||
introduces syntax errors or similar problems even if they are fixed in a later commit.
|
||||
The commits in your pull request should be reasonably self-contained. Which
|
||||
means each and every commit in a pull request should make sense both on its
|
||||
own and in general context. That is, a second commit should not resolve an
|
||||
issue that is introduced in an earlier commit. In particular, you will be
|
||||
asked to amend any commit that introduces syntax errors or similar problems
|
||||
even if they are fixed in a later commit.
|
||||
|
||||
The commit messages should follow the [seven rules](https://chris.beams.io/posts/git-commit/#seven-rule),
|
||||
except for "Capitalize the subject line". We also ask you to include the affected code component or module in
|
||||
the first line. A commit message ideally, but not necessarily, follow the given template from home-manager's own documentation
|
||||
The commit messages should follow the [seven
|
||||
rules](https://chris.beams.io/posts/git-commit/#seven-rule), except for
|
||||
"Capitalize the subject line". We also ask you to include the affected code
|
||||
component or module in the first line. A commit message ideally, but not
|
||||
necessarily, follow the given template from home-manager's own documentation
|
||||
|
||||
```
|
||||
{component}: {description}
|
||||
|
@ -57,47 +67,63 @@ the first line. A commit message ideally, but not necessarily, follow the given
|
|||
{long description}
|
||||
```
|
||||
|
||||
where `{component}` refers to the code component (or module) your change affects, `{description}` is a very brief
|
||||
description of your change, and `{long description}` is an optional clarifying description. As a rare exception, if
|
||||
there is no clear component, or your change affects many components, then the `{component}` part is optional.
|
||||
See [example commit message](#sec-guidelines-ex-commit-message) for a commit message that fulfills these requirements.
|
||||
where `{component}` refers to the code component (or module) your change
|
||||
affects, `{description}` is a very brief description of your change, and
|
||||
`{long description}` is an optional clarifying description. As a rare
|
||||
exception, if there is no clear component, or your change affects many
|
||||
components, then the `{component}` part is optional. See [example commit
|
||||
message](#sec-guidelines-ex-commit-message) for a commit message that
|
||||
fulfills these requirements.
|
||||
|
||||
## Example Commit {#sec-guidelines-ex-commit-message}
|
||||
|
||||
The commit [69f8e47e9e74c8d3d060ca22e18246b7f7d988ef](https://github.com/nix-community/home-manager/commit/69f8e47e9e74c8d3d060ca22e18246b7f7d988ef) contains the commit message
|
||||
The commit [69f8e47e9e74c8d3d060ca22e18246b7f7d988ef](https://github.com/nix-community/home-manager/commit/69f8e47e9e74c8d3d060ca22e18246b7f7d988ef)
|
||||
in home-manager contains the following commit message.
|
||||
|
||||
```
|
||||
|
||||
starship: allow running in Emacs if vterm is used
|
||||
|
||||
The vterm buffer is backed by libvterm and can handle Starship prompts
|
||||
without issues.
|
||||
|
||||
```
|
||||
|
||||
Long description can be ommitted if the change is too simple to warrant it. A minor fix in spelling or a formatting
|
||||
change does not warrant long description, however, a module addition or removal does as you would like to provide the
|
||||
relevant context for your changes.
|
||||
Similarly, if you are contributing to **nvf**, you would include the scope of
|
||||
the commit followed by the description:
|
||||
|
||||
Finally, when adding a new module, say `modules/foo.nix`, we use the fixed commit format `foo: add module`.
|
||||
You can, of course, still include a long description if you wish.
|
||||
```
|
||||
languages/ruby: init module
|
||||
|
||||
In case of nested modules, i.e `modules/languages/java.nix` you are recommended to contain the parent as well - for
|
||||
example `languages/java: some major change`.
|
||||
Adds a language module for Ruby, adds appropriate formatters and Treesitter grammers
|
||||
```
|
||||
|
||||
Long description can be ommitted if the change is too simple to warrant it. A
|
||||
minor fix in spelling or a formatting change does not warrant long description,
|
||||
however, a module addition or removal does as you would like to provide the
|
||||
relevant context, i.e. the reasoning behind it, for your commit.
|
||||
|
||||
Finally, when adding a new module, say `modules/foo.nix`, we use the fixed
|
||||
commit format `foo: add module`. You can, of course, still include a long
|
||||
description if you wish.
|
||||
|
||||
In case of nested modules, i.e `modules/languages/java.nix` you are recommended
|
||||
to contain the parent as well - for example `languages/java: some major change`.
|
||||
|
||||
## Code Style {#sec-guidelines-code-style}
|
||||
|
||||
**Treewide**
|
||||
Keep lines at a reasonable width, ideally 80 characters or less. This also applies to string literals and module
|
||||
descriptions and documentation.
|
||||
### Treewide {#sec-code-style-treewide}
|
||||
|
||||
**Nix**
|
||||
neovim-flake is formatted by the [alejandra](https://github.com/kamadorueda/alejandra) tool and the formatting is checked in the pull
|
||||
request and push workflows. Run the `nix fmt` command inside the project repository before submitting your
|
||||
pull request.
|
||||
Keep lines at a reasonable width, ideally 80 characters or less. This also applies
|
||||
to string literals and module descriptions and documentation.
|
||||
|
||||
While Alejandra is mostly opinionated on how code looks after formatting, certain changes are done at the
|
||||
user's discretion based on how the original code was structured.
|
||||
### Nix {#sec-code-style-nix}
|
||||
|
||||
**nvf** is formatted by the [alejandra](https://github.com/kamadorueda/alejandra)
|
||||
tool and the formatting is checked in the pull request and push workflows. Run the
|
||||
`nix fmt` command inside the project repository before submitting your pull request.
|
||||
|
||||
While Alejandra is mostly opinionated on how code looks after formatting,
|
||||
certain changes are done at the user's discretion based on how the original
|
||||
code was structured.
|
||||
|
||||
Please use one line code for attribute sets that contain only one subset.
|
||||
For example:
|
||||
|
@ -120,8 +146,8 @@ module = {
|
|||
}
|
||||
```
|
||||
|
||||
If you move a line down after the merge operator, Alejandra will automatically unfold the whole merged attrset
|
||||
for you, which we **do not** want.
|
||||
If you move a line down after the merge operator, Alejandra will automatically
|
||||
unfold the whole merged attrset for you, which we **do not** want.
|
||||
|
||||
```nix
|
||||
module = {
|
||||
|
@ -131,13 +157,12 @@ module = {
|
|||
}
|
||||
```
|
||||
|
||||
For lists, it is mostly up to your own discretion how you want to format them, but please try to unfold lists if
|
||||
they contain multiple items and especially if they are to include comments.
|
||||
For lists, it is mostly up to your own discretion how you want to format them,
|
||||
but please try to unfold lists if they contain multiple items and especially
|
||||
if they are to include comments.
|
||||
|
||||
```nix
|
||||
|
||||
# this is ok
|
||||
|
||||
acceptableList = [
|
||||
item1 # comment
|
||||
item2
|
||||
|
@ -149,10 +174,12 @@ acceptableList = [
|
|||
listToBeAvoided = [item1 item2 /* comment */ item3 item4];
|
||||
|
||||
# this is ok
|
||||
acceptableList = [item1];
|
||||
acceptableList = [item1 item2];
|
||||
|
||||
# this is not ok
|
||||
listToBeAvoided = [
|
||||
# this is also ok if the list is expected to contain more elements
|
||||
acceptableList= [
|
||||
item1
|
||||
item2
|
||||
# more items if needed...
|
||||
];
|
||||
```
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
# Keybinds {#sec-keybinds}
|
||||
|
||||
As of 0.4, there exists an API for writing your own keybinds and a couple of useful utility functions are available in
|
||||
the [extended standard library](https://github.com/NotAShelf/neovim-flake/tree/main/lib). The following section contains
|
||||
a general overview to how you may utilize said functions.
|
||||
As of 0.4, there exists an API for writing your own keybinds and a couple of
|
||||
useful utility functions are available in the [extended standard
|
||||
library](https://github.com/NotAShelf/nvf/tree/main/lib). The following
|
||||
section contains a general overview to how you may utilize said functions.
|
||||
|
||||
## Custom Key Mappings Support for a Plugin {#sec-custom-key-mappings}
|
||||
|
||||
|
@ -36,44 +37,58 @@ An example, simple keybinding, can look like this:
|
|||
```
|
||||
|
||||
There are many settings available in the options. Please refer to the
|
||||
[documentation](https://notashelf.github.io/neovim-flake/options.html#opt-vim.maps.command._name_.action)
|
||||
[documentation](https://notashelf.github.io/nvf/options.html#opt-vim.maps.command._name_.action)
|
||||
to see a list of them.
|
||||
|
||||
`neovim-flake` provides a list of helper commands, so that you don't have to write the mapping attribute sets every
|
||||
time:
|
||||
**nvf** provides a list of helper commands, so that you don't have to write the
|
||||
mapping attribute sets every time:
|
||||
|
||||
- `mkBinding = key: action: desc:` - makes a basic binding, with `silent` set to true.
|
||||
- `mkExprBinding = key: action: desc:` - makes an expression binding, with `lua`, `silent`, and `expr` set to true.
|
||||
- `mkLuaBinding = key: action: desc:` - makes an expression binding, with `lua`, and `silent` set to true.
|
||||
- `mkBinding = key: action: desc:` - makes a basic binding, with `silent` set
|
||||
to true.
|
||||
- `mkExprBinding = key: action: desc:` - makes an expression binding, with
|
||||
`lua`, `silent`, and `expr` set to true.
|
||||
- `mkLuaBinding = key: action: desc:` - makes an expression binding, with
|
||||
`lua`, and `silent` set to true.
|
||||
|
||||
Note that the Lua in these bindings is actual Lua, not pasted into a `:lua` command.
|
||||
Therefore, you either pass in a function like `require('someplugin').some_function`, without actually calling it,
|
||||
or you define your own function, like `function() require('someplugin').some_function() end`.
|
||||
Do note that the Lua in these bindings is actual Lua, and not pasted into a
|
||||
`:lua` command. Therefore, you should either pass in a function like
|
||||
`require('someplugin').some_function`, without actually calling it, or you
|
||||
should define your own functions, for example
|
||||
|
||||
Additionally, to not have to repeat the descriptions, there's another utility function with its own set of functions:
|
||||
```lua
|
||||
function()
|
||||
require('someplugin').some_function()
|
||||
end
|
||||
```
|
||||
|
||||
Utility function that takes two attrsets:
|
||||
Additionally, to not have to repeat the descriptions, there's another utility
|
||||
function with its own set of functions: Utility function that takes two
|
||||
attribute sets:
|
||||
|
||||
- `{ someKey = "some_value" }`
|
||||
- `{ someKey = { description = "Some Description"; }; }`
|
||||
|
||||
and merges them into `{ someKey = { value = "some_value"; description = "Some Description"; }; }`
|
||||
|
||||
```
|
||||
```nix
|
||||
addDescriptionsToMappings = actualMappings: mappingDefinitions:
|
||||
```
|
||||
|
||||
This function can be used in combination with the same `mkBinding` functions as above, except they only take two
|
||||
arguments - `binding` and `action`, and have different names:
|
||||
This function can be used in combination with the same `mkBinding` functions as
|
||||
above, except they only take two arguments - `binding` and `action`, and have
|
||||
different names:
|
||||
|
||||
- `mkSetBinding = binding: action:` - makes a basic binding, with `silent` set to true.
|
||||
- `mkSetExprBinding = binding: action:` - makes an expression binding, with `lua`, `silent`, and `expr` set to true.
|
||||
- `mkSetLuaBinding = binding: action:` - makes an expression binding, with `lua`, and `silent` set to true.
|
||||
- `mkSetBinding = binding: action:` - makes a basic binding, with `silent`
|
||||
set to true.
|
||||
- `mkSetExprBinding = binding: action:` - makes an expression binding, with
|
||||
`lua`, `silent`, and `expr` set to true.
|
||||
- `mkSetLuaBinding = binding: action:` - makes an expression binding, with
|
||||
`lua`, and `silent` set to true.
|
||||
|
||||
You can read the source code of some modules to see them in action, but their usage should look something like this:
|
||||
You can read the source code of some modules to see them in action, but their
|
||||
usage should look something like this:
|
||||
|
||||
```nix
|
||||
|
||||
# plugindefinition.nix
|
||||
{lib, ...}: with lib; {
|
||||
options.vim.plugin = {
|
||||
|
@ -96,15 +111,13 @@ You can read the source code of some modules to see them in action, but their us
|
|||
|
||||
};
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
```nix
|
||||
|
||||
# config.nix
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
@ -158,9 +171,8 @@ in {
|
|||
|
||||
```
|
||||
|
||||
:::{.note}
|
||||
|
||||
If you have come across a plugin that has an API that doesn't seem to easily allow custom keybindings,
|
||||
don't be scared to implement a draft PR. We'll help you get it done.
|
||||
|
||||
::: {.note}
|
||||
If you have come across a plugin that has an API that doesn't seem to easily
|
||||
allow custom keybindings, don't be scared to implement a draft PR. We'll help
|
||||
you get it done.
|
||||
:::
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
# Testing Changes {#sec-testing-changes}
|
||||
|
||||
Once you have made your changes, you will need to test them throughly. If it is a module, add your module option to
|
||||
`configuration.nix` (located in the root of this project) inside `neovimConfiguration`. Enable it, and then run the
|
||||
maximal configuration with `nix run .#maximal -Lv` to check for build errors. If neovim opens in the current directory
|
||||
without any error messages (you can check the output of `:messages` inside neovim to see if there are any errors), then
|
||||
your changes are good to go. Open your pull request, and it will be reviewed as soon as posssible.
|
||||
Once you have made your changes, you will need to test them throughly. If it is
|
||||
a module, add your module option to `configuration.nix` (located in the root of
|
||||
this project) inside `neovimConfiguration`. Enable it, and then run the maximal
|
||||
configuration with `nix run .#maximal -Lv` to check for build errors. If neovim
|
||||
opens in the current directory without any error messages (you can check the
|
||||
output of `:messages` inside neovim to see if there are any errors), then your
|
||||
changes are good to go. Open your pull request, and it will be reviewed as soon
|
||||
as posssible.
|
||||
|
||||
If it is not a new module, but a change to an existing one, then make sure the module you have changed is enabled in the
|
||||
maximal configuration by editing `configuration.nix`, and then run it with `nix run .#maximal -Lv`. Same procedure as
|
||||
adding a new module will apply here.
|
||||
If it is not a new module, but a change to an existing one, then make sure the
|
||||
module you have changed is enabled in the maximal configuration by editing
|
||||
`configuration.nix`, and then run it with `nix run .#maximal -Lv`. Same procedure
|
||||
as adding a new module will apply here.
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
# Home Manager {#ch-hm-module}
|
||||
|
||||
The Home Manager module allows us to customize the different `vim` options from inside the home-manager configuration
|
||||
and it is the preferred way of configuring neovim-flake, both on NixOS and non-NixOS systems.
|
||||
|
||||
To use it, we first add the input flake.
|
||||
|
||||
```nix
|
||||
{
|
||||
neovim-flake = {
|
||||
url = github:notashelf/neovim-flake;
|
||||
# you can override input nixpkgs
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
# you can also override individual plugins
|
||||
# i.e inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- obsidian nvim needs to be in your inputs
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Followed by importing the home-manager module somewhere in your configuration.
|
||||
|
||||
```nix
|
||||
{
|
||||
# assuming neovim-flake is in your inputs and inputs is in the argset
|
||||
imports = [ inputs.neovim-flake.homeManagerModules.default ];
|
||||
}
|
||||
```
|
||||
|
||||
An example installation for standalone home-manager would look like this:
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
stylix.url = "github:notashelf/neovim-flake";
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, home-manager, neovim-flake ... }: let
|
||||
system = "x86_64-linux"; in {
|
||||
# ↓ this is the home-manager output in the flake schema
|
||||
homeConfigurations."yourUsername»" = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
modules = [
|
||||
neovim-flake.homeManagerModules.default # <- this imports the home-manager module that provides the options
|
||||
./home.nix # your home-manager configuration, probably where you will want to add programs.neovim-flake options
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Once the module is imported, we will be able to define the following options (and much more) from inside the
|
||||
home-manager configuration.
|
||||
|
||||
```nix{
|
||||
programs.neovim-flake = {
|
||||
|
||||
enable = true;
|
||||
# your settings need to go into the settings attribute set
|
||||
# most settings are documented in the appendix
|
||||
settings = {
|
||||
vim.viAlias = false;
|
||||
vim.vimAlias = true;
|
||||
vim.lsp = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
:::{.note}
|
||||
You may find all avaliable options in the [appendix](https://notashelf.github.io/neovim-flake/options)
|
||||
:::
|
11
docs/manual/installation.md
Normal file
11
docs/manual/installation.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Installing nvf {#ch-installation}
|
||||
|
||||
There are multiple ways of installing nvf on your system. You may either choose
|
||||
the standalone installation method, which does not depend on a module system and may
|
||||
be done on any system that has the Nix package manager or the appropriate modules
|
||||
for NixOS and home-manager as described in the [module installation section](#ch-module-installation)
|
||||
|
||||
```{=include=} chapters
|
||||
installation/custom-configuration.md
|
||||
installation/modules.md
|
||||
```
|
19
docs/manual/installation/custom-configuration.md
Normal file
19
docs/manual/installation/custom-configuration.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Standalone Installation {#ch-standalone-installation}
|
||||
|
||||
It is possible to install **nvf** without depending on NixOS or home-manager as the parent
|
||||
module system, using the `neovimConfiguration` function exposed by **nvf** extended library.
|
||||
It takes in the configuration as a module, and returns an attribute set as a result.
|
||||
|
||||
```nix
|
||||
{
|
||||
options = "The options that were available to configure";
|
||||
config = "The outputted configuration";
|
||||
pkgs = "The package set used to evaluate the module";
|
||||
neovim = "The built neovim package";
|
||||
}
|
||||
```
|
||||
|
||||
```{=include=} chapters
|
||||
standalone/nixos.md
|
||||
standalone/home-manager.md
|
||||
```
|
6
docs/manual/installation/modules.md
Normal file
6
docs/manual/installation/modules.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Module Installation {#ch-module-installation}
|
||||
|
||||
```{=include=} chapters
|
||||
modules/nixos.md
|
||||
modules/home-manager.md
|
||||
```
|
83
docs/manual/installation/modules/home-manager.md
Normal file
83
docs/manual/installation/modules/home-manager.md
Normal file
|
@ -0,0 +1,83 @@
|
|||
# Home-Manager Module {#ch-hm-module}
|
||||
|
||||
The home-manager module allows us to customize the different `vim` options from
|
||||
inside the home-manager configuration without having to call for the wrapper
|
||||
yourself. It is the recommended way to use **nvf** alongside the NixOS module
|
||||
depending on your needs.
|
||||
|
||||
To use it, we first add the input flake.
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
obsidian-nvim.url = "github:epwalsh/obsidian.nvim";
|
||||
nvf = {
|
||||
url = "github:notashelf/nvf";
|
||||
# you can override input nixpkgs
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
# you can also override individual plugins
|
||||
# for example:
|
||||
inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Followed by importing the home-manager module somewhere in your configuration.
|
||||
|
||||
```nix
|
||||
{
|
||||
# assuming nvf is in your inputs and inputs is in the argset
|
||||
# see example below
|
||||
imports = [ inputs.nvf.homeManagerModules.default ];
|
||||
}
|
||||
```
|
||||
|
||||
## Example Installation {#sec-example-installation-hm}
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
nvf.url = "github:notashelf/nvf";
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, home-manager, nvf, ... }: let
|
||||
system = "x86_64-linux"; in {
|
||||
# ↓ this is your home output in the flake schema, expected by home-manager
|
||||
"your-username@your-hostname" = home-manager.lib.homeManagerConfiguration
|
||||
modules = [
|
||||
nvf.homeManagerModules.default # <- this imports the home-manager module that provides the options
|
||||
./home.nix # <- your home entrypoint
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Once the module is properly imported by your host, you will be able to use the
|
||||
`programs.nvf` module option anywhere in your configuration in order to
|
||||
configure **nvf**.
|
||||
|
||||
```nix{
|
||||
programs.nvf = {
|
||||
enable = true;
|
||||
# your settings need to go into the settings attribute set
|
||||
# most settings are documented in the appendix
|
||||
settings = {
|
||||
vim.viAlias = false;
|
||||
vim.vimAlias = true;
|
||||
vim.lsp = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
::: {.note}
|
||||
**nvf** exposes a lot of options, most of which are not referenced in the
|
||||
installation sections of the manual. You may find all avaliable options
|
||||
in the [appendix](https://notashelf.github.io/nvf/options)
|
||||
:::
|
82
docs/manual/installation/modules/nixos.md
Normal file
82
docs/manual/installation/modules/nixos.md
Normal file
|
@ -0,0 +1,82 @@
|
|||
# NixOS Module {#ch-nixos-module}
|
||||
|
||||
The NixOS module allows us to customize the different `vim` options from inside
|
||||
the NixOS configuration without having to call for the wrapper yourself. It is
|
||||
the recommended way to use **nvf** alongside the home-manager module depending
|
||||
on your needs.
|
||||
|
||||
To use it, we first add the input flake.
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
obsidian-nvim.url = "github:epwalsh/obsidian.nvim";
|
||||
nvf = {
|
||||
url = "github:notashelf/nvf";
|
||||
# you can override input nixpkgs
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
# you can also override individual plugins
|
||||
# for example:
|
||||
inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Followed by importing the NixOS module somewhere in your configuration.
|
||||
|
||||
```nix
|
||||
{
|
||||
# assuming nvf is in your inputs and inputs is in the argset
|
||||
# see example below
|
||||
imports = [ inputs.nvf.nixosModules.default ];
|
||||
}
|
||||
```
|
||||
|
||||
## Example Installation {#sec-example-installation-nixos}
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nvf.url = "github:notashelf/nvf";
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, nvf, ... }: let
|
||||
system = "x86_64-linux"; in {
|
||||
# ↓ this is your host output in the flake schema
|
||||
nixosConfigurations."yourUsername»" = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
nvf.nixosModules.default # <- this imports the NixOS module that provides the options
|
||||
./configuration.nix # <- your host entrypoint
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Once the module is properly imported by your host, you will be able to use the
|
||||
`programs.nvf` module option anywhere in your configuration in order to
|
||||
configure **nvf**.
|
||||
|
||||
```nix{
|
||||
programs.nvf = {
|
||||
enable = true;
|
||||
# your settings need to go into the settings attribute set
|
||||
# most settings are documented in the appendix
|
||||
settings = {
|
||||
vim.viAlias = false;
|
||||
vim.vimAlias = true;
|
||||
vim.lsp = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
::: {.note}
|
||||
**nvf** exposes a lot of options, most of which are not referenced in the
|
||||
installation sections of the manual. You may find all avaliable options
|
||||
in the [appendix](https://notashelf.github.io/nvf/options)
|
||||
:::
|
56
docs/manual/installation/standalone/home-manager.md
Normal file
56
docs/manual/installation/standalone/home-manager.md
Normal file
|
@ -0,0 +1,56 @@
|
|||
# Standalone Installation on Home-Manager {#ch-standalone-hm}
|
||||
|
||||
Your built Neoevim configuration can be exposed as a flake output to make it
|
||||
easier to share across machines, repositories and so on. Or it can be added to
|
||||
your system packages to make it available across your system.
|
||||
|
||||
The following is an example installation of `nvf` as a standalone package with
|
||||
the default theme enabled. You may use other options inside `config.vim` in
|
||||
`configModule`, but this example will not cover that.
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
nvf.url = "github:notashelf/nvf";
|
||||
};
|
||||
|
||||
outputs = {nixpkgs, home-manager, nvf, ...}: let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
configModule = {
|
||||
# Add any custom options (and do feel free to upstream them!)
|
||||
# options = { ... };
|
||||
|
||||
config.vim = {
|
||||
theme.enable = true;
|
||||
# and more options as you see fit...
|
||||
};
|
||||
};
|
||||
|
||||
customNeovim = nvf.lib.neovimConfiguration {
|
||||
modules = [configModule];
|
||||
inherit pkgs;
|
||||
};
|
||||
in {
|
||||
# this will make the package available as a flake input
|
||||
packages.${system}.my-neovim = customNeovim.neovim;
|
||||
|
||||
# this is an example home-manager configuration
|
||||
# using the built neovim package
|
||||
homeConfigurations = {
|
||||
"your-username@your-hostname" = home-manager.lib.homeManagerConfiguration {
|
||||
# ...
|
||||
modules = [
|
||||
./home.nix
|
||||
|
||||
# this will make wrapped neovim available in your system packages
|
||||
{environment.systemPackages = [customNeovim.neovim];}
|
||||
];
|
||||
# ...
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
55
docs/manual/installation/standalone/nixos.md
Normal file
55
docs/manual/installation/standalone/nixos.md
Normal file
|
@ -0,0 +1,55 @@
|
|||
# Standalone Installation on NixOS {#ch-standalone-nixos}
|
||||
|
||||
Your built Neoevim configuration can be exposed as a flake output to make it
|
||||
easier to share across machines, repositories and so on. Or it can be added to
|
||||
your system packages to make it available across your system.
|
||||
|
||||
The following is an example installation of `nvf` as a standalone package with
|
||||
the default theme enabled. You may use other options inside `config.vim` in
|
||||
`configModule`, but this example will not cover that.
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
nvf.url = "github:notashelf/nvf";
|
||||
};
|
||||
|
||||
outputs = {nixpkgs, nvf, ...}: let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
configModule = {
|
||||
# Add any custom options (and do feel free to upstream them!)
|
||||
# options = { ... };
|
||||
|
||||
config.vim = {
|
||||
theme.enable = true;
|
||||
# and more options as you see fit...
|
||||
};
|
||||
};
|
||||
|
||||
customNeovim = nvf.lib.neovimConfiguration {
|
||||
modules = [configModule];
|
||||
inherit pkgs;
|
||||
};
|
||||
in {
|
||||
# this will make the package available as a flake input
|
||||
packages.${system}.my-neovim = customNeovim.neovim;
|
||||
|
||||
# this is an example nixosConfiguration using the built neovim package
|
||||
nixosConfigurations = {
|
||||
yourHostName = nixpkgs.lib.nixosSystem {
|
||||
# ...
|
||||
modules = [
|
||||
./configuration.nix # or whatever your configuration is
|
||||
|
||||
# this will make wrapped neovim available in your system packages
|
||||
{environment.systemPackages = [customNeovim.neovim];}
|
||||
];
|
||||
# ...
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
|
@ -1,16 +0,0 @@
|
|||
# LSP Custom Packages/Command {#sec-languages-custom-lsp-packages}
|
||||
|
||||
In any of the `opt.languages.<language>.lsp.package` options you can provide your own LSP package, or provide
|
||||
the command to launch the language server, as a list of strings.
|
||||
|
||||
You can use this to skip automatic installation of a language server, and instead
|
||||
use the one found in your `$PATH` during runtime, for example:
|
||||
|
||||
```nix
|
||||
vim.languages.java = {
|
||||
lsp = {
|
||||
enable = true;
|
||||
package = ["jdt-language-server" "-data" "~/.cache/jdtls/workspace"];
|
||||
};
|
||||
}
|
||||
```
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"nix.conf(5)": "https://nixos.org/manual/nix/stable/command-ref/conf-file.html"
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
# neovim-flake-manual {#neovim-flake-manual}
|
||||
# nvf manual {#nvf-manual}
|
||||
|
||||
## Version @VERSION@
|
||||
## Version @NVF_VERSION@
|
||||
|
||||
```{=include=} preface
|
||||
preface.md
|
||||
|
@ -8,12 +8,12 @@ try-it-out.md
|
|||
```
|
||||
|
||||
```{=include=} parts
|
||||
custom-configs.md
|
||||
custom-package.md
|
||||
custom-plugins.md
|
||||
default-configs.md
|
||||
home-manager.md
|
||||
languages.md
|
||||
installation.md
|
||||
configuring.md
|
||||
```
|
||||
|
||||
```{=include=} chapters
|
||||
hacking.md
|
||||
```
|
||||
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
# Neovim Flake Configuration Options {#ch-options}
|
||||
|
||||
Below are the options provided by nvf provided in no particular order.
|
||||
They may include useful comments and warnings, or examples on how a module option
|
||||
is meant to be used.
|
||||
|
||||
```{=include=} options
|
||||
id-prefix: opt-
|
||||
list-id: neovim-flake-options
|
||||
list-id: nvf-options
|
||||
source: @OPTIONS_JSON@
|
||||
```
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Preface {#sec-preface}
|
||||
# Preface {#ch-preface}
|
||||
|
||||
If you noticed a bug caused by neovim-flake then please consider reporting it over
|
||||
[the neovim-flake issue tracker](https://github.com/notashelf/neovim-flake/issues).
|
||||
Bugfixes, feature additions and upstreamed changes are welcome over
|
||||
[the neovim-flake pull requests tab](https://github.com/notashelf/neovim-flake/pulls).
|
||||
If you noticed a bug caused by **nvf** then please consider reporting it over
|
||||
[the issue tracker](https://github.com/notashelf/nvf/issues).
|
||||
|
||||
Bugfixes, feature additions and upstreamed changes from your local configurations
|
||||
are always welcome in the [the pull requests tab](https://github.com/notashelf/nvf/pulls).
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Try it out {#ch-try-it-out}
|
||||
|
||||
Thanks to the portability of Nix, you can try out neovim-flake without actually installing it to your machine.
|
||||
Thanks to the portability of Nix, you can try out nvf without actually installing it to your machine.
|
||||
Below are the commands you may run to try out different configurations provided by this flake. As of v0.5, three
|
||||
configurations are provided:
|
||||
|
||||
|
@ -11,21 +11,19 @@ configurations are provided:
|
|||
You may try out any of the provided configurations using the `nix run` command on a system where Nix is installed.
|
||||
|
||||
```console
|
||||
$ cachix use neovim-flake # Optional: it'll save you CPU resources and time
|
||||
$ nix run github:notashelf/neovim-flake#nix # will run the default minimal configuration
|
||||
$ cachix use nvf # Optional: it'll save you CPU resources and time
|
||||
$ nix run github:notashelf/nvf#nix # will run the default minimal configuration
|
||||
```
|
||||
|
||||
Do keep in mind that this is **susceptible to garbage collection** meaning it will be removed from your Nix store
|
||||
once you garbage collect. If you wish to install neovim-flake, please take a look at
|
||||
[custom-configuration](#ch-custom-configuration) or [home-manager](#ch-hm-module) sections for installation
|
||||
instructions.
|
||||
once you garbage collect.
|
||||
|
||||
## Using Prebuilt Configs {#sec-using-prebuild-configs}
|
||||
|
||||
```console
|
||||
$ nix run github:notashelf/neovim-flake#nix
|
||||
$ nix run github:notashelf/neovim-flake#tidal
|
||||
$ nix run github:notashelf/neovim-flake#maximal
|
||||
$ nix run github:notashelf/nvf#nix
|
||||
$ nix run github:notashelf/nvf#tidal
|
||||
$ nix run github:notashelf/nvf#maximal
|
||||
```
|
||||
|
||||
### Available Configs {#sec-available-configs}
|
||||
|
@ -33,7 +31,7 @@ $ nix run github:notashelf/neovim-flake#maximal
|
|||
#### Nix {#sec-configs-nix}
|
||||
|
||||
`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}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Release Notes {#ch-release-notes}
|
||||
|
||||
This section lists the release notes for tagged version of neovim-flake and current main.
|
||||
This section lists the release notes for tagged version of **nvf** and
|
||||
the current main current main branch
|
||||
|
||||
```{=include=} chapters
|
||||
rl-0.1.md
|
||||
|
|
|
@ -2,53 +2,157 @@
|
|||
|
||||
Release notes for release 0.6
|
||||
|
||||
## Breaking Changes and Migration Guide {#sec-breaking-changes-and-migration-guide}
|
||||
|
||||
In v0.6 we are introducing `setupOpts`: many plugin related options are moved into their respective `setupOpts`
|
||||
submodule, e.g. `nvimTree.disableNetrw` is renamed to `nvimTree.setupOpts.disable_netrw`.
|
||||
|
||||
_Why?_ in short, you can now pass in anything to setupOpts and it will be passed to your `require'plugin'.setup{...}`.
|
||||
No need to wait for us to support every single plugin option.
|
||||
|
||||
The warnings when you rebuild your config should be enough to guide you through what you need to do, if there's an
|
||||
option that was renamed but wasn't listed in the warning, please file a bug report!
|
||||
|
||||
To make your migration process less annoying, here's a keybind that will help you with renaming stuff from camelCase to
|
||||
snake_case (you'll be doing that a lot):
|
||||
|
||||
```lua
|
||||
-- paste this in a temp.lua file and load it in vim with :source /path/to/temp.lua
|
||||
function camelToSnake()
|
||||
-- Get the current word under the cursor
|
||||
local word = vim.fn.expand("<cword>")
|
||||
-- Replace each capital letter with an underscore followed by its lowercase equivalent
|
||||
local snakeCase = string.gsub(word, "%u", function(match)
|
||||
return "_" .. string.lower(match)
|
||||
end)
|
||||
-- Remove the leading underscore if present
|
||||
if string.sub(snakeCase, 1, 1) == "_" then
|
||||
snakeCase = string.sub(snakeCase, 2)
|
||||
end
|
||||
vim.fn.setreg(vim.v.register, snakeCase)
|
||||
-- Select the word under the cursor and paste
|
||||
vim.cmd("normal! viwP")
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap = true, silent = true })
|
||||
```
|
||||
|
||||
## Changelog {#sec-release-0.6-changelog}
|
||||
|
||||
[ksonj](https://github.com/ksonj):
|
||||
|
||||
- Add Terraform language support
|
||||
- Added Terraform language support.
|
||||
|
||||
[horriblename](https://github.com/horriblename):
|
||||
|
||||
- Fixed empty winbar when breadcrumbs are disabled
|
||||
- Added `ChatGPT.nvim`, which can be enabled with [`vim.assistant.chatgpt`](vim.assistant.chatgpt). Do
|
||||
keep in mind that this option requires `OPENAI_API_KEY` environment variable to be set.
|
||||
|
||||
[donnerinoern](https://github.com/donnerinoern):
|
||||
|
||||
- Added Gruvbox theme
|
||||
- Added Gruvbox theme.
|
||||
|
||||
- Added marksman LSP for Markdown
|
||||
- Added marksman LSP for Markdown.
|
||||
|
||||
- Fixed markdown preview with Glow not working and added an option for changing the preview keybind
|
||||
- Fixed markdown preview with Glow not working and added an option for changing the preview keybind.
|
||||
|
||||
- colorizer.nvim: switched to a maintained fork
|
||||
- colorizer.nvim: switched to a maintained fork.
|
||||
|
||||
- Added `markdown-preview.nvim`, moved `glow.nvim` to a brand new `vim.utility.preview` category.
|
||||
|
||||
[elijahimmer](https://github.com/elijahimmer)
|
||||
|
||||
- Added rose-pine theme.
|
||||
|
||||
[jacekpoz](https://github.com/jacekpoz):
|
||||
|
||||
- Added `vim.autocomplete.alwaysComplete`. Allows users to have the autocomplete window popup only when manually activated.
|
||||
|
||||
[horriblename](https://github.com/horriblename):
|
||||
|
||||
- Fixed empty winbar when breadcrumbs are disabled.
|
||||
|
||||
- Added custom `setupOpts` for various plugins.
|
||||
|
||||
- Removed support for deprecated plugin "nvim-compe".
|
||||
|
||||
- Moved most plugins to `setupOpts` method.
|
||||
|
||||
[frothymarrow](https://github.com/frothymarrow):
|
||||
|
||||
- Added option `vim.luaPackages` to wrap neovim with extra Lua packages.
|
||||
|
||||
- Rewrote the entire `fidget.nvim` module to include extensive configuration options. Option `vim.fidget-nvim.align.bottom` has
|
||||
been removed in favor of [vim.fidget-nvim.notification.window.align](vim.fidget-nvim.notification.window.align), which now supports
|
||||
`top` and `bottom` values. `vim.fidget-nvim.align.right` has no longer any equivalent and also has been removed.
|
||||
|
||||
- `which-key.nvim` categories can now be customized through [vim.binds.whichKey.register](vim.binds.whichKey.register)
|
||||
|
||||
- Added `magick` to `vim.luaPackages` for `image.nvim`.
|
||||
|
||||
- Added `alejandra` to the default devShell.
|
||||
|
||||
- Migrated neovim-flake to `makeNeovimUnstable` wrapper.
|
||||
|
||||
[notashelf](https://github.com/notashelf):
|
||||
|
||||
- Finished moving to `nixosOptionsDoc` in the documentation and changelog. We are fully free of asciidoc now
|
||||
- Finished moving to `nixosOptionsDoc` in the documentation and changelog. All documentation options
|
||||
and files are fully free of Asciidoc, and will now use Nixpkgs flavored markdown.
|
||||
|
||||
- Bumped plugin inputs to their latest versions
|
||||
- Bumped plugin inputs to their latest versions.
|
||||
|
||||
- Deprecated `presence.nvim` in favor of `neocord`. This means `vim.rich-presence.presence-nvim` is removed and will throw
|
||||
a warning if used. You are recommended to rewrite your neocord config from scratch based on the
|
||||
a warning if used. You are recommended to rewrite your neocord configuration from scratch based on the.
|
||||
[official documentation](https://github.com/IogaMaster/neocord)
|
||||
|
||||
- Removed Tabnine plugin due to the usage of imperative tarball downloads. If you'd like to see it back, please create an issue.
|
||||
|
||||
- Added support for css and tailwindcss through vscode-language-servers-extracted & tailwind-language-server.
|
||||
Those can be enabled through `vim.languages.css` and `vim.languages.tailwind`
|
||||
Those can be enabled through `vim.languages.css` and `vim.languages.tailwind`.
|
||||
|
||||
- Lualine module now allows customizing `always_divide_middle`, `ignore_focus` and `disabled_filetypes` through the new
|
||||
options: [vim.statusline.lualine.alwaysDivideMiddle](vim.statusline.lualine.alwaysDivideMiddle),
|
||||
[vim.statusline.lualine.ignoreFocus](vim.statusline.lualine.ignoreFocus) and
|
||||
[vim.statusline.lualine.disabledFiletypes](vim.statusline.lualine.disabledFiletypes)
|
||||
[vim.statusline.lualine.disabledFiletypes](vim.statusline.lualine.disabledFiletypes).
|
||||
|
||||
- Updated all plugin inputs to their latest versions (26.01.2024) - this brought minor color changess to the Catppuccin
|
||||
theme
|
||||
- Updated all plugin inputs to their latest versions (**21.04.2024**) - this brought minor color changes to the Catppuccin
|
||||
theme.
|
||||
|
||||
[elijahimmer](https://github.com/elijahimmer)
|
||||
- Moved home-manager module entrypoint to `flake/modules` and added an experimental Nixos module. This requires further testing
|
||||
before it can be considered ready for use.
|
||||
|
||||
- Added rose-pine theme
|
||||
- Made lib calls explicit. E.g. `lib.strings.optionalString` instead of `lib.optionalString`. This is a pattern expected
|
||||
to be followed by all contributors in the future.
|
||||
|
||||
[frothymarrow](https://github.com/frothymarrow)
|
||||
- Added `image.nvim` for image previews.
|
||||
|
||||
- Added option `vim.luaPackages` to wrap neovim with extra Lua packages.
|
||||
- The final neovim package is now exposed. This means you can build the neovim package that will be added to your
|
||||
package list without rebuilding your system to test if your configuration yields a broken package.
|
||||
|
||||
- Changed the tree structure to distinguish between core options and plugin options.
|
||||
|
||||
- Added plugin auto-discovery from plugin inputs. This is mostly from
|
||||
[JordanIsaac's neovim-flake](https://github.com/jordanisaacs/neovim-flake). Allows contributors to add plugin inputs
|
||||
with the `plugin-` prefix to have them automatically discovered for the `plugin` type in `lib/types`.
|
||||
|
||||
- Moved internal `wrapLuaConfig` to the extended library, structured its arguments to take `luaBefore`, `luaConfig`
|
||||
and `luaAfter` as strings, which are then concatted inside a lua block.
|
||||
|
||||
- Added [`vim.luaConfigBefore`](vim.luaConfigBefore) and [`vim.luaConfigAfter`](vim.luaConfigAfter)
|
||||
for inserting verbatim Lua configuration before and after the resolved Lua DAG respectively. Both of those options
|
||||
take strings as the type, so you may read the contents of a Lua file from a given path.
|
||||
|
||||
- Added [`vim.spellChecking.ignoredFiletypes`](vim.spellChecking.ignoredFiletypes)
|
||||
and [`vim.spellChecking.programmingWordlist.enable`](vim.spellChecking.programmingWordlist.enable) for ignoring certain filetypes
|
||||
in spellchecking and enabling `vim-dirtytalk` respectively. The previously used `vim.spellcheck.vim-dirtytalk` aliases to the latter
|
||||
option.
|
||||
|
||||
- Exposed `withRuby`, `withNodeJs`, `withPython3`, and `python3Packages` from the `makeNeovimConfig` function under their respective options.
|
||||
|
||||
- Added [`vim.extraPackages`](vim.extraPackages) for appending additional packages to the wrapper PATH, making said packages available
|
||||
while inside the Neovim session.
|
||||
|
||||
- Made treesitter options configurable, and moved `treesitter-context to
|
||||
`setupOpts` while it is enabled.
|
||||
|
||||
- Added `vim.notify.nvim-notify.setupOpts.render` which takes either a string of enum or
|
||||
a lua function. The default is "compact", but you may change it according to
|
||||
nvim-notify documentation.
|
||||
|
|
830
docs/static/style.css
vendored
Normal file
830
docs/static/style.css
vendored
Normal file
|
@ -0,0 +1,830 @@
|
|||
:root {
|
||||
--nmd-color0: #0a3e68;
|
||||
--nmd-color1: #268598;
|
||||
--nmd-color2: #b8d09e;
|
||||
--nmd-color3: #f6cf5e;
|
||||
--nmd-color4: #ec733b;
|
||||
--nmd-color-info: #167cb9;
|
||||
--nmd-color-warn: #ff6700;
|
||||
}
|
||||
html {
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
html:focus-within {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
body {
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-moz-text-size-adjust: 100%;
|
||||
text-size-adjust: 100%;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
min-height: 100vh;
|
||||
position: relative;
|
||||
text-rendering: optimizeSpeed;
|
||||
width: 100%;
|
||||
}
|
||||
*,
|
||||
:after,
|
||||
:before {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
a:not([class]) {
|
||||
-webkit-text-decoration-skip: ink;
|
||||
text-decoration-skip-ink: auto;
|
||||
}
|
||||
a,
|
||||
abbr,
|
||||
acronym,
|
||||
address,
|
||||
applet,
|
||||
article,
|
||||
aside,
|
||||
audio,
|
||||
b,
|
||||
big,
|
||||
blockquote,
|
||||
body,
|
||||
canvas,
|
||||
caption,
|
||||
center,
|
||||
cite,
|
||||
code,
|
||||
dd,
|
||||
del,
|
||||
details,
|
||||
dfn,
|
||||
div,
|
||||
dl,
|
||||
dt,
|
||||
em,
|
||||
embed,
|
||||
fieldset,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
form,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
header,
|
||||
hgroup,
|
||||
html,
|
||||
i,
|
||||
iframe,
|
||||
img,
|
||||
ins,
|
||||
kbd,
|
||||
label,
|
||||
legend,
|
||||
li,
|
||||
mark,
|
||||
menu,
|
||||
nav,
|
||||
object,
|
||||
ol,
|
||||
output,
|
||||
p,
|
||||
pre,
|
||||
q,
|
||||
ruby,
|
||||
s,
|
||||
samp,
|
||||
section,
|
||||
small,
|
||||
span,
|
||||
strike,
|
||||
strong,
|
||||
sub,
|
||||
summary,
|
||||
sup,
|
||||
table,
|
||||
tbody,
|
||||
td,
|
||||
tfoot,
|
||||
th,
|
||||
thead,
|
||||
time,
|
||||
tr,
|
||||
tt,
|
||||
u,
|
||||
ul,
|
||||
var,
|
||||
video {
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
:focus {
|
||||
outline: 0;
|
||||
}
|
||||
article,
|
||||
aside,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
main,
|
||||
menu,
|
||||
nav,
|
||||
section {
|
||||
display: block;
|
||||
}
|
||||
ol,
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
blockquote,
|
||||
q {
|
||||
quotes: none;
|
||||
}
|
||||
blockquote:after,
|
||||
blockquote:before,
|
||||
q:after,
|
||||
q:before {
|
||||
content: "";
|
||||
content: none;
|
||||
}
|
||||
input,
|
||||
input:required {
|
||||
box-shadow: none;
|
||||
}
|
||||
input:-webkit-autofill,
|
||||
input:-webkit-autofill:active,
|
||||
input:-webkit-autofill:focus,
|
||||
input:-webkit-autofill:hover {
|
||||
-webkit-box-shadow: inset 0 0 0 30px #fff;
|
||||
}
|
||||
input[type="search"]::-webkit-search-cancel-button,
|
||||
input[type="search"]::-webkit-search-decoration,
|
||||
input[type="search"]::-webkit-search-results-button,
|
||||
input[type="search"]::-webkit-search-results-decoration {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
}
|
||||
input[type="search"] {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
}
|
||||
input:focus {
|
||||
outline: 0;
|
||||
}
|
||||
audio,
|
||||
canvas,
|
||||
video {
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
}
|
||||
audio:not([controls]) {
|
||||
display: none;
|
||||
height: 0;
|
||||
}
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
||||
a:active,
|
||||
a:hover {
|
||||
outline: 0;
|
||||
}
|
||||
img {
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
img,
|
||||
picture {
|
||||
display: inline-block;
|
||||
}
|
||||
button,
|
||||
input {
|
||||
line-height: normal;
|
||||
}
|
||||
button,
|
||||
html input[type="button"],
|
||||
input[type="reset"],
|
||||
input[type="submit"] {
|
||||
-webkit-appearance: button;
|
||||
background: 0 0;
|
||||
border: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
button[disabled],
|
||||
html input[disabled] {
|
||||
cursor: default;
|
||||
}
|
||||
[disabled] {
|
||||
pointer-events: none;
|
||||
}
|
||||
input[type="checkbox"],
|
||||
input[type="radio"] {
|
||||
padding: 0;
|
||||
}
|
||||
input[type="search"] {
|
||||
-webkit-appearance: textfield;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
input[type="search"]::-webkit-search-cancel-button,
|
||||
input[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
button::-moz-focus-inner,
|
||||
input::-moz-focus-inner {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
button {
|
||||
background: 0 0;
|
||||
border: 0;
|
||||
}
|
||||
textarea {
|
||||
overflow: auto;
|
||||
resize: vertical;
|
||||
vertical-align: top;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
text-indent: 0;
|
||||
}
|
||||
hr {
|
||||
background: #000;
|
||||
border: 0;
|
||||
box-sizing: content-box;
|
||||
height: 1px;
|
||||
line-height: 0;
|
||||
margin: 0;
|
||||
overflow: visible;
|
||||
padding: 0;
|
||||
page-break-after: always;
|
||||
width: 100%;
|
||||
}
|
||||
pre {
|
||||
font-family: monospace, monospace;
|
||||
font-size: 100%;
|
||||
}
|
||||
a {
|
||||
background-color: transparent;
|
||||
}
|
||||
abbr[title] {
|
||||
border-bottom: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
code,
|
||||
kbd,
|
||||
pre,
|
||||
samp {
|
||||
font-family: monospace, monospace;
|
||||
}
|
||||
small,
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
}
|
||||
sub,
|
||||
sup {
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
sub {
|
||||
bottom: -5px;
|
||||
}
|
||||
sup {
|
||||
top: -5px;
|
||||
}
|
||||
button,
|
||||
input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit;
|
||||
font-size: 100%;
|
||||
line-height: 1;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
button,
|
||||
input {
|
||||
overflow: visible;
|
||||
}
|
||||
button,
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
[type="button"],
|
||||
[type="reset"],
|
||||
[type="submit"],
|
||||
button {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
[type="button"]::-moz-focus-inner,
|
||||
[type="reset"]::-moz-focus-inner,
|
||||
[type="submit"]::-moz-focus-inner,
|
||||
button::-moz-focus-inner {
|
||||
border-style: none;
|
||||
outline: 0;
|
||||
padding: 0;
|
||||
}
|
||||
legend {
|
||||
border: 0;
|
||||
color: inherit;
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
white-space: normal;
|
||||
width: 100%;
|
||||
}
|
||||
fieldset {
|
||||
min-width: 0;
|
||||
}
|
||||
body:not(:-moz-handler-blocked) fieldset {
|
||||
display: block;
|
||||
}
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
[type="number"]::-webkit-inner-spin-button,
|
||||
[type="number"]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
[type="search"] {
|
||||
-webkit-appearance: textfield;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button;
|
||||
font: inherit;
|
||||
}
|
||||
summary {
|
||||
display: list-item;
|
||||
}
|
||||
template {
|
||||
display: none;
|
||||
}
|
||||
body {
|
||||
background: white;
|
||||
color: #111827;
|
||||
max-width: min(100ch, 1024px);
|
||||
margin: 0 auto;
|
||||
padding: 10px;
|
||||
font-family: "Lucida Sans", Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 1.4em;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
background: #111827;
|
||||
color: #f9fafb;
|
||||
}
|
||||
}
|
||||
h1,
|
||||
h2,
|
||||
h3 {
|
||||
color: var(--nmd-color0);
|
||||
font-family: "Lato", sans-serif;
|
||||
font-weight: 300;
|
||||
line-height: 1.125;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
h1,
|
||||
h2,
|
||||
h3 {
|
||||
color: var(--nmd-color4);
|
||||
}
|
||||
}
|
||||
h1 {
|
||||
font-size: 48px;
|
||||
font-weight: 300;
|
||||
margin: 4rem 0 1.5rem;
|
||||
}
|
||||
h2 {
|
||||
font-size: 32px;
|
||||
font-weight: 300;
|
||||
margin: 2rem 0 1rem;
|
||||
}
|
||||
h3 {
|
||||
font-size: 20px;
|
||||
font-weight: 400;
|
||||
margin: 0.5rem 0.25rem;
|
||||
}
|
||||
p {
|
||||
margin: 0.9rem 0;
|
||||
}
|
||||
p:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
a {
|
||||
color: var(--nmd-color0);
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 3px;
|
||||
}
|
||||
a:visited {
|
||||
color: var(--nmd-color1);
|
||||
}
|
||||
a:hover {
|
||||
color: var(--nmd-color1);
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
a {
|
||||
color: var(--nmd-color3);
|
||||
}
|
||||
a:visited {
|
||||
color: var(--nmd-color2);
|
||||
}
|
||||
a:hover {
|
||||
color: var(--nmd-color4);
|
||||
}
|
||||
}
|
||||
code {
|
||||
font-size: 90%;
|
||||
}
|
||||
span.command {
|
||||
font-size: 90%;
|
||||
font-family: monospace;
|
||||
}
|
||||
em {
|
||||
font-style: italic;
|
||||
}
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
pre {
|
||||
background: #f9fafb;
|
||||
margin: 2rem 16px;
|
||||
padding: 10px;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 4px;
|
||||
box-shadow: 4px 4px 8px #e5e7eb;
|
||||
font-size: 90%;
|
||||
margin-bottom: 1.5rem;
|
||||
padding: 6px;
|
||||
overflow: auto;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
pre {
|
||||
background: #1f2937;
|
||||
border-color: black;
|
||||
box-shadow: 4px 4px 8px black;
|
||||
}
|
||||
}
|
||||
pre span img {
|
||||
user-select: none;
|
||||
}
|
||||
pre:has(code) {
|
||||
padding: 0;
|
||||
}
|
||||
td,
|
||||
th {
|
||||
padding: 2px 5px;
|
||||
}
|
||||
td:first-child,
|
||||
th:first-child {
|
||||
padding-left: 0;
|
||||
}
|
||||
td:last-child,
|
||||
th:last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
dt {
|
||||
margin: 1.2rem 0 0.8rem;
|
||||
}
|
||||
dd {
|
||||
margin-left: 2rem;
|
||||
}
|
||||
ul {
|
||||
margin: 0.9rem 0;
|
||||
padding-left: 30px;
|
||||
list-style: disc;
|
||||
}
|
||||
ul:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
ul:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
ol {
|
||||
margin: 0.9rem 0;
|
||||
padding-left: 30px;
|
||||
list-style: decimal;
|
||||
}
|
||||
ol:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
ol:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
li {
|
||||
margin: 0.9rem 0;
|
||||
padding-left: 5px;
|
||||
}
|
||||
li:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
li:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.navheader hr,
|
||||
.navfooter hr {
|
||||
margin: 1rem 0;
|
||||
background: #e5e7eb;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.navheader hr,
|
||||
.navfooter hr {
|
||||
background: #4b5563;
|
||||
}
|
||||
}
|
||||
.navheader a,
|
||||
.navfooter a {
|
||||
text-decoration: none;
|
||||
}
|
||||
div.titlepage {
|
||||
margin: 40px 0;
|
||||
}
|
||||
div.titlepage hr {
|
||||
display: none;
|
||||
}
|
||||
div.toc {
|
||||
background: #f9fafb;
|
||||
margin: 2rem 16px;
|
||||
padding: 10px;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 4px;
|
||||
box-shadow: 4px 4px 8px #e5e7eb;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
div.toc {
|
||||
background: #1f2937;
|
||||
border-color: black;
|
||||
box-shadow: 4px 4px 8px black;
|
||||
}
|
||||
}
|
||||
div.toc a {
|
||||
text-decoration: none;
|
||||
}
|
||||
div.note,
|
||||
div.warning {
|
||||
background: #f9fafb;
|
||||
margin: 2rem 16px;
|
||||
padding: 10px;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 4px;
|
||||
box-shadow: 4px 4px 8px #e5e7eb;
|
||||
font-style: italic;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
div.note,
|
||||
div.warning {
|
||||
background: #1f2937;
|
||||
border-color: black;
|
||||
box-shadow: 4px 4px 8px black;
|
||||
}
|
||||
}
|
||||
div.note h3,
|
||||
div.warning h3 {
|
||||
float: right;
|
||||
margin: 0 0 1rem 1rem;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
content: url();
|
||||
}
|
||||
div.note h3 + p,
|
||||
div.warning h3 + p {
|
||||
margin-top: 0;
|
||||
}
|
||||
div.note h3 {
|
||||
background-color: var(--nmd-color-info);
|
||||
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='42' viewBox='0 0 24 24' stroke-width='2' stroke='black' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M12 8h.01'%3E%3C/path%3E%3Cpath d='M11 12h1v4h1'%3E%3C/path%3E%3Cpath d='M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z'%3E%3C/path%3E%3C/svg%3E");
|
||||
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='42' viewBox='0 0 24 24' stroke-width='2' stroke='black' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M12 8h.01'%3E%3C/path%3E%3Cpath d='M11 12h1v4h1'%3E%3C/path%3E%3Cpath d='M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z'%3E%3C/path%3E%3C/svg%3E");
|
||||
}
|
||||
div.warning h3 {
|
||||
background-color: var(--nmd-color-warn);
|
||||
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='42' viewBox='0 0 24 24' stroke-width='2' stroke='black' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M12 9v2m0 4v.01'%3E%3C/path%3E%3Cpath d='M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75'%3E%3C/path%3E%3C/svg%3E");
|
||||
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='42' viewBox='0 0 24 24' stroke-width='2' stroke='black' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M12 9v2m0 4v.01'%3E%3C/path%3E%3Cpath d='M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75'%3E%3C/path%3E%3C/svg%3E");
|
||||
}
|
||||
.term {
|
||||
font-weight: 300;
|
||||
}
|
||||
.docbook .xref img[src^="images\/callouts\/"],
|
||||
.screen img,
|
||||
.programlisting img {
|
||||
width: 1em;
|
||||
}
|
||||
.calloutlist img {
|
||||
width: 1.3em;
|
||||
}
|
||||
.programlisting.language-shell .hljs-meta.prompt_ {
|
||||
user-select: none;
|
||||
} /*!
|
||||
Theme: Tomorrow
|
||||
Author: Chris Kempson (http://chriskempson.com)
|
||||
License: ~ MIT (or more permissive) [via base16-schemes-source]
|
||||
Maintainer: @highlightjs/core-team
|
||||
Version: 2021.09.0
|
||||
*/
|
||||
pre code.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 1em;
|
||||
}
|
||||
code.hljs {
|
||||
padding: 3px 5px;
|
||||
}
|
||||
.hljs {
|
||||
color: #4d4d4c;
|
||||
background: #fff;
|
||||
}
|
||||
.hljs ::selection,
|
||||
.hljs::selection {
|
||||
background-color: #d6d6d6;
|
||||
color: #4d4d4c;
|
||||
}
|
||||
.hljs-comment {
|
||||
color: #8e908c;
|
||||
}
|
||||
.hljs-tag {
|
||||
color: #969896;
|
||||
}
|
||||
.hljs-operator,
|
||||
.hljs-punctuation,
|
||||
.hljs-subst {
|
||||
color: #4d4d4c;
|
||||
}
|
||||
.hljs-operator {
|
||||
opacity: 0.7;
|
||||
}
|
||||
.hljs-bullet,
|
||||
.hljs-deletion,
|
||||
.hljs-name,
|
||||
.hljs-selector-tag,
|
||||
.hljs-template-variable,
|
||||
.hljs-variable {
|
||||
color: #c82829;
|
||||
}
|
||||
.hljs-attr,
|
||||
.hljs-link,
|
||||
.hljs-literal,
|
||||
.hljs-number,
|
||||
.hljs-symbol,
|
||||
.hljs-variable.constant_ {
|
||||
color: #f5871f;
|
||||
}
|
||||
.hljs-class .hljs-title,
|
||||
.hljs-title,
|
||||
.hljs-title.class_ {
|
||||
color: #eab700;
|
||||
}
|
||||
.hljs-strong {
|
||||
font-weight: 700;
|
||||
color: #eab700;
|
||||
}
|
||||
.hljs-addition,
|
||||
.hljs-code,
|
||||
.hljs-string,
|
||||
.hljs-title.class_.inherited__ {
|
||||
color: #718c00;
|
||||
}
|
||||
.hljs-built_in,
|
||||
.hljs-doctag,
|
||||
.hljs-keyword.hljs-atrule,
|
||||
.hljs-quote,
|
||||
.hljs-regexp {
|
||||
color: #3e999f;
|
||||
}
|
||||
.hljs-attribute,
|
||||
.hljs-function .hljs-title,
|
||||
.hljs-section,
|
||||
.hljs-title.function_,
|
||||
.ruby .hljs-property {
|
||||
color: #4271ae;
|
||||
}
|
||||
.diff .hljs-meta,
|
||||
.hljs-keyword,
|
||||
.hljs-template-tag,
|
||||
.hljs-type {
|
||||
color: #8959a8;
|
||||
}
|
||||
.hljs-emphasis {
|
||||
color: #8959a8;
|
||||
font-style: italic;
|
||||
}
|
||||
.hljs-meta,
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-meta .hljs-string {
|
||||
color: #a3685a;
|
||||
}
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-meta-keyword {
|
||||
font-weight: 700;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
/*! Theme: Tomorrow Night Author: Chris Kempson (http://chriskempson.com) License: ~ MIT (or more permissive) [via base16-schemes-source] Maintainer: @highlightjs/core-team Version: 2021.09.0*/
|
||||
pre code.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 1em;
|
||||
}
|
||||
code.hljs {
|
||||
padding: 3px 5px;
|
||||
}
|
||||
.hljs {
|
||||
color: #ccc;
|
||||
background: #2d2d2d;
|
||||
}
|
||||
.hljs ::selection,
|
||||
.hljs::selection {
|
||||
background-color: #515151;
|
||||
color: #ccc;
|
||||
}
|
||||
.hljs-comment {
|
||||
color: #999;
|
||||
}
|
||||
.hljs-tag {
|
||||
color: #b4b7b4;
|
||||
}
|
||||
.hljs-operator,
|
||||
.hljs-punctuation,
|
||||
.hljs-subst {
|
||||
color: #ccc;
|
||||
}
|
||||
.hljs-operator {
|
||||
opacity: 0.7;
|
||||
}
|
||||
.hljs-bullet,
|
||||
.hljs-deletion,
|
||||
.hljs-name,
|
||||
.hljs-selector-tag,
|
||||
.hljs-template-variable,
|
||||
.hljs-variable {
|
||||
color: #f2777a;
|
||||
}
|
||||
.hljs-attr,
|
||||
.hljs-link,
|
||||
.hljs-literal,
|
||||
.hljs-number,
|
||||
.hljs-symbol,
|
||||
.hljs-variable.constant_ {
|
||||
color: #f99157;
|
||||
}
|
||||
.hljs-class .hljs-title,
|
||||
.hljs-title,
|
||||
.hljs-title.class_ {
|
||||
color: #fc6;
|
||||
}
|
||||
.hljs-strong {
|
||||
font-weight: 700;
|
||||
color: #fc6;
|
||||
}
|
||||
.hljs-addition,
|
||||
.hljs-code,
|
||||
.hljs-string,
|
||||
.hljs-title.class_.inherited__ {
|
||||
color: #9c9;
|
||||
}
|
||||
.hljs-built_in,
|
||||
.hljs-doctag,
|
||||
.hljs-keyword.hljs-atrule,
|
||||
.hljs-quote,
|
||||
.hljs-regexp {
|
||||
color: #6cc;
|
||||
}
|
||||
.hljs-attribute,
|
||||
.hljs-function .hljs-title,
|
||||
.hljs-section,
|
||||
.hljs-title.function_,
|
||||
.ruby .hljs-property {
|
||||
color: #69c;
|
||||
}
|
||||
.diff .hljs-meta,
|
||||
.hljs-keyword,
|
||||
.hljs-template-tag,
|
||||
.hljs-type {
|
||||
color: #c9c;
|
||||
}
|
||||
.hljs-emphasis {
|
||||
color: #c9c;
|
||||
font-style: italic;
|
||||
}
|
||||
.hljs-meta,
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-meta .hljs-string {
|
||||
color: #a3685a;
|
||||
}
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-meta-keyword {
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
312
docs/static/style.scss
vendored
Normal file
312
docs/static/style.scss
vendored
Normal file
|
@ -0,0 +1,312 @@
|
|||
:root {
|
||||
--nmd-color0: #0a3e68;
|
||||
--nmd-color1: #268598;
|
||||
--nmd-color2: #b8d09e;
|
||||
--nmd-color3: #f6cf5e;
|
||||
--nmd-color4: #ec733b;
|
||||
|
||||
--nmd-color-info: #167cb9;
|
||||
--nmd-color-warn: #ff6700;
|
||||
}
|
||||
|
||||
// Copied from Tailwind CSS.
|
||||
$color-gray-50: #f9fafb;
|
||||
$color-gray-100: #f3f4f6;
|
||||
$color-gray-200: #e5e7eb;
|
||||
$color-gray-300: #d1d5db;
|
||||
$color-gray-400: #9ca3af;
|
||||
$color-gray-500: #6b7280;
|
||||
$color-gray-600: #4b5563;
|
||||
$color-gray-700: #374151;
|
||||
$color-gray-800: #1f2937;
|
||||
$color-gray-900: #111827;
|
||||
|
||||
$color-blue-50: #eff6ff;
|
||||
$color-blue-100: #dbeafe;
|
||||
$color-blue-200: #bfdbfe;
|
||||
$color-blue-300: #93c5fd;
|
||||
$color-blue-400: #60a5fa;
|
||||
$color-blue-500: #3b82f6;
|
||||
$color-blue-600: #2563eb;
|
||||
$color-blue-700: #1d4ed8;
|
||||
$color-blue-800: #1e40af;
|
||||
$color-blue-900: #1e3a8a;
|
||||
|
||||
@use "scss-reset/reset";
|
||||
|
||||
@mixin boxed {
|
||||
background: $color-gray-50;
|
||||
margin: 2rem 16px;
|
||||
padding: 10px;
|
||||
border: 1px solid $color-gray-200;
|
||||
border-radius: 4px;
|
||||
box-shadow: 4px 4px 8px $color-gray-200;
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
background: $color-gray-800;
|
||||
border-color: black;
|
||||
box-shadow: 4px 4px 8px black;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin margined {
|
||||
margin: 0.9rem 0;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
background: white;
|
||||
color: $color-gray-900;
|
||||
max-width: min(100ch, 1024px);
|
||||
margin: 0 auto;
|
||||
padding: 10px;
|
||||
|
||||
font-family: "Lucida Sans", Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 1.4em;
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
background: $color-gray-900;
|
||||
color: $color-gray-50;
|
||||
}
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3 {
|
||||
color: var(--nmd-color0);
|
||||
font-family: "Lato", sans-serif;
|
||||
font-weight: 300;
|
||||
line-height: 1.125;
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
color: var(--nmd-color4);
|
||||
}
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 48px;
|
||||
font-weight: 300;
|
||||
margin: 4rem 0 1.5rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 32px;
|
||||
font-weight: 300;
|
||||
margin: 2rem 0 1rem;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 20px;
|
||||
font-weight: 400;
|
||||
margin: 0.5rem 0.25rem;
|
||||
}
|
||||
|
||||
p {
|
||||
@include margined;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--nmd-color0); //$color-secondary-1-3;
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 3px;
|
||||
|
||||
&:visited {
|
||||
color: var(--nmd-color1);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: var(--nmd-color1);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
color: var(--nmd-color3);
|
||||
|
||||
&:visited {
|
||||
color: var(--nmd-color2);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: var(--nmd-color4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
code {
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
span.command {
|
||||
font-size: 90%;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
em {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
pre {
|
||||
@include boxed;
|
||||
|
||||
font-size: 90%;
|
||||
margin-bottom: 1.5rem;
|
||||
padding: 6px;
|
||||
overflow: auto;
|
||||
|
||||
// The callout markers should not be selectable.
|
||||
span img {
|
||||
user-select: none;
|
||||
}
|
||||
}
|
||||
|
||||
pre:has(code) {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
td,
|
||||
th {
|
||||
padding: 2px 5px;
|
||||
|
||||
&:first-child {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
dt {
|
||||
margin: 1.2rem 0 0.8rem;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin-left: 2rem;
|
||||
}
|
||||
|
||||
div.book {
|
||||
}
|
||||
|
||||
ul {
|
||||
@include margined;
|
||||
|
||||
padding-left: 30px;
|
||||
list-style: disc;
|
||||
}
|
||||
|
||||
ol {
|
||||
@include margined;
|
||||
|
||||
padding-left: 30px;
|
||||
list-style: decimal;
|
||||
}
|
||||
|
||||
li {
|
||||
@include margined;
|
||||
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.navheader,
|
||||
.navfooter {
|
||||
hr {
|
||||
margin: 1rem 0;
|
||||
background: $color-gray-200;
|
||||
@media (prefers-color-scheme: dark) {
|
||||
background: $color-gray-600;
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
div.titlepage {
|
||||
margin: 40px 0;
|
||||
|
||||
hr {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
div.toc {
|
||||
@include boxed;
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
div.note,
|
||||
div.warning {
|
||||
@include boxed;
|
||||
|
||||
font-style: italic;
|
||||
|
||||
h3 {
|
||||
float: right;
|
||||
margin: 0 0 1rem 1rem;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
content: url();
|
||||
}
|
||||
|
||||
h3 + p {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
div.note {
|
||||
h3 {
|
||||
background-color: var(--nmd-color-info);
|
||||
// From https://tabler-icons.io/i/info-square-rounded
|
||||
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='42' viewBox='0 0 24 24' stroke-width='2' stroke='black' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M12 8h.01'%3E%3C/path%3E%3Cpath d='M11 12h1v4h1'%3E%3C/path%3E%3Cpath d='M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z'%3E%3C/path%3E%3C/svg%3E");
|
||||
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='42' viewBox='0 0 24 24' stroke-width='2' stroke='black' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M12 8h.01'%3E%3C/path%3E%3Cpath d='M11 12h1v4h1'%3E%3C/path%3E%3Cpath d='M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z'%3E%3C/path%3E%3C/svg%3E");
|
||||
}
|
||||
}
|
||||
|
||||
div.warning {
|
||||
h3 {
|
||||
background-color: var(--nmd-color-warn);
|
||||
// From https://tabler-icons.io/i/alert-triangle
|
||||
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='42' viewBox='0 0 24 24' stroke-width='2' stroke='black' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M12 9v2m0 4v.01'%3E%3C/path%3E%3Cpath d='M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75'%3E%3C/path%3E%3C/svg%3E");
|
||||
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='42' viewBox='0 0 24 24' stroke-width='2' stroke='black' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'%3E%3C/path%3E%3Cpath d='M12 9v2m0 4v.01'%3E%3C/path%3E%3Cpath d='M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75'%3E%3C/path%3E%3C/svg%3E");
|
||||
}
|
||||
}
|
||||
|
||||
.term {
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.docbook .xref img[src^="images\/callouts\/"],
|
||||
.screen img,
|
||||
.programlisting img {
|
||||
width: 1em;
|
||||
}
|
||||
|
||||
.calloutlist img {
|
||||
width: 1.3em;
|
||||
}
|
||||
|
||||
/** The console prompt, e.g., `$` and `#` should not be selectable. */
|
||||
.programlisting.language-shell .hljs-meta.prompt_ {
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@import "tomorrow.min.css";
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
@import "tomorrow-night.min.css";
|
||||
}
|
102
docs/static/tomorrow-night.min.css
vendored
Normal file
102
docs/static/tomorrow-night.min.css
vendored
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*!
|
||||
Theme: Tomorrow Night
|
||||
Author: Chris Kempson (http://chriskempson.com)
|
||||
License: ~ MIT (or more permissive) [via base16-schemes-source]
|
||||
Maintainer: @highlightjs/core-team
|
||||
Version: 2021.09.0
|
||||
*/
|
||||
pre code.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 1em;
|
||||
}
|
||||
code.hljs {
|
||||
padding: 3px 5px;
|
||||
}
|
||||
.hljs {
|
||||
color: #ccc;
|
||||
background: #2d2d2d;
|
||||
}
|
||||
.hljs ::selection,
|
||||
.hljs::selection {
|
||||
background-color: #515151;
|
||||
color: #ccc;
|
||||
}
|
||||
.hljs-comment {
|
||||
color: #999;
|
||||
}
|
||||
.hljs-tag {
|
||||
color: #b4b7b4;
|
||||
}
|
||||
.hljs-operator,
|
||||
.hljs-punctuation,
|
||||
.hljs-subst {
|
||||
color: #ccc;
|
||||
}
|
||||
.hljs-operator {
|
||||
opacity: 0.7;
|
||||
}
|
||||
.hljs-bullet,
|
||||
.hljs-deletion,
|
||||
.hljs-name,
|
||||
.hljs-selector-tag,
|
||||
.hljs-template-variable,
|
||||
.hljs-variable {
|
||||
color: #f2777a;
|
||||
}
|
||||
.hljs-attr,
|
||||
.hljs-link,
|
||||
.hljs-literal,
|
||||
.hljs-number,
|
||||
.hljs-symbol,
|
||||
.hljs-variable.constant_ {
|
||||
color: #f99157;
|
||||
}
|
||||
.hljs-class .hljs-title,
|
||||
.hljs-title,
|
||||
.hljs-title.class_ {
|
||||
color: #fc6;
|
||||
}
|
||||
.hljs-strong {
|
||||
font-weight: 700;
|
||||
color: #fc6;
|
||||
}
|
||||
.hljs-addition,
|
||||
.hljs-code,
|
||||
.hljs-string,
|
||||
.hljs-title.class_.inherited__ {
|
||||
color: #9c9;
|
||||
}
|
||||
.hljs-built_in,
|
||||
.hljs-doctag,
|
||||
.hljs-keyword.hljs-atrule,
|
||||
.hljs-quote,
|
||||
.hljs-regexp {
|
||||
color: #6cc;
|
||||
}
|
||||
.hljs-attribute,
|
||||
.hljs-function .hljs-title,
|
||||
.hljs-section,
|
||||
.hljs-title.function_,
|
||||
.ruby .hljs-property {
|
||||
color: #69c;
|
||||
}
|
||||
.diff .hljs-meta,
|
||||
.hljs-keyword,
|
||||
.hljs-template-tag,
|
||||
.hljs-type {
|
||||
color: #c9c;
|
||||
}
|
||||
.hljs-emphasis {
|
||||
color: #c9c;
|
||||
font-style: italic;
|
||||
}
|
||||
.hljs-meta,
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-meta .hljs-string {
|
||||
color: #a3685a;
|
||||
}
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-meta-keyword {
|
||||
font-weight: 700;
|
||||
}
|
102
docs/static/tomorrow.min.css
vendored
Normal file
102
docs/static/tomorrow.min.css
vendored
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*!
|
||||
Theme: Tomorrow
|
||||
Author: Chris Kempson (http://chriskempson.com)
|
||||
License: ~ MIT (or more permissive) [via base16-schemes-source]
|
||||
Maintainer: @highlightjs/core-team
|
||||
Version: 2021.09.0
|
||||
*/
|
||||
pre code.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 1em;
|
||||
}
|
||||
code.hljs {
|
||||
padding: 3px 5px;
|
||||
}
|
||||
.hljs {
|
||||
color: #4d4d4c;
|
||||
background: #fff;
|
||||
}
|
||||
.hljs ::selection,
|
||||
.hljs::selection {
|
||||
background-color: #d6d6d6;
|
||||
color: #4d4d4c;
|
||||
}
|
||||
.hljs-comment {
|
||||
color: #8e908c;
|
||||
}
|
||||
.hljs-tag {
|
||||
color: #969896;
|
||||
}
|
||||
.hljs-operator,
|
||||
.hljs-punctuation,
|
||||
.hljs-subst {
|
||||
color: #4d4d4c;
|
||||
}
|
||||
.hljs-operator {
|
||||
opacity: 0.7;
|
||||
}
|
||||
.hljs-bullet,
|
||||
.hljs-deletion,
|
||||
.hljs-name,
|
||||
.hljs-selector-tag,
|
||||
.hljs-template-variable,
|
||||
.hljs-variable {
|
||||
color: #c82829;
|
||||
}
|
||||
.hljs-attr,
|
||||
.hljs-link,
|
||||
.hljs-literal,
|
||||
.hljs-number,
|
||||
.hljs-symbol,
|
||||
.hljs-variable.constant_ {
|
||||
color: #f5871f;
|
||||
}
|
||||
.hljs-class .hljs-title,
|
||||
.hljs-title,
|
||||
.hljs-title.class_ {
|
||||
color: #eab700;
|
||||
}
|
||||
.hljs-strong {
|
||||
font-weight: 700;
|
||||
color: #eab700;
|
||||
}
|
||||
.hljs-addition,
|
||||
.hljs-code,
|
||||
.hljs-string,
|
||||
.hljs-title.class_.inherited__ {
|
||||
color: #718c00;
|
||||
}
|
||||
.hljs-built_in,
|
||||
.hljs-doctag,
|
||||
.hljs-keyword.hljs-atrule,
|
||||
.hljs-quote,
|
||||
.hljs-regexp {
|
||||
color: #3e999f;
|
||||
}
|
||||
.hljs-attribute,
|
||||
.hljs-function .hljs-title,
|
||||
.hljs-section,
|
||||
.hljs-title.function_,
|
||||
.ruby .hljs-property {
|
||||
color: #4271ae;
|
||||
}
|
||||
.diff .hljs-meta,
|
||||
.hljs-keyword,
|
||||
.hljs-template-tag,
|
||||
.hljs-type {
|
||||
color: #8959a8;
|
||||
}
|
||||
.hljs-emphasis {
|
||||
color: #8959a8;
|
||||
font-style: italic;
|
||||
}
|
||||
.hljs-meta,
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-meta .hljs-string {
|
||||
color: #a3685a;
|
||||
}
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-meta-keyword {
|
||||
font-weight: 700;
|
||||
}
|
2503
flake.lock
2503
flake.lock
File diff suppressed because it is too large
Load diff
457
flake.nix
457
flake.nix
|
@ -22,18 +22,38 @@
|
|||
|
||||
flake = {
|
||||
lib = {
|
||||
inherit (import ./lib/stdlib-extended.nix nixpkgs.lib) nvim;
|
||||
inherit (import ./lib/stdlib-extended.nix nixpkgs.lib inputs) nvim;
|
||||
inherit (import ./configuration.nix inputs) neovimConfiguration;
|
||||
};
|
||||
|
||||
homeManagerModules = {
|
||||
neovim-flake = {
|
||||
imports = [
|
||||
(import ./lib/module self.packages inputs)
|
||||
];
|
||||
neovim-flake =
|
||||
nixpkgs.lib.warn ''
|
||||
homeManagerModules.neovim-flake has been deprecated.
|
||||
Plese use the homeManagereModules.nvf instead
|
||||
''
|
||||
self.homeManagerModules.nvf;
|
||||
|
||||
nvf = {
|
||||
imports = [(import ./flake/modules/home-manager.nix self.packages inputs)];
|
||||
};
|
||||
|
||||
default = self.homeManagerModules.neovim-flake;
|
||||
default = self.homeManagerModules.nvf;
|
||||
};
|
||||
|
||||
nixosModules = {
|
||||
neovim-flake =
|
||||
nixpkgs.lib.warn ''
|
||||
nixosModules.neovim-flake has been deprecated.
|
||||
Please use the nixosModules.nvf instead
|
||||
''
|
||||
self.nixosModules.neovim-flake;
|
||||
|
||||
nvf = {
|
||||
imports = [(import ./flake/modules/nixos.nix self.packages inputs)];
|
||||
};
|
||||
|
||||
default = self.nixosModules.nvf;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -48,7 +68,7 @@
|
|||
default = self'.devShells.lsp;
|
||||
nvim-nix = pkgs.mkShell {nativeBuildInputs = [config.packages.nix];};
|
||||
lsp = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [nil statix deadnix];
|
||||
nativeBuildInputs = with pkgs; [nil statix deadnix alejandra];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -70,123 +90,6 @@
|
|||
# TODO: get zig from the zig overlay instead of nixpkgs
|
||||
zig.url = "github:mitchellh/zig-overlay";
|
||||
|
||||
# LSP plugins
|
||||
nvim-lspconfig = {
|
||||
# url = "github:neovim/nvim-lspconfig?ref=v0.1.3";
|
||||
# Use master for nil_ls
|
||||
url = "github:neovim/nvim-lspconfig";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
lspsaga = {
|
||||
url = "github:tami5/lspsaga.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
lspkind = {
|
||||
url = "github:onsails/lspkind-nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
trouble = {
|
||||
url = "github:folke/trouble.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nvim-treesitter-context = {
|
||||
url = "github:nvim-treesitter/nvim-treesitter-context";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nvim-lightbulb = {
|
||||
url = "github:kosayoda/nvim-lightbulb";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nvim-code-action-menu = {
|
||||
url = "github:weilbith/nvim-code-action-menu";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
lsp-signature = {
|
||||
url = "github:ray-x/lsp_signature.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
lsp-lines = {
|
||||
url = "sourcehut:~whynothugo/lsp_lines.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
none-ls = {
|
||||
url = "github:nvimtools/none-ls.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nvim-docs-view = {
|
||||
url = "github:amrbashir/nvim-docs-view";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# language support
|
||||
sqls-nvim = {
|
||||
url = "github:nanotee/sqls.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
rust-tools = {
|
||||
url = "github:simrat39/rust-tools.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
flutter-tools = {
|
||||
url = "github:akinsho/flutter-tools.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
neodev-nvim = {
|
||||
url = "github:folke/neodev.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
elixir-ls = {
|
||||
url = "github:elixir-lsp/elixir-ls";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
elixir-tools = {
|
||||
url = "github:elixir-tools/elixir-tools.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
glow-nvim = {
|
||||
url = "github:ellisonleao/glow.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Tidal cycles
|
||||
tidalcycles = {
|
||||
url = "github:mitchmindtree/tidalcycles.nix";
|
||||
inputs.vim-tidal-src.url = "github:tidalcycles/vim-tidal";
|
||||
};
|
||||
|
||||
# Copying/Registers
|
||||
registers = {
|
||||
url = "github:tversteeg/registers.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nvim-neoclip = {
|
||||
url = "github:AckslD/nvim-neoclip.lua";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Telescope
|
||||
telescope = {
|
||||
url = "github:nvim-telescope/telescope.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Langauge server (use master instead of nixpkgs)
|
||||
rnix-lsp.url = "github:nix-community/rnix-lsp";
|
||||
nil = {
|
||||
|
@ -195,396 +98,532 @@
|
|||
inputs.flake-utils.follows = "flake-utils";
|
||||
};
|
||||
|
||||
### Plugins
|
||||
# Tidal cycles
|
||||
tidalcycles = {
|
||||
url = "github:mitchmindtree/tidalcycles.nix";
|
||||
inputs.vim-tidal-src.url = "github:tidalcycles/vim-tidal";
|
||||
};
|
||||
|
||||
# LSP plugins
|
||||
plugin-nvim-lspconfig = {
|
||||
url = "github:neovim/nvim-lspconfig";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-lspsaga = {
|
||||
url = "github:tami5/lspsaga.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-lspkind = {
|
||||
url = "github:onsails/lspkind-nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-trouble = {
|
||||
url = "github:folke/trouble.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-nvim-treesitter-context = {
|
||||
url = "github:nvim-treesitter/nvim-treesitter-context";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-nvim-lightbulb = {
|
||||
url = "github:kosayoda/nvim-lightbulb";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-nvim-code-action-menu = {
|
||||
url = "github:weilbith/nvim-code-action-menu";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-lsp-signature = {
|
||||
url = "github:ray-x/lsp_signature.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-lsp-lines = {
|
||||
url = "sourcehut:~whynothugo/lsp_lines.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-none-ls = {
|
||||
# https://github.com/nvimtools/none-ls.nvim/issues/58
|
||||
url = "github:nvimtools/none-ls.nvim/bb680d752cec37949faca7a1f509e2fe67ab418a";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-nvim-docs-view = {
|
||||
url = "github:amrbashir/nvim-docs-view";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# language support
|
||||
plugin-sqls-nvim = {
|
||||
url = "github:nanotee/sqls.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-rust-tools = {
|
||||
url = "github:simrat39/rust-tools.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-flutter-tools = {
|
||||
url = "github:akinsho/flutter-tools.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-neodev-nvim = {
|
||||
url = "github:folke/neodev.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-elixir-ls = {
|
||||
url = "github:elixir-lsp/elixir-ls";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-elixir-tools = {
|
||||
url = "github:elixir-tools/elixir-tools.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-glow-nvim = {
|
||||
url = "github:ellisonleao/glow.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-image-nvim = {
|
||||
url = "github:3rd/image.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Copying/Registers
|
||||
plugin-registers = {
|
||||
url = "github:tversteeg/registers.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-nvim-neoclip = {
|
||||
url = "github:AckslD/nvim-neoclip.lua";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Telescope
|
||||
plugin-telescope = {
|
||||
url = "github:nvim-telescope/telescope.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Debuggers
|
||||
nvim-dap = {
|
||||
plugin-nvim-dap = {
|
||||
url = "github:mfussenegger/nvim-dap";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nvim-dap-ui = {
|
||||
plugin-nvim-dap-ui = {
|
||||
url = "github:rcarriga/nvim-dap-ui";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Filetrees
|
||||
nvim-tree-lua = {
|
||||
plugin-nvim-tree-lua = {
|
||||
url = "github:nvim-tree/nvim-tree.lua";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Tablines
|
||||
nvim-bufferline-lua = {
|
||||
plugin-nvim-bufferline-lua = {
|
||||
url = "github:akinsho/nvim-bufferline.lua";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Statuslines
|
||||
lualine = {
|
||||
plugin-lualine = {
|
||||
url = "github:hoob3rt/lualine.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Autocompletes
|
||||
nvim-compe = {
|
||||
url = "github:hrsh7th/nvim-compe";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nvim-cmp = {
|
||||
plugin-nvim-cmp = {
|
||||
url = "github:hrsh7th/nvim-cmp";
|
||||
flake = false;
|
||||
};
|
||||
cmp-buffer = {
|
||||
|
||||
plugin-cmp-buffer = {
|
||||
url = "github:hrsh7th/cmp-buffer";
|
||||
flake = false;
|
||||
};
|
||||
cmp-nvim-lsp = {
|
||||
|
||||
plugin-cmp-nvim-lsp = {
|
||||
url = "github:hrsh7th/cmp-nvim-lsp";
|
||||
flake = false;
|
||||
};
|
||||
cmp-vsnip = {
|
||||
|
||||
plugin-cmp-vsnip = {
|
||||
url = "github:hrsh7th/cmp-vsnip";
|
||||
flake = false;
|
||||
};
|
||||
cmp-path = {
|
||||
|
||||
plugin-cmp-path = {
|
||||
url = "github:hrsh7th/cmp-path";
|
||||
flake = false;
|
||||
};
|
||||
cmp-treesitter = {
|
||||
|
||||
plugin-cmp-treesitter = {
|
||||
url = "github:ray-x/cmp-treesitter";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# snippets
|
||||
vim-vsnip = {
|
||||
plugin-vim-vsnip = {
|
||||
url = "github:hrsh7th/vim-vsnip";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Presence
|
||||
neocord = {
|
||||
plugin-neocord = {
|
||||
url = "github:IogaMaster/neocord";
|
||||
flake = false; # uses flake-utils, avoid the flake
|
||||
};
|
||||
|
||||
# Autopairs
|
||||
nvim-autopairs = {
|
||||
plugin-nvim-autopairs = {
|
||||
url = "github:windwp/nvim-autopairs";
|
||||
flake = false;
|
||||
};
|
||||
nvim-ts-autotag = {
|
||||
|
||||
plugin-nvim-ts-autotag = {
|
||||
url = "github:windwp/nvim-ts-autotag";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Commenting
|
||||
kommentary = {
|
||||
url = "github:b3nj5m1n/kommentary";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
comment-nvim = {
|
||||
plugin-comment-nvim = {
|
||||
url = "github:numToStr/Comment.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
todo-comments = {
|
||||
plugin-todo-comments = {
|
||||
url = "github:folke/todo-comments.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Buffer tools
|
||||
bufdelete-nvim = {
|
||||
plugin-bufdelete-nvim = {
|
||||
url = "github:famiu/bufdelete.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Dashboard Utilities
|
||||
dashboard-nvim = {
|
||||
plugin-dashboard-nvim = {
|
||||
url = "github:glepnir/dashboard-nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
alpha-nvim = {
|
||||
plugin-alpha-nvim = {
|
||||
url = "github:goolord/alpha-nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
vim-startify = {
|
||||
plugin-vim-startify = {
|
||||
url = "github:mhinz/vim-startify";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Themes
|
||||
tokyonight = {
|
||||
plugin-tokyonight = {
|
||||
url = "github:folke/tokyonight.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
onedark = {
|
||||
plugin-onedark = {
|
||||
url = "github:navarasu/onedark.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
catppuccin = {
|
||||
plugin-catppuccin = {
|
||||
url = "github:catppuccin/nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
dracula = {
|
||||
plugin-dracula = {
|
||||
url = "github:Mofiqul/dracula.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
oxocarbon = {
|
||||
url = "github:glyh/oxocarbon.nvim/lualine-support";
|
||||
plugin-oxocarbon = {
|
||||
url = "github:nyoom-engineering/oxocarbon.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
gruvbox = {
|
||||
plugin-gruvbox = {
|
||||
url = "github:ellisonleao/gruvbox.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
rose-pine = {
|
||||
plugin-rose-pine = {
|
||||
url = "github:rose-pine/neovim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Rust crates
|
||||
crates-nvim = {
|
||||
plugin-crates-nvim = {
|
||||
url = "github:Saecki/crates.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Project Management
|
||||
project-nvim = {
|
||||
plugin-project-nvim = {
|
||||
url = "github:ahmedkhalf/project.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Visuals
|
||||
nvim-cursorline = {
|
||||
plugin-nvim-cursorline = {
|
||||
url = "github:yamatsum/nvim-cursorline";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
scrollbar-nvim = {
|
||||
plugin-scrollbar-nvim = {
|
||||
url = "github:petertriho/nvim-scrollbar";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
cinnamon-nvim = {
|
||||
plugin-cinnamon-nvim = {
|
||||
url = "github:declancm/cinnamon.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
cellular-automaton = {
|
||||
plugin-cellular-automaton = {
|
||||
url = "github:Eandrju/cellular-automaton.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
indent-blankline = {
|
||||
plugin-indent-blankline = {
|
||||
url = "github:lukas-reineke/indent-blankline.nvim";
|
||||
flake = false;
|
||||
};
|
||||
nvim-web-devicons = {
|
||||
|
||||
plugin-nvim-web-devicons = {
|
||||
url = "github:nvim-tree/nvim-web-devicons";
|
||||
flake = false;
|
||||
};
|
||||
gitsigns-nvim = {
|
||||
|
||||
plugin-gitsigns-nvim = {
|
||||
url = "github:lewis6991/gitsigns.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
fidget-nvim = {
|
||||
url = "github:j-hui/fidget.nvim?ref=legacy";
|
||||
plugin-vim-fugitive = {
|
||||
url = "github:tpope/vim-fugitive";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
highlight-undo = {
|
||||
plugin-fidget-nvim = {
|
||||
url = "github:j-hui/fidget.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-highlight-undo = {
|
||||
url = "github:tzachar/highlight-undo.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Minimap
|
||||
minimap-vim = {
|
||||
plugin-minimap-vim = {
|
||||
url = "github:wfxr/minimap.vim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
codewindow-nvim = {
|
||||
plugin-codewindow-nvim = {
|
||||
url = "github:gorbit99/codewindow.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Notifications
|
||||
nvim-notify = {
|
||||
plugin-nvim-notify = {
|
||||
url = "github:rcarriga/nvim-notify";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Utilities
|
||||
ccc = {
|
||||
plugin-ccc = {
|
||||
url = "github:uga-rosa/ccc.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
diffview-nvim = {
|
||||
plugin-diffview-nvim = {
|
||||
url = "github:sindrets/diffview.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
icon-picker-nvim = {
|
||||
plugin-icon-picker-nvim = {
|
||||
url = "github:ziontee113/icon-picker.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
which-key = {
|
||||
plugin-which-key = {
|
||||
url = "github:folke/which-key.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
cheatsheet-nvim = {
|
||||
plugin-cheatsheet-nvim = {
|
||||
url = "github:sudormrfbin/cheatsheet.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
gesture-nvim = {
|
||||
plugin-gesture-nvim = {
|
||||
url = "github:notomo/gesture.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
hop-nvim = {
|
||||
plugin-hop-nvim = {
|
||||
url = "github:phaazon/hop.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
leap-nvim = {
|
||||
plugin-leap-nvim = {
|
||||
url = "github:ggandor/leap.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
smartcolumn = {
|
||||
plugin-smartcolumn = {
|
||||
url = "github:m4xshen/smartcolumn.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nvim-surround = {
|
||||
plugin-nvim-surround = {
|
||||
url = "github:kylechui/nvim-surround";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Note-taking
|
||||
obsidian-nvim = {
|
||||
plugin-obsidian-nvim = {
|
||||
url = "github:epwalsh/obsidian.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
orgmode-nvim = {
|
||||
plugin-orgmode-nvim = {
|
||||
url = "github:nvim-orgmode/orgmode";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
mind-nvim = {
|
||||
plugin-mind-nvim = {
|
||||
url = "github:phaazon/mind.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Spellchecking
|
||||
vim-dirtytalk = {
|
||||
plugin-vim-dirtytalk = {
|
||||
url = "github:psliwka/vim-dirtytalk";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Terminal
|
||||
toggleterm-nvim = {
|
||||
plugin-toggleterm-nvim = {
|
||||
url = "github:akinsho/toggleterm.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# UI
|
||||
nvim-navbuddy = {
|
||||
plugin-nvim-navbuddy = {
|
||||
url = "github:SmiteshP/nvim-navbuddy";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nvim-navic = {
|
||||
plugin-nvim-navic = {
|
||||
url = "github:SmiteshP/nvim-navic";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
noice-nvim = {
|
||||
plugin-noice-nvim = {
|
||||
url = "github:folke/noice.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
modes-nvim = {
|
||||
plugin-modes-nvim = {
|
||||
url = "github:mvllow/modes.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nvim-colorizer-lua = {
|
||||
plugin-nvim-colorizer-lua = {
|
||||
url = "github:NvChad/nvim-colorizer.lua";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
vim-illuminate = {
|
||||
plugin-vim-illuminate = {
|
||||
url = "github:RRethy/vim-illuminate";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Assistant
|
||||
copilot-lua = {
|
||||
plugin-chatgpt = {
|
||||
url = "github:jackMort/ChatGPT.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-copilot-lua = {
|
||||
url = "github:zbirenbaum/copilot.lua";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
copilot-cmp = {
|
||||
plugin-copilot-cmp = {
|
||||
url = "github:zbirenbaum/copilot-cmp";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Session management
|
||||
nvim-session-manager = {
|
||||
plugin-nvim-session-manager = {
|
||||
url = "github:Shatur/neovim-session-manager";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Dependencies
|
||||
plenary-nvim = {
|
||||
plugin-plenary-nvim = {
|
||||
# (required by crates-nvim)
|
||||
url = "github:nvim-lua/plenary.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
dressing-nvim = {
|
||||
plugin-dressing-nvim = {
|
||||
# (required by icon-picker-nvim)
|
||||
url = "github:stevearc/dressing.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
vim-markdown = {
|
||||
plugin-vim-markdown = {
|
||||
# (required by obsidian-nvim)
|
||||
url = "github:preservim/vim-markdown";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
tabular = {
|
||||
plugin-tabular = {
|
||||
# (required by vim-markdown)
|
||||
url = "github:godlygeek/tabular";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nui-nvim = {
|
||||
plugin-nui-nvim = {
|
||||
# (required by noice.nvim)
|
||||
url = "github:MunifTanjim/nui.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
vim-repeat = {
|
||||
plugin-vim-repeat = {
|
||||
# (required by leap.nvim)
|
||||
url = "github:tpope/vim-repeat";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-nvim-nio = {
|
||||
# (required nvim-dap-ui)
|
||||
url = "github:nvim-neotest/nvim-nio";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
87
flake/modules/home-manager.nix
Normal file
87
flake/modules/home-manager.nix
Normal file
|
@ -0,0 +1,87 @@
|
|||
# Home Manager module
|
||||
packages: inputs: {
|
||||
config,
|
||||
pkgs,
|
||||
lib ? pkgs.lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) maintainers;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.lists) optional;
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.types) attrsOf anything bool;
|
||||
|
||||
cfg = config.programs.neovim-flake;
|
||||
inherit (import ../../configuration.nix inputs) neovimConfiguration;
|
||||
|
||||
neovimConfigured = neovimConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [cfg.settings];
|
||||
};
|
||||
in {
|
||||
meta.maintainers = with maintainers; [NotAShelf];
|
||||
|
||||
options.programs.neovim-flake = {
|
||||
enable = mkEnableOption "neovim-flake, the extensible neovim configuration wrapper";
|
||||
|
||||
enableManpages = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Whether to enable manpages for neovim-flake.";
|
||||
};
|
||||
|
||||
defaultEditor = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to set `neovim-flake` as the default editor.
|
||||
|
||||
This will set the `EDITOR` environment variable as `nvim`
|
||||
if set to true.
|
||||
'';
|
||||
};
|
||||
|
||||
finalPackage = mkOption {
|
||||
type = anything;
|
||||
visible = false;
|
||||
readOnly = true;
|
||||
description = ''
|
||||
The built neovim-flake package, wrapped with the user's configuration.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = attrsOf anything;
|
||||
default = {};
|
||||
description = "Attribute set of neovim-flake preferences.";
|
||||
example = literalExpression ''
|
||||
{
|
||||
vim.viAlias = false;
|
||||
vim.vimAlias = true;
|
||||
vim.lsp = {
|
||||
enable = true;
|
||||
formatOnSave = true;
|
||||
lightbulb.enable = true;
|
||||
lspsaga.enable = false;
|
||||
nvimCodeActionMenu.enable = true;
|
||||
trouble.enable = true;
|
||||
lspSignature.enable = true;
|
||||
rust.enable = false;
|
||||
nix = true;
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.neovim-flake.finalPackage = neovimConfigured.neovim;
|
||||
|
||||
home = {
|
||||
sessionVariables = mkIf cfg.defaultEditor {EDITOR = "nvim";};
|
||||
packages =
|
||||
[cfg.finalPackage]
|
||||
++ optional cfg.enableManpages packages.${pkgs.stdenv.system}.docs-manpages;
|
||||
};
|
||||
};
|
||||
}
|
87
flake/modules/nixos.nix
Normal file
87
flake/modules/nixos.nix
Normal file
|
@ -0,0 +1,87 @@
|
|||
# NixOS module
|
||||
packages: inputs: {
|
||||
config,
|
||||
pkgs,
|
||||
lib ? pkgs.lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) maintainers;
|
||||
inherit (lib.modules) mkIf mkOverride;
|
||||
inherit (lib.lists) optional;
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.types) attrsOf anything bool;
|
||||
|
||||
cfg = config.programs.neovim-flake;
|
||||
inherit (import ../../configuration.nix inputs) neovimConfiguration;
|
||||
|
||||
neovimConfigured = neovimConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [cfg.settings];
|
||||
};
|
||||
in {
|
||||
meta.maintainers = with maintainers; [NotAShelf];
|
||||
|
||||
options.programs.neovim-flake = {
|
||||
enable = mkEnableOption "neovim-flake, the extensible neovim configuration wrapper";
|
||||
|
||||
enableManpages = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Whether to enable manpages for neovim-flake.";
|
||||
};
|
||||
|
||||
defaultEditor = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to set `neovim-flake` as the default editor.
|
||||
|
||||
This will set the `EDITOR` environment variable as `nvim`
|
||||
if set to true.
|
||||
'';
|
||||
};
|
||||
|
||||
finalPackage = mkOption {
|
||||
type = anything;
|
||||
visible = false;
|
||||
readOnly = true;
|
||||
description = ''
|
||||
The built neovim-flake package, wrapped with the user's configuration.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = attrsOf anything;
|
||||
default = {};
|
||||
description = "Attribute set of neovim-flake preferences.";
|
||||
example = literalExpression ''
|
||||
{
|
||||
vim.viAlias = false;
|
||||
vim.vimAlias = true;
|
||||
vim.lsp = {
|
||||
enable = true;
|
||||
formatOnSave = true;
|
||||
lightbulb.enable = true;
|
||||
lspsaga.enable = false;
|
||||
nvimCodeActionMenu.enable = true;
|
||||
trouble.enable = true;
|
||||
lspSignature.enable = true;
|
||||
rust.enable = false;
|
||||
nix = true;
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.neovim-flake.finalPackage = neovimConfigured.neovim;
|
||||
|
||||
environment = {
|
||||
variables.EDITOR = mkIf cfg.defaultEditor (mkOverride 900 "nvim");
|
||||
systemPackages =
|
||||
[cfg.finalPackage]
|
||||
++ optional cfg.enableManpages packages.${pkgs.stdenv.system}.docs-manpages;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -5,10 +5,7 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
docs = import ../docs {
|
||||
inherit pkgs;
|
||||
nmdSrc = inputs.nmd;
|
||||
};
|
||||
docs = import ../docs {inherit pkgs inputs;};
|
||||
in {
|
||||
packages =
|
||||
{
|
||||
|
@ -36,7 +33,7 @@
|
|||
inherit (config.legacyPackages) neovim-nix;
|
||||
in
|
||||
dockerTools.buildImage {
|
||||
name = "neovim-flake";
|
||||
name = "nvf";
|
||||
tag = "latest";
|
||||
|
||||
copyToRoot = buildEnv {
|
||||
|
|
72
lib/binds.nix
Normal file
72
lib/binds.nix
Normal file
|
@ -0,0 +1,72 @@
|
|||
{lib}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.modules) mkIf mkDefault;
|
||||
inherit (lib.types) nullOr str;
|
||||
inherit (lib.attrsets) isAttrs mapAttrs;
|
||||
|
||||
binds = rec {
|
||||
mkLuaBinding = key: action: desc:
|
||||
mkIf (key != null) {
|
||||
"${key}" = {
|
||||
inherit action desc;
|
||||
lua = true;
|
||||
silent = true;
|
||||
};
|
||||
};
|
||||
|
||||
mkExprBinding = key: action: desc:
|
||||
mkIf (key != null) {
|
||||
"${key}" = {
|
||||
inherit action desc;
|
||||
lua = true;
|
||||
silent = true;
|
||||
expr = true;
|
||||
};
|
||||
};
|
||||
|
||||
mkBinding = key: action: desc:
|
||||
mkIf (key != null) {
|
||||
"${key}" = {
|
||||
inherit action desc;
|
||||
silent = true;
|
||||
};
|
||||
};
|
||||
|
||||
mkMappingOption = description: default:
|
||||
mkOption {
|
||||
type = nullOr str;
|
||||
inherit default description;
|
||||
};
|
||||
|
||||
# Utility function that takes two attrsets:
|
||||
# { someKey = "some_value" } and
|
||||
# { someKey = { description = "Some Description"; }; }
|
||||
# and merges them into
|
||||
# { someKey = { value = "some_value"; description = "Some Description"; }; }
|
||||
addDescriptionsToMappings = actualMappings: mappingDefinitions:
|
||||
mapAttrs (name: value: let
|
||||
isNested = isAttrs value;
|
||||
returnedValue =
|
||||
if isNested
|
||||
then addDescriptionsToMappings actualMappings."${name}" mappingDefinitions."${name}"
|
||||
else {
|
||||
inherit value;
|
||||
inherit (mappingDefinitions."${name}") description;
|
||||
};
|
||||
in
|
||||
returnedValue)
|
||||
actualMappings;
|
||||
|
||||
mkSetBinding = binding: action:
|
||||
mkBinding binding.value action binding.description;
|
||||
|
||||
mkSetExprBinding = binding: action:
|
||||
mkExprBinding binding.value action binding.description;
|
||||
|
||||
mkSetLuaBinding = binding: action:
|
||||
mkLuaBinding binding.value action binding.description;
|
||||
|
||||
pushDownDefault = attr: mapAttrs (_: value: mkDefault value) attr;
|
||||
};
|
||||
in
|
||||
binds
|
65
lib/config.nix
Normal file
65
lib/config.nix
Normal file
|
@ -0,0 +1,65 @@
|
|||
{lib}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) bool;
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.attrsets) mapAttrsToList;
|
||||
inherit (lib.lists) flatten;
|
||||
in {
|
||||
mkBool = value: description:
|
||||
mkOption {
|
||||
type = bool;
|
||||
default = value;
|
||||
inherit description;
|
||||
};
|
||||
|
||||
/*
|
||||
Generates a list of mkRenamedOptionModule, from a mapping of the old name to
|
||||
the new name. Nested options can optionally supply a "_name" to indicate its
|
||||
new name.
|
||||
|
||||
# Example
|
||||
|
||||
```nix
|
||||
batchRenameOptions ["nvimTree"] ["nvimTree" "setupOpts"] {
|
||||
disableNetrw = "disable_netrw";
|
||||
nestedOption = {
|
||||
_name = "nested_option";
|
||||
somethingElse = "something_else";
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
The above code is equivalent to this:
|
||||
|
||||
```nix
|
||||
[
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
["nvimTree" "disableNetrw"]
|
||||
["nvimTree" "setupOpts" "disable_netrw"]
|
||||
)
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
["nvimTree" "nestedOption" "somethingElse"]
|
||||
["nvimTree" "setupOpts" "nested_option" "something_else"]
|
||||
)
|
||||
]
|
||||
```
|
||||
*/
|
||||
batchRenameOptions = oldBasePath: newBasePath: mappings: let
|
||||
genSetupOptRenames = oldSubpath: newSubpath: table:
|
||||
mapAttrsToList (
|
||||
oldName: newNameOrNestedOpts:
|
||||
if builtins.isAttrs newNameOrNestedOpts
|
||||
then
|
||||
genSetupOptRenames (oldSubpath ++ [oldName]) (newSubpath ++ [newNameOrNestedOpts._name or oldName])
|
||||
(builtins.removeAttrs newNameOrNestedOpts ["_name"])
|
||||
else
|
||||
mkRenamedOptionModule
|
||||
(oldBasePath ++ oldSubpath ++ [oldName])
|
||||
(newBasePath ++ newSubpath ++ [newNameOrNestedOpts])
|
||||
)
|
||||
table;
|
||||
in
|
||||
flatten (genSetupOptRenames [] [] mappings);
|
||||
}
|
66
lib/dag.nix
66
lib/dag.nix
|
@ -8,13 +8,16 @@
|
|||
# - the addition of the function `entryBefore` indicating a "wanted
|
||||
# by" relationship.
|
||||
{lib}: let
|
||||
inherit (lib) all filterAttrs nvim mapAttrs toposort;
|
||||
inherit (builtins) isAttrs attrValues attrNames elem all head tail length;
|
||||
inherit (lib.attrsets) filterAttrs mapAttrs;
|
||||
inherit (lib.lists) toposort;
|
||||
inherit (lib.nvim.dag) empty isEntry entryBetween entryAfter entriesBetween;
|
||||
in {
|
||||
empty = {};
|
||||
|
||||
isEntry = e: e ? data && e ? after && e ? before;
|
||||
isDag = dag:
|
||||
builtins.isAttrs dag && all nvim.dag.isEntry (builtins.attrValues dag);
|
||||
isAttrs dag && all isEntry (attrValues dag);
|
||||
|
||||
/*
|
||||
Takes an attribute set containing entries built by entryAnywhere,
|
||||
|
@ -76,8 +79,8 @@ in {
|
|||
*/
|
||||
topoSort = dag: let
|
||||
dagBefore = dag: name:
|
||||
builtins.attrNames
|
||||
(filterAttrs (_n: v: builtins.elem name v.before) dag);
|
||||
attrNames
|
||||
(filterAttrs (_n: v: elem name v.before) dag);
|
||||
normalizedDag =
|
||||
mapAttrs (n: v: {
|
||||
name = n;
|
||||
|
@ -85,8 +88,8 @@ in {
|
|||
after = v.after ++ dagBefore dag n;
|
||||
})
|
||||
dag;
|
||||
before = a: b: builtins.elem a.name b.after;
|
||||
sorted = toposort before (builtins.attrValues normalizedDag);
|
||||
before = a: b: elem a.name b.after;
|
||||
sorted = toposort before (attrValues normalizedDag);
|
||||
in
|
||||
if sorted ? result
|
||||
then {
|
||||
|
@ -100,8 +103,53 @@ in {
|
|||
entryBetween = before: after: data: {inherit data before after;};
|
||||
|
||||
# Create a DAG entry with no particular dependency information.
|
||||
entryAnywhere = nvim.dag.entryBetween [] [];
|
||||
entryAnywhere = entryBetween [] [];
|
||||
|
||||
entryAfter = nvim.dag.entryBetween [];
|
||||
entryBefore = before: nvim.dag.entryBetween before [];
|
||||
entryAfter = entryBetween [];
|
||||
entryBefore = before: entryBetween before [];
|
||||
|
||||
# Given a list of entries, this function places them in order within the DAG.
|
||||
# Each entry is labeled "${tag}-${entry index}" and other DAG entries can be
|
||||
# added with 'before' or 'after' referring these indexed entries.
|
||||
#
|
||||
# The entries as a whole can be given a relation to other DAG nodes. All
|
||||
# generated nodes are then placed before or after those dependencies.
|
||||
entriesBetween = tag: let
|
||||
go = i: before: after: entries: let
|
||||
name = "${tag}-${toString i}";
|
||||
i' = i + 1;
|
||||
in
|
||||
if entries == []
|
||||
then empty
|
||||
else if length entries == 1
|
||||
then {
|
||||
"${name}" = entryBetween before after (head entries);
|
||||
}
|
||||
else
|
||||
{
|
||||
"${name}" = entryAfter after (head entries);
|
||||
}
|
||||
// go (i + 1) before [name] (tail entries);
|
||||
in
|
||||
go 0;
|
||||
|
||||
entriesAnywhere = tag: entriesBetween tag [] [];
|
||||
entriesAfter = tag: entriesBetween tag [];
|
||||
entriesBefore = tag: before: entriesBetween tag before [];
|
||||
|
||||
# mkLuarcSection and mkVimrcSection take a section DAG
|
||||
# and return a string containing a comment to identify
|
||||
# the section, and the data contained within the section
|
||||
#
|
||||
# all operations are done without any modifications
|
||||
# to the inputted section data
|
||||
mkLuarcSection = section: ''
|
||||
-- SECTION: ${section.name}
|
||||
${section.data}
|
||||
'';
|
||||
|
||||
mkVimrcSection = section: ''
|
||||
" SECTION: ${section.name}
|
||||
${section.data}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
{lib}: {
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
types = import ./types {inherit inputs lib;};
|
||||
|
||||
config = import ./config.nix {inherit lib;};
|
||||
binds = import ./binds.nix {inherit lib;};
|
||||
dag = import ./dag.nix {inherit lib;};
|
||||
types = import ./types {inherit lib;};
|
||||
languages = import ./languages.nix {inherit lib;};
|
||||
lists = import ./lists.nix {inherit lib;};
|
||||
lua = import ./lua.nix {inherit lib;};
|
||||
vim = import ./vim.nix {inherit lib;};
|
||||
vim = import ./vim.nix;
|
||||
}
|
||||
|
|
|
@ -1,32 +1,37 @@
|
|||
# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix
|
||||
{lib}: {
|
||||
{lib}: let
|
||||
inherit (builtins) isString getAttr;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.attrsets) listToAttrs;
|
||||
inherit (lib.types) bool;
|
||||
in {
|
||||
# Converts a boolean to a yes/no string. This is used in lots of
|
||||
# configuration formats.
|
||||
diagnosticsToLua = {
|
||||
lang,
|
||||
config,
|
||||
diagnostics,
|
||||
diagnosticsProviders,
|
||||
}:
|
||||
lib.listToAttrs
|
||||
listToAttrs
|
||||
(map (v: let
|
||||
type =
|
||||
if builtins.isString v
|
||||
if isString v
|
||||
then v
|
||||
else builtins.getAttr v.type;
|
||||
else getAttr v.type;
|
||||
package =
|
||||
if builtins.isString v
|
||||
then diagnostics.${type}.package
|
||||
if isString v
|
||||
then diagnosticsProviders.${type}.package
|
||||
else v.package;
|
||||
in {
|
||||
name = "${lang}-diagnostics-${type}";
|
||||
value = diagnostics.${type}.nullConfig package;
|
||||
value = diagnosticsProviders.${type}.nullConfig package;
|
||||
})
|
||||
config);
|
||||
|
||||
mkEnable = desc:
|
||||
lib.mkOption {
|
||||
mkOption {
|
||||
description = "Turn on ${desc} for enabled languages by default";
|
||||
type = lib.types.bool;
|
||||
type = bool;
|
||||
default = false;
|
||||
};
|
||||
}
|
||||
|
|
34
lib/lists.nix
Normal file
34
lib/lists.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{lib}: let
|
||||
inherit (lib.lists) elem all;
|
||||
in {
|
||||
/*
|
||||
Checks if all values are present in the list.
|
||||
|
||||
Type:
|
||||
listContainsValues :: { list :: [a], values :: [a] } -> Bool
|
||||
|
||||
Arguments:
|
||||
list - A list of elements.
|
||||
values - A list of values to check for presence in the list.
|
||||
|
||||
Returns:
|
||||
True if all values are present in the list, otherwise False.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
listContainsValues { list = [1 2 3]; values = [2 3]; }
|
||||
=> True
|
||||
|
||||
listContainsValues { list = [1 2 3]; values = [2 4]; }
|
||||
=> False
|
||||
```
|
||||
*/
|
||||
listContainsValues = {
|
||||
list,
|
||||
values,
|
||||
}: let
|
||||
# Check if all values are present in the list
|
||||
containsValue = value: elem value list;
|
||||
in
|
||||
all containsValue values;
|
||||
}
|
62
lib/lua.nix
62
lib/lua.nix
|
@ -1,8 +1,20 @@
|
|||
# Helpers for converting values to lua
|
||||
{lib}: let
|
||||
inherit (lib) mapAttrsToList filterAttrs concatStringsSep concatMapStringsSep stringToCharacters boolToString;
|
||||
inherit (builtins) hasAttr head throw typeOf;
|
||||
inherit (builtins) hasAttr head throw typeOf isList isAttrs isBool isInt isString isPath isFloat toJSON;
|
||||
inherit (lib.attrsets) mapAttrsToList filterAttrs;
|
||||
inherit (lib.strings) concatStringsSep concatMapStringsSep stringToCharacters;
|
||||
inherit (lib.trivial) boolToString;
|
||||
in rec {
|
||||
wrapLuaConfig = {
|
||||
luaBefore ? "",
|
||||
luaConfig,
|
||||
luaAfter ? "",
|
||||
}: ''
|
||||
lua << EOF
|
||||
${concatStringsSep "\n" [luaBefore luaConfig luaAfter]}
|
||||
EOF
|
||||
'';
|
||||
|
||||
# Convert a null value to lua's nil
|
||||
nullString = value:
|
||||
if value == null
|
||||
|
@ -11,29 +23,29 @@ in rec {
|
|||
|
||||
# convert an expression to lua
|
||||
expToLua = exp:
|
||||
if builtins.isList exp
|
||||
if isList exp
|
||||
then listToLuaTable exp # if list, convert to lua table
|
||||
else if builtins.isAttrs exp
|
||||
else if isAttrs exp
|
||||
then attrsetToLuaTable exp # if attrs, convert to table
|
||||
else if builtins.isBool exp
|
||||
then lib.boolToString exp # if bool, convert to string
|
||||
else if builtins.isInt exp
|
||||
then builtins.toString exp # if int, convert to string
|
||||
else if isBool exp
|
||||
then boolToString exp # if bool, convert to string
|
||||
else if isInt exp
|
||||
then toString exp # if int, convert to string
|
||||
else if exp == null
|
||||
then "nil"
|
||||
else (builtins.toJSON exp); # otherwise jsonify the value and print as is
|
||||
else (toJSON exp); # otherwise jsonify the value and print as is
|
||||
|
||||
# convert list to a lua table
|
||||
listToLuaTable = list:
|
||||
"{ " + (builtins.concatStringsSep ", " (map expToLua list)) + " }";
|
||||
"{ " + (concatStringsSep ", " (map expToLua list)) + " }";
|
||||
|
||||
# convert attrset to a lua table
|
||||
attrsetToLuaTable = attrset:
|
||||
"{ "
|
||||
+ (
|
||||
builtins.concatStringsSep ", "
|
||||
concatStringsSep ", "
|
||||
(
|
||||
lib.mapAttrsToList (
|
||||
mapAttrsToList (
|
||||
name: value:
|
||||
name
|
||||
+ " = "
|
||||
|
@ -44,13 +56,15 @@ in rec {
|
|||
)
|
||||
+ " }";
|
||||
# Convert a list of lua expressions to a lua table. The difference to listToLuaTable is that the elements here are expected to be lua expressions already, whereas listToLuaTable converts from nix types to lua first
|
||||
luaTable = items: ''{${builtins.concatStringsSep "," items}}'';
|
||||
luaTable = items: ''{${concatStringsSep "," items}}'';
|
||||
|
||||
isLuaInline = {_type ? null, ...}: _type == "lua-inline";
|
||||
|
||||
toLuaObject = args:
|
||||
if builtins.isAttrs args
|
||||
if isAttrs args
|
||||
then
|
||||
if hasAttr "__raw" args
|
||||
then args.__raw
|
||||
if isLuaInline args
|
||||
then args.expr
|
||||
else if hasAttr "__empty" args
|
||||
then "{ }"
|
||||
else
|
||||
|
@ -68,19 +82,19 @@ in rec {
|
|||
)
|
||||
args)))
|
||||
+ "}"
|
||||
else if builtins.isList args
|
||||
else if isList args
|
||||
then "{" + concatMapStringsSep "," toLuaObject args + "}"
|
||||
else if builtins.isString args
|
||||
else if isString args
|
||||
then
|
||||
# This should be enough!
|
||||
builtins.toJSON args
|
||||
else if builtins.isPath args
|
||||
then builtins.toJSON (toString args)
|
||||
else if builtins.isBool args
|
||||
toJSON args
|
||||
else if isPath args
|
||||
then toJSON (toString args)
|
||||
else if isBool args
|
||||
then "${boolToString args}"
|
||||
else if builtins.isFloat args
|
||||
else if isFloat args
|
||||
then "${toString args}"
|
||||
else if builtins.isInt args
|
||||
else if isInt args
|
||||
then "${toString args}"
|
||||
else if (args == null)
|
||||
then "nil"
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
# Home Manager module
|
||||
packages: inputs: {
|
||||
pkgs,
|
||||
config,
|
||||
lib ? pkgs.lib,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.programs.neovim-flake;
|
||||
inherit (import ../../configuration.nix inputs) neovimConfiguration;
|
||||
set = neovimConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [cfg.settings];
|
||||
};
|
||||
in {
|
||||
meta.maintainers = with maintainers; [NotAShelf];
|
||||
|
||||
options.programs.neovim-flake = {
|
||||
enable = mkEnableOption "A NeoVim IDE with a focus on configurability and extensibility.";
|
||||
|
||||
settings = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
default = {};
|
||||
example = literalExpression ''
|
||||
{
|
||||
vim.viAlias = false;
|
||||
vim.vimAlias = true;
|
||||
vim.lsp = {
|
||||
enable = true;
|
||||
formatOnSave = true;
|
||||
lightbulb.enable = true;
|
||||
lspsaga.enable = false;
|
||||
nvimCodeActionMenu.enable = true;
|
||||
trouble.enable = true;
|
||||
lspSignature.enable = true;
|
||||
rust.enable = false;
|
||||
nix = true;
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = "Attribute set of neoflake preferences.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [set.neovim];
|
||||
};
|
||||
}
|
17
lib/nmd.nix
17
lib/nmd.nix
|
@ -1,17 +0,0 @@
|
|||
# Copied from nmd master: https://gitlab.com/rycee/nmd/-/blob/master/default.nix?ref_type=heads
|
||||
# Allows asciiDoc in options. It is easier to copy & keep updated then figure out how to pass the nmd input
|
||||
# along to user modules
|
||||
{
|
||||
# Indicates that the given text should be interpreted as AsciiDoc markup.
|
||||
asciiDoc = text: {
|
||||
_type = "asciiDoc";
|
||||
inherit text;
|
||||
};
|
||||
|
||||
# Indicates that the given text should be interpreted as AsciiDoc markup and
|
||||
# used in a literal context.
|
||||
literalAsciiDoc = text: {
|
||||
_type = "literalAsciiDoc";
|
||||
inherit text;
|
||||
};
|
||||
}
|
|
@ -1,73 +1,21 @@
|
|||
# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/stdlib-extended.nix
|
||||
# Just a convenience function that returns the given Nixpkgs standard
|
||||
# library extended with the HM library.
|
||||
nixpkgsLib: let
|
||||
mkNvimLib = import ./.;
|
||||
in
|
||||
nixpkgsLib.extend (self: super: rec {
|
||||
nvim = mkNvimLib {lib = self;};
|
||||
# Convenience function that returns the given Nixpkgs standard library
|
||||
# extended with our functions using `lib.extend`.
|
||||
nixpkgsLib: inputs:
|
||||
nixpkgsLib.extend (self: super: {
|
||||
# WARNING: New functions should not be added here, but to files
|
||||
# imported by `./default.nix` under their own categories. If your
|
||||
# function does not fit to any of the existing categories, create
|
||||
# a new file and import it in `./default.nix.`
|
||||
|
||||
mkLuaBinding = key: action: desc:
|
||||
self.mkIf (key != null) {
|
||||
"${key}" = {
|
||||
inherit action desc;
|
||||
lua = true;
|
||||
silent = true;
|
||||
};
|
||||
};
|
||||
# Makes our custom functions available under `lib.nvim` where stdlib-extended.nix is imported
|
||||
# with the appropriate arguments. For end-users, a `lib` output will be accessible from the flake.
|
||||
# E.g. for an input called `nvf`, `inputs.nvf.lib.nvim` will return the set
|
||||
# below.
|
||||
nvim = import ./. {
|
||||
inherit inputs;
|
||||
lib = self;
|
||||
};
|
||||
|
||||
mkExprBinding = key: action: desc:
|
||||
self.mkIf (key != null) {
|
||||
"${key}" = {
|
||||
inherit action desc;
|
||||
lua = true;
|
||||
silent = true;
|
||||
expr = true;
|
||||
};
|
||||
};
|
||||
|
||||
mkBinding = key: action: desc:
|
||||
self.mkIf (key != null) {
|
||||
"${key}" = {
|
||||
inherit action desc;
|
||||
silent = true;
|
||||
};
|
||||
};
|
||||
|
||||
mkMappingOption = description: default:
|
||||
self.mkOption {
|
||||
type = self.types.nullOr self.types.str;
|
||||
inherit default description;
|
||||
};
|
||||
|
||||
# Utility function that takes two attrsets:
|
||||
# { someKey = "some_value" } and
|
||||
# { someKey = { description = "Some Description"; }; }
|
||||
# and merges them into
|
||||
# { someKey = { value = "some_value"; description = "Some Description"; }; }
|
||||
addDescriptionsToMappings = actualMappings: mappingDefinitions:
|
||||
self.attrsets.mapAttrs (name: value: let
|
||||
isNested = self.isAttrs value;
|
||||
returnedValue =
|
||||
if isNested
|
||||
then addDescriptionsToMappings actualMappings."${name}" mappingDefinitions."${name}"
|
||||
else {
|
||||
value = value;
|
||||
description = mappingDefinitions."${name}".description;
|
||||
};
|
||||
in
|
||||
returnedValue)
|
||||
actualMappings;
|
||||
|
||||
mkSetBinding = binding: action:
|
||||
mkBinding binding.value action binding.description;
|
||||
|
||||
mkSetExprBinding = binding: action:
|
||||
mkExprBinding binding.value action binding.description;
|
||||
|
||||
mkSetLuaBinding = binding: action:
|
||||
mkLuaBinding binding.value action binding.description;
|
||||
|
||||
# For forward compatibility.
|
||||
literalExpression = super.literalExpression or super.literalExample;
|
||||
})
|
||||
# For forward compatibility.
|
||||
literalExpression = super.literalExpression or super.literalExample;
|
||||
})
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/types-dag.nix
|
||||
# Used for ordering config text.
|
||||
# Used for ordering configuration text.
|
||||
{lib}: let
|
||||
inherit
|
||||
(lib)
|
||||
|
@ -59,8 +59,8 @@ in rec {
|
|||
name = "dagOf";
|
||||
description = "DAG of ${elemType.description}";
|
||||
inherit (attrEquivalent) check merge emptyValue;
|
||||
inherit (elemType) getSubModules;
|
||||
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["<name>"]);
|
||||
getSubModules = elemType.getSubModules;
|
||||
substSubModules = m: dagOf (elemType.substSubModules m);
|
||||
functor = (defaultFunctor name) // {wrapped = elemType;};
|
||||
nestedTypes.elemType = elemType;
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
{lib}: let
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
typesDag = import ./dag.nix {inherit lib;};
|
||||
typesPlugin = import ./plugins.nix {inherit lib;};
|
||||
typesPlugin = import ./plugins.nix {inherit inputs lib;};
|
||||
typesLanguage = import ./languages.nix {inherit lib;};
|
||||
in {
|
||||
inherit (typesDag) dagOf;
|
||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption;
|
||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline;
|
||||
inherit (typesLanguage) diagnostics mkGrammarOption;
|
||||
}
|
||||
|
|
|
@ -15,13 +15,13 @@ with lib; let
|
|||
in {
|
||||
diagnostics = {
|
||||
langDesc,
|
||||
diagnostics,
|
||||
defaultDiagnostics,
|
||||
diagnosticsProviders,
|
||||
defaultDiagnosticsProvider,
|
||||
}:
|
||||
mkOption {
|
||||
description = "List of ${langDesc} diagnostics to enable";
|
||||
type = with types; listOf (either (enum (attrNames diagnostics)) (submodule diagnosticSubmodule));
|
||||
default = defaultDiagnostics;
|
||||
type = with types; listOf (either (enum (attrNames diagnosticsProviders)) (submodule diagnosticSubmodule));
|
||||
default = defaultDiagnosticsProvider;
|
||||
};
|
||||
|
||||
mkGrammarOption = pkgs: grammar:
|
||||
|
|
|
@ -1,163 +1,99 @@
|
|||
{lib}:
|
||||
with lib; let
|
||||
# Plugin must be same as input name from flake.nix
|
||||
availablePlugins = [
|
||||
# TODO: sort by category
|
||||
"nvim-treesitter-context"
|
||||
"gitsigns-nvim"
|
||||
"plenary-nvim"
|
||||
"nvim-lspconfig"
|
||||
"nvim-treesitter"
|
||||
"lspsaga"
|
||||
"lspkind"
|
||||
"nvim-lightbulb"
|
||||
"lsp-signature"
|
||||
"nvim-tree-lua"
|
||||
"nvim-bufferline-lua"
|
||||
"lualine"
|
||||
"nvim-compe"
|
||||
"nvim-autopairs"
|
||||
"nvim-ts-autotag"
|
||||
"nvim-web-devicons"
|
||||
"tokyonight"
|
||||
"bufdelete-nvim"
|
||||
"nvim-cmp"
|
||||
"cmp-nvim-lsp"
|
||||
"cmp-buffer"
|
||||
"cmp-vsnip"
|
||||
"cmp-path"
|
||||
"cmp-treesitter"
|
||||
"crates-nvim"
|
||||
"vim-vsnip"
|
||||
"nvim-code-action-menu"
|
||||
"trouble"
|
||||
"none-ls"
|
||||
"which-key"
|
||||
"indent-blankline"
|
||||
"nvim-cursorline"
|
||||
"sqls-nvim"
|
||||
"glow-nvim"
|
||||
"telescope"
|
||||
"rust-tools"
|
||||
"onedark"
|
||||
"catppuccin"
|
||||
"dracula"
|
||||
"oxocarbon"
|
||||
"gruvbox"
|
||||
"rose-pine"
|
||||
"minimap-vim"
|
||||
"dashboard-nvim"
|
||||
"alpha-nvim"
|
||||
"scrollbar-nvim"
|
||||
"codewindow-nvim"
|
||||
"nvim-notify"
|
||||
"cinnamon-nvim"
|
||||
"cheatsheet-nvim"
|
||||
"ccc"
|
||||
"cellular-automaton"
|
||||
"neocord"
|
||||
"icon-picker-nvim"
|
||||
"dressing-nvim"
|
||||
"orgmode-nvim"
|
||||
"obsidian-nvim"
|
||||
"vim-markdown"
|
||||
"tabular"
|
||||
"toggleterm-nvim"
|
||||
"noice-nvim"
|
||||
"nui-nvim"
|
||||
"copilot-lua"
|
||||
"tabnine-nvim"
|
||||
"nvim-session-manager"
|
||||
"gesture-nvim"
|
||||
"comment-nvim"
|
||||
"kommentary"
|
||||
"mind-nvim"
|
||||
"fidget-nvim"
|
||||
"diffview-nvim"
|
||||
"todo-comments"
|
||||
"flutter-tools"
|
||||
"flutter-tools-patched"
|
||||
"hop-nvim"
|
||||
"leap-nvim"
|
||||
"modes-nvim"
|
||||
"vim-repeat"
|
||||
"smartcolumn"
|
||||
"project-nvim"
|
||||
"neodev-nvim"
|
||||
"elixir-ls"
|
||||
"elixir-tools"
|
||||
"nvim-colorizer-lua"
|
||||
"vim-illuminate"
|
||||
"nvim-surround"
|
||||
"nvim-dap"
|
||||
"nvim-dap-ui"
|
||||
"nvim-navic"
|
||||
"nvim-navbuddy"
|
||||
"copilot-cmp"
|
||||
"lsp-lines"
|
||||
"vim-dirtytalk"
|
||||
"highlight-undo"
|
||||
"nvim-docs-view"
|
||||
];
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.attrsets) attrNames mapAttrs' filterAttrs nameValuePair;
|
||||
inherit (lib.strings) hasPrefix removePrefix isString;
|
||||
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.
|
||||
fromInputs = {
|
||||
inputs,
|
||||
prefix,
|
||||
}:
|
||||
mapAttrs' (n: v: nameValuePair (removePrefix prefix n) {src = v;}) (filterAttrs (n: _: hasPrefix prefix n) inputs);
|
||||
|
||||
# Get the names of all flake inputs that start with the given prefix.
|
||||
pluginInputNames = attrNames (fromInputs {
|
||||
inherit inputs;
|
||||
prefix = "plugin-";
|
||||
});
|
||||
|
||||
# You can either use the name of the plugin or a package.
|
||||
pluginType = with types;
|
||||
nullOr (
|
||||
either
|
||||
package
|
||||
(enum availablePlugins)
|
||||
);
|
||||
pluginType = nullOr (
|
||||
either
|
||||
package
|
||||
(enum (pluginInputNames ++ ["nvim-treesitter" "flutter-tools-patched" "vim-repeat"]))
|
||||
);
|
||||
|
||||
pluginsType = types.listOf pluginType;
|
||||
pluginsType = listOf pluginType;
|
||||
|
||||
extraPluginType = with types;
|
||||
submodule {
|
||||
options = {
|
||||
package = mkOption {
|
||||
type = pluginType;
|
||||
description = "Plugin Package.";
|
||||
};
|
||||
after = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Setup this plugin after the following ones.";
|
||||
};
|
||||
setup = mkOption {
|
||||
type = lines;
|
||||
default = "";
|
||||
description = "Lua code to run during setup.";
|
||||
example = "require('aerial').setup {}";
|
||||
};
|
||||
extraPluginType = submodule {
|
||||
options = {
|
||||
package = mkOption {
|
||||
type = pluginType;
|
||||
description = "Plugin Package.";
|
||||
};
|
||||
|
||||
after = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Setup this plugin after the following ones.";
|
||||
};
|
||||
|
||||
setup = mkOption {
|
||||
type = lines;
|
||||
default = "";
|
||||
description = "Lua code to run during setup.";
|
||||
example = "require('aerial').setup {}";
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
inherit extraPluginType;
|
||||
inherit extraPluginType fromInputs;
|
||||
|
||||
pluginsOpt = {
|
||||
description,
|
||||
example,
|
||||
default ? [],
|
||||
}:
|
||||
mkOption {
|
||||
inherit description default;
|
||||
inherit example description default;
|
||||
type = pluginsType;
|
||||
};
|
||||
|
||||
# opts is a attrset of options, example:
|
||||
# ```
|
||||
# mkPluginSetupOption "telescope" {
|
||||
# file_ignore_patterns = mkOption {
|
||||
# description = "...";
|
||||
# type = types.listOf types.str;
|
||||
# default = [];
|
||||
# };
|
||||
# layout_config.horizontal = mkOption {...};
|
||||
# }
|
||||
# ```
|
||||
luaInline = lib.mkOptionType {
|
||||
name = "luaInline";
|
||||
check = x: lib.nvim.lua.isLuaInline x;
|
||||
};
|
||||
|
||||
/*
|
||||
opts is a attrset of options, example:
|
||||
```
|
||||
mkPluginSetupOption "telescope" {
|
||||
file_ignore_patterns = mkOption {
|
||||
description = "...";
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
};
|
||||
layout_config.horizontal = mkOption {...};
|
||||
}
|
||||
```
|
||||
*/
|
||||
mkPluginSetupOption = pluginName: opts:
|
||||
mkOption {
|
||||
description = "Option table to pass into the setup function of " + pluginName;
|
||||
description = ''
|
||||
Option table to pass into the setup function of ${pluginName}
|
||||
|
||||
You can pass in any additional options even if they're
|
||||
not listed in the docs
|
||||
'';
|
||||
|
||||
default = {};
|
||||
type = types.submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
type = submodule {
|
||||
freeformType = attrsOf anything;
|
||||
options = opts;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{lib}: let
|
||||
inherit (builtins) isInt isBool toJSON;
|
||||
let
|
||||
inherit (builtins) isInt isBool toJSON toString;
|
||||
in rec {
|
||||
# yes? no.
|
||||
yesNo = value:
|
||||
|
@ -16,7 +16,7 @@ in rec {
|
|||
# convert a literal value to a vim compliant value
|
||||
valToVim = val:
|
||||
if (isInt val)
|
||||
then (builtins.toString val)
|
||||
then (toString val)
|
||||
else
|
||||
(
|
||||
if (isBool val)
|
||||
|
|
|
@ -1,113 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
|
||||
cfg = config.vim.assistant.copilot;
|
||||
in {
|
||||
options.vim.assistant.copilot = {
|
||||
enable = mkEnableOption "GitHub Copilot AI assistant";
|
||||
cmp.enable = mkEnableOption "nvim-cmp integration for GitHub Copilot";
|
||||
|
||||
panel = {
|
||||
position = mkOption {
|
||||
type = types.enum [
|
||||
"bottom"
|
||||
"top"
|
||||
"left"
|
||||
"right"
|
||||
];
|
||||
default = "bottom";
|
||||
description = "Panel position";
|
||||
};
|
||||
ratio = mkOption {
|
||||
type = types.float;
|
||||
default = 0.4;
|
||||
description = "Panel size";
|
||||
};
|
||||
};
|
||||
|
||||
mappings = {
|
||||
panel = {
|
||||
jumpPrev = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = "[[";
|
||||
description = "Jump to previous suggestion";
|
||||
};
|
||||
jumpNext = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = "]]";
|
||||
description = "Jump to next suggestion";
|
||||
};
|
||||
accept = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = "<CR>";
|
||||
description = "Accept suggestion";
|
||||
};
|
||||
refresh = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = "gr";
|
||||
description = "Refresh suggestions";
|
||||
};
|
||||
open = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = "<M-CR>";
|
||||
description = "Open suggestions";
|
||||
};
|
||||
};
|
||||
suggestion = {
|
||||
accept = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = "<M-l>";
|
||||
description = "Accept suggetion";
|
||||
};
|
||||
acceptWord = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Accept next word";
|
||||
};
|
||||
acceptLine = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Accept next line";
|
||||
};
|
||||
prev = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = "<M-[>";
|
||||
description = "Previous suggestion";
|
||||
};
|
||||
next = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = "<M-]>";
|
||||
description = "Next suggestion";
|
||||
};
|
||||
dismiss = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = "<C-]>";
|
||||
description = "Dismiss suggestion";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
copilotNodeCommand = mkOption {
|
||||
type = types.str;
|
||||
default = "${lib.getExe cfg.copilotNodePackage}";
|
||||
description = ''
|
||||
The command that will be executed to initiate nodejs for GitHub Copilot.
|
||||
Recommended to leave as default.
|
||||
'';
|
||||
};
|
||||
|
||||
copilotNodePackage = mkOption {
|
||||
type = with types; nullOr package;
|
||||
default = pkgs.nodejs-slim;
|
||||
description = ''
|
||||
The nodeJS package that will be used for GitHub Copilot. If you are using a custom node command
|
||||
you may want to set this option to null so that the package is not pulled from nixpkgs.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
_: {
|
||||
imports = [
|
||||
./copilot
|
||||
# ./tabnine.nix # removed until I find a way around the initialisation script the plugin requires
|
||||
];
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) toJSON;
|
||||
inherit (lib) mkIf mkMerge mkExprBinding boolToString nvim;
|
||||
|
||||
cfg = config.vim.assistant.tabnine;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["tabnine-nvim"];
|
||||
|
||||
vim.maps.insert = mkMerge [
|
||||
(mkExprBinding cfg.mappings.accept ''
|
||||
function()
|
||||
local state = require("tabnine.state")
|
||||
local completion = require("tabnine.completion")
|
||||
|
||||
if not state.completions_cache then
|
||||
return "${toJSON cfg.mappings.accept}"
|
||||
end
|
||||
|
||||
vim.schedule(completion.accept)
|
||||
end
|
||||
'' "orzel")
|
||||
(mkExprBinding cfg.mappings.dismiss ''
|
||||
function()
|
||||
local state = require("tabnine.state")
|
||||
local completion = require("tabnine.completion")
|
||||
|
||||
if not state.completions_cache then
|
||||
return "${toJSON cfg.mappings.dismiss}"
|
||||
end
|
||||
|
||||
vim.schedule(function()
|
||||
completion.clear()
|
||||
state.completions_cache = nil
|
||||
end)
|
||||
end
|
||||
'' "orzel")
|
||||
];
|
||||
|
||||
vim.luaConfigRC.tabnine-nvim = nvim.dag.entryAnywhere ''
|
||||
require('tabnine').setup({
|
||||
disable_auto_comment = ${boolToString cfg.disable_auto_comment},
|
||||
accept_keymap = null,
|
||||
dismiss_keymap = null,
|
||||
debounce_ms = ${cfg.debounce_ms},
|
||||
exclude_filetypes = ${cfg.exclude_filetypes},
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib) mkEnableOption mkOption types mkMappingOption;
|
||||
in {
|
||||
options.vim.assistant.tabnine = {
|
||||
enable = mkEnableOption "Tabnine assistant";
|
||||
|
||||
disable_auto_comment = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Disable auto comment";
|
||||
};
|
||||
|
||||
mappings = {
|
||||
accept = mkMappingOption "Accept [Tabnine]" "<Tab>";
|
||||
dismiss = mkMappingOption "Dismiss [Tabnine]" "<C-]>";
|
||||
};
|
||||
|
||||
debounce_ms = mkOption {
|
||||
type = types.int;
|
||||
default = 800;
|
||||
description = "Debounce ms";
|
||||
};
|
||||
|
||||
exclude_filetypes = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = ["TelescopePrompt" "NvimTree" "alpha"];
|
||||
description = "Exclude filetypes";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf nvim optionalString boolToString;
|
||||
|
||||
cfg = config.vim.autopairs;
|
||||
in {
|
||||
config =
|
||||
mkIf (cfg.enable)
|
||||
{
|
||||
vim.startPlugins = ["nvim-autopairs"];
|
||||
|
||||
vim.luaConfigRC.autopairs = nvim.dag.entryAnywhere ''
|
||||
require("nvim-autopairs").setup{}
|
||||
${optionalString (config.vim.autocomplete.type == "nvim-compe") ''
|
||||
require('nvim-autopairs.completion.compe').setup({
|
||||
map_cr = ${boolToString cfg.nvim-compe.map_cr},
|
||||
map_complete = ${boolToString cfg.nvim-compe.map_complete},
|
||||
auto_select = ${boolToString cfg.nvim-compe.auto_select},
|
||||
})
|
||||
''}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
in {
|
||||
options.vim = {
|
||||
autopairs = {
|
||||
enable = mkEnableOption "autopairs" // {default = false;};
|
||||
|
||||
type = mkOption {
|
||||
type = types.enum ["nvim-autopairs"];
|
||||
default = "nvim-autopairs";
|
||||
description = "Set the autopairs type. Options: nvim-autopairs [nvim-autopairs]";
|
||||
};
|
||||
|
||||
nvim-compe = {
|
||||
map_cr = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''map <CR> on insert mode'';
|
||||
};
|
||||
|
||||
map_complete = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "auto insert `(` after select function or method item";
|
||||
};
|
||||
|
||||
auto_select = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "auto select first item";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,185 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) concatStringsSep;
|
||||
inherit (lib) optionalString mkIf nvim;
|
||||
|
||||
cfg = config.vim;
|
||||
in {
|
||||
config = {
|
||||
vim.startPlugins = ["plenary-nvim"] ++ lib.optionals (cfg.spellChecking.enableProgrammingWordList) ["vim-dirtytalk"];
|
||||
|
||||
vim.maps.normal =
|
||||
mkIf cfg.disableArrows {
|
||||
"<up>" = {
|
||||
action = "<nop>";
|
||||
|
||||
noremap = false;
|
||||
};
|
||||
"<down>" = {
|
||||
action = "<nop>";
|
||||
|
||||
noremap = false;
|
||||
};
|
||||
"<left>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
"<right>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
}
|
||||
// mkIf cfg.mapLeaderSpace {
|
||||
"<space>" = {
|
||||
action = "<nop>";
|
||||
};
|
||||
};
|
||||
|
||||
vim.maps.insert = mkIf cfg.disableArrows {
|
||||
"<up>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
"<down>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
"<left>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
"<right>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
};
|
||||
|
||||
vim.configRC.basic = nvim.dag.entryAfter ["globalsScript"] ''
|
||||
" Settings that are set for everything
|
||||
set encoding=utf-8
|
||||
set mouse=${cfg.mouseSupport}
|
||||
set tabstop=${toString cfg.tabWidth}
|
||||
set shiftwidth=${toString cfg.tabWidth}
|
||||
set softtabstop=${toString cfg.tabWidth}
|
||||
set expandtab
|
||||
set cmdheight=${toString cfg.cmdHeight}
|
||||
set updatetime=${toString cfg.updateTime}
|
||||
set shortmess+=c
|
||||
set tm=${toString cfg.mapTimeout}
|
||||
set hidden
|
||||
set cursorlineopt=${toString cfg.cursorlineOpt}
|
||||
set scrolloff=${toString cfg.scrollOffset}
|
||||
|
||||
${optionalString cfg.debugMode.enable ''
|
||||
" Debug mode settings
|
||||
set verbose=${toString cfg.debugMode.level}
|
||||
set verbosefile=${cfg.debugMode.logFile}
|
||||
''}
|
||||
|
||||
${optionalString cfg.splitBelow ''
|
||||
set splitbelow
|
||||
''}
|
||||
|
||||
${optionalString cfg.splitRight ''
|
||||
set splitright
|
||||
''}
|
||||
|
||||
${optionalString cfg.showSignColumn ''
|
||||
set signcolumn=yes
|
||||
''}
|
||||
|
||||
${optionalString cfg.autoIndent ''
|
||||
set autoindent
|
||||
''}
|
||||
|
||||
${optionalString cfg.preventJunkFiles ''
|
||||
set noswapfile
|
||||
set nobackup
|
||||
set nowritebackup
|
||||
''}
|
||||
|
||||
${optionalString (cfg.bell == "none") ''
|
||||
set noerrorbells
|
||||
set novisualbell
|
||||
''}
|
||||
|
||||
${optionalString (cfg.bell == "on") ''
|
||||
set novisualbell
|
||||
''}
|
||||
|
||||
${optionalString (cfg.bell == "visual") ''
|
||||
set noerrorbells
|
||||
''}
|
||||
|
||||
${optionalString (cfg.lineNumberMode == "relative") ''
|
||||
set relativenumber
|
||||
''}
|
||||
|
||||
${optionalString (cfg.lineNumberMode == "number") ''
|
||||
set number
|
||||
''}
|
||||
|
||||
${optionalString (cfg.lineNumberMode == "relNumber") ''
|
||||
set number relativenumber
|
||||
''}
|
||||
|
||||
${optionalString cfg.useSystemClipboard ''
|
||||
set clipboard+=unnamedplus
|
||||
''}
|
||||
|
||||
${optionalString cfg.mapLeaderSpace ''
|
||||
let mapleader=" "
|
||||
let maplocalleader=" "
|
||||
''}
|
||||
|
||||
${optionalString cfg.syntaxHighlighting ''
|
||||
syntax on
|
||||
''}
|
||||
|
||||
${optionalString (!cfg.wordWrap) ''
|
||||
set nowrap
|
||||
''}
|
||||
|
||||
${optionalString cfg.hideSearchHighlight ''
|
||||
set nohlsearch
|
||||
set incsearch
|
||||
''}
|
||||
|
||||
${optionalString cfg.colourTerm ''
|
||||
set termguicolors
|
||||
set t_Co=256
|
||||
''}
|
||||
|
||||
${optionalString (!cfg.enableEditorconfig) ''
|
||||
let g:editorconfig = v:false
|
||||
''}
|
||||
|
||||
${optionalString cfg.spellChecking.enable ''
|
||||
set spell
|
||||
set spelllang=${concatStringsSep "," cfg.spellChecking.languages}${optionalString cfg.spellChecking.enableProgrammingWordList ",programming"}
|
||||
''}
|
||||
|
||||
${optionalString (cfg.leaderKey != null) ''
|
||||
let mapleader = "${toString cfg.leaderKey}"
|
||||
''}
|
||||
|
||||
${optionalString (cfg.searchCase == "ignore") ''
|
||||
set nosmartcase
|
||||
set ignorecase
|
||||
''}
|
||||
|
||||
${optionalString (cfg.searchCase == "smart") ''
|
||||
set smartcase
|
||||
set ignorecase
|
||||
''}
|
||||
|
||||
${optionalString (cfg.searchCase == "sensitive") ''
|
||||
set nosmartcase
|
||||
set noignorecase
|
||||
''}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,200 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption;
|
||||
inherit (lib.types) types;
|
||||
in {
|
||||
options.vim = {
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.neovim-unwrapped;
|
||||
description = ''
|
||||
The neovim package to use. You will need to use an unwrapped package for this option to work as intended.
|
||||
'';
|
||||
};
|
||||
|
||||
debugMode = {
|
||||
enable = mkEnableOption "debug mode";
|
||||
level = mkOption {
|
||||
type = types.int;
|
||||
default = 20;
|
||||
description = "Set the debug level";
|
||||
};
|
||||
|
||||
logFile = mkOption {
|
||||
type = types.path;
|
||||
default = "/tmp/nvim.log";
|
||||
description = "Set the log file";
|
||||
};
|
||||
};
|
||||
|
||||
enableLuaLoader = mkEnableOption "experimental Lua module loader to speed up the start up process";
|
||||
|
||||
leaderKey = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = "The leader key to be used internally";
|
||||
};
|
||||
|
||||
spellChecking = {
|
||||
enable = mkEnableOption "neovim's built-in spellchecking";
|
||||
enableProgrammingWordList = mkEnableOption "vim-dirtytalk, a wordlist for programmers, that includes programming words";
|
||||
languages = mkOption {
|
||||
type = with types; listOf str;
|
||||
description = "The languages to be used for spellchecking";
|
||||
default = ["en"];
|
||||
example = ["en" "de"];
|
||||
};
|
||||
};
|
||||
|
||||
colourTerm = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Set terminal up for 256 colours";
|
||||
};
|
||||
|
||||
disableArrows = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Set to prevent arrow keys from moving cursor";
|
||||
};
|
||||
|
||||
hideSearchHighlight = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Hide search highlight so it doesn't stay highlighted";
|
||||
};
|
||||
|
||||
scrollOffset = mkOption {
|
||||
type = types.int;
|
||||
default = 8;
|
||||
description = "Start scrolling this number of lines from the top or bottom of the page.";
|
||||
};
|
||||
|
||||
wordWrap = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable word wrapping.";
|
||||
};
|
||||
|
||||
syntaxHighlighting = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable syntax highlighting";
|
||||
};
|
||||
|
||||
mapLeaderSpace = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Map the space key to leader key";
|
||||
};
|
||||
|
||||
useSystemClipboard = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Make use of the clipboard for default yank and paste operations. Don't use * and +";
|
||||
};
|
||||
|
||||
mouseSupport = mkOption {
|
||||
type = with types; enum ["a" "n" "v" "i" "c"];
|
||||
default = "a";
|
||||
description = ''
|
||||
Set modes for mouse support.
|
||||
|
||||
* a - all
|
||||
* n - normal
|
||||
* v - visual
|
||||
* i - insert
|
||||
* c - command
|
||||
'';
|
||||
};
|
||||
|
||||
lineNumberMode = mkOption {
|
||||
type = with types; enum ["relative" "number" "relNumber" "none"];
|
||||
default = "relNumber";
|
||||
description = ''
|
||||
How line numbers are displayed. Available options are
|
||||
none, relative, number, relNumber
|
||||
'';
|
||||
};
|
||||
|
||||
preventJunkFiles = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Prevent swapfile, backupfile from being created";
|
||||
};
|
||||
|
||||
tabWidth = mkOption {
|
||||
type = types.int;
|
||||
default = 4;
|
||||
description = "Set the width of tabs";
|
||||
};
|
||||
|
||||
autoIndent = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable auto indent";
|
||||
};
|
||||
|
||||
cmdHeight = mkOption {
|
||||
type = types.int;
|
||||
default = 1;
|
||||
description = "Height of the command pane";
|
||||
};
|
||||
|
||||
updateTime = mkOption {
|
||||
type = types.int;
|
||||
default = 300;
|
||||
description = "The number of milliseconds till Cursor Hold event is fired";
|
||||
};
|
||||
|
||||
showSignColumn = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Show the sign column";
|
||||
};
|
||||
|
||||
bell = mkOption {
|
||||
type = types.enum ["none" "visual" "on"];
|
||||
default = "none";
|
||||
description = "Set how bells are handled. Options: on, visual or none";
|
||||
};
|
||||
|
||||
mapTimeout = mkOption {
|
||||
type = types.int;
|
||||
default = 500;
|
||||
description = "Timeout in ms that neovim will wait for mapped action to complete";
|
||||
};
|
||||
|
||||
splitBelow = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "New splits will open below instead of on top";
|
||||
};
|
||||
|
||||
splitRight = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "New splits will open to the right";
|
||||
};
|
||||
enableEditorconfig = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Follow editorconfig rules in current directory";
|
||||
};
|
||||
|
||||
cursorlineOpt = mkOption {
|
||||
type = types.enum ["line" "screenline" "number" "both"];
|
||||
default = "line";
|
||||
description = "Highlight the text line of the cursor with CursorLine hl-CursorLine";
|
||||
};
|
||||
|
||||
searchCase = mkOption {
|
||||
type = types.enum ["ignore" "smart" "sensitive"];
|
||||
default = "sensitive";
|
||||
description = "Set the case sensitivity of search";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,387 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrValues attrNames map mapAttrs toJSON isString concatStringsSep filter;
|
||||
inherit (lib) mkOption types mapAttrsFlatten filterAttrs optionalString getAttrs literalExpression;
|
||||
inherit (lib) nvim;
|
||||
inherit (nvim.lua) toLuaObject;
|
||||
inherit (nvim.vim) valToVim;
|
||||
|
||||
cfg = config.vim;
|
||||
|
||||
wrapLuaConfig = luaConfig: ''
|
||||
lua << EOF
|
||||
${optionalString cfg.enableLuaLoader ''
|
||||
vim.loader.enable()
|
||||
''}
|
||||
${luaConfig}
|
||||
EOF
|
||||
'';
|
||||
|
||||
mkBool = value: description:
|
||||
mkOption {
|
||||
type = types.bool;
|
||||
default = value;
|
||||
inherit description;
|
||||
};
|
||||
|
||||
# Most of the keybindings code is highly inspired by pta2002/nixvim. Thank you!
|
||||
mapConfigOptions = {
|
||||
silent =
|
||||
mkBool false
|
||||
"Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
|
||||
|
||||
nowait =
|
||||
mkBool false
|
||||
"Whether to wait for extra input on ambiguous mappings. Equivalent to adding <nowait> to a map.";
|
||||
|
||||
script =
|
||||
mkBool false
|
||||
"Equivalent to adding <script> to a map.";
|
||||
|
||||
expr =
|
||||
mkBool false
|
||||
"Means that the action is actually an expression. Equivalent to adding <expr> to a map.";
|
||||
|
||||
unique =
|
||||
mkBool false
|
||||
"Whether to fail if the map is already defined. Equivalent to adding <unique> to a map.";
|
||||
|
||||
noremap =
|
||||
mkBool true
|
||||
"Whether to use the 'noremap' variant of the command, ignoring any custom mappings on the defined action. It is highly advised to keep this on, which is the default.";
|
||||
|
||||
desc = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "A description of this keybind, to be shown in which-key, if you have it enabled.";
|
||||
};
|
||||
};
|
||||
|
||||
genMaps = mode: maps: let
|
||||
/*
|
||||
Take a user-defined action (string or attrs) and return the following attribute set:
|
||||
{
|
||||
action = (string) the actual action to map to this key
|
||||
config = (attrs) the configuration options for this mapping (noremap, silent...)
|
||||
}
|
||||
*/
|
||||
normalizeAction = action: let
|
||||
# Extract the values of the config options that have been explicitly set by the user
|
||||
config =
|
||||
filterAttrs (_: v: v != null)
|
||||
(getAttrs (attrNames mapConfigOptions) action);
|
||||
in {
|
||||
config =
|
||||
if config == {}
|
||||
then {"__empty" = null;}
|
||||
else config;
|
||||
action =
|
||||
if action.lua
|
||||
then {"__raw" = action.action;}
|
||||
else action.action;
|
||||
};
|
||||
in
|
||||
attrValues (mapAttrs
|
||||
(key: action: let
|
||||
normalizedAction = normalizeAction action;
|
||||
in {
|
||||
inherit (normalizedAction) action config;
|
||||
inherit key;
|
||||
inherit mode;
|
||||
})
|
||||
maps);
|
||||
|
||||
mapOption = types.submodule {
|
||||
options =
|
||||
mapConfigOptions
|
||||
// {
|
||||
action = mkOption {
|
||||
type = types.str;
|
||||
description = "The action to execute.";
|
||||
};
|
||||
|
||||
lua = mkOption {
|
||||
type = types.bool;
|
||||
description = ''
|
||||
If true, `action` is considered to be lua code.
|
||||
Thus, it will not be wrapped in `""`.
|
||||
'';
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mapOptions = mode:
|
||||
mkOption {
|
||||
description = "Mappings for ${mode} mode";
|
||||
type = types.attrsOf mapOption;
|
||||
default = {};
|
||||
};
|
||||
in {
|
||||
options = {
|
||||
assertions = lib.mkOption {
|
||||
type = with types; listOf unspecified;
|
||||
internal = true;
|
||||
default = [];
|
||||
example = literalExpression ''
|
||||
[
|
||||
{
|
||||
assertion = false;
|
||||
message = "you can't enable this for that reason";
|
||||
}
|
||||
]
|
||||
'';
|
||||
};
|
||||
|
||||
warnings = mkOption {
|
||||
internal = true;
|
||||
default = [];
|
||||
type = with types; listOf str;
|
||||
example = ["The `foo' service is deprecated and will go away soon!"];
|
||||
description = lib.mdDoc ''
|
||||
This option allows modules to show warnings to users during
|
||||
the evaluation of the system configuration.
|
||||
'';
|
||||
};
|
||||
|
||||
vim = {
|
||||
viAlias = mkOption {
|
||||
description = "Enable vi alias";
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
|
||||
vimAlias = mkOption {
|
||||
description = "Enable vim alias";
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
|
||||
configRC = mkOption {
|
||||
description = "vimrc contents";
|
||||
type = types.oneOf [(nvim.types.dagOf types.lines) types.str];
|
||||
default = {};
|
||||
};
|
||||
|
||||
luaConfigRC = mkOption {
|
||||
description = "vim lua config";
|
||||
type = types.oneOf [(nvim.types.dagOf types.lines) types.str];
|
||||
default = {};
|
||||
};
|
||||
|
||||
builtConfigRC = mkOption {
|
||||
internal = true;
|
||||
type = types.lines;
|
||||
description = "The built config for neovim after resolving the DAG";
|
||||
};
|
||||
|
||||
startPlugins = nvim.types.pluginsOpt {
|
||||
default = [];
|
||||
description = "List of plugins to startup.";
|
||||
};
|
||||
|
||||
optPlugins = nvim.types.pluginsOpt {
|
||||
default = [];
|
||||
description = "List of plugins to optionally load";
|
||||
};
|
||||
|
||||
extraPlugins = mkOption {
|
||||
type = types.attrsOf nvim.types.extraPluginType;
|
||||
default = {};
|
||||
description = ''
|
||||
List of plugins and related config.
|
||||
Note that these are setup after builtin plugins.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
with pkgs.vimPlugins; {
|
||||
aerial = {
|
||||
package = aerial-nvim;
|
||||
setup = "require('aerial').setup {}";
|
||||
};
|
||||
harpoon = {
|
||||
package = harpoon;
|
||||
setup = "require('harpoon').setup {}";
|
||||
after = ["aerial"];
|
||||
};
|
||||
}'';
|
||||
};
|
||||
|
||||
luaPackages = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = ''
|
||||
List of lua packages to install.
|
||||
'';
|
||||
};
|
||||
|
||||
globals = mkOption {
|
||||
default = {};
|
||||
description = "Set containing global variable values";
|
||||
type = types.attrs;
|
||||
};
|
||||
|
||||
maps = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
normal = mapOptions "normal";
|
||||
insert = mapOptions "insert";
|
||||
select = mapOptions "select";
|
||||
visual = mapOptions "visual and select";
|
||||
terminal = mapOptions "terminal";
|
||||
normalVisualOp = mapOptions "normal, visual, select and operator-pending (same as plain 'map')";
|
||||
|
||||
visualOnly = mapOptions "visual only";
|
||||
operator = mapOptions "operator-pending";
|
||||
insertCommand = mapOptions "insert and command-line";
|
||||
lang = mapOptions "insert, command-line and lang-arg";
|
||||
command = mapOptions "command-line";
|
||||
};
|
||||
};
|
||||
default = {};
|
||||
description = ''
|
||||
Custom keybindings for any mode.
|
||||
|
||||
For plain maps (e.g. just 'map' or 'remap') use maps.normalVisualOp.
|
||||
'';
|
||||
|
||||
example = ''
|
||||
maps = {
|
||||
normal."<leader>m" = {
|
||||
silent = true;
|
||||
action = "<cmd>make<CR>";
|
||||
}; # Same as nnoremap <leader>m <silent> <cmd>make<CR>
|
||||
};
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
filterNonNull = mappings: filterAttrs (_name: value: value != null) mappings;
|
||||
globalsScript =
|
||||
mapAttrsFlatten (name: value: "let g:${name}=${valToVim value}")
|
||||
(filterNonNull cfg.globals);
|
||||
|
||||
toLuaBindings = mode: maps:
|
||||
map (value: ''
|
||||
vim.keymap.set(${toLuaObject mode}, ${toLuaObject value.key}, ${toLuaObject value.action}, ${toLuaObject value.config})
|
||||
'') (genMaps mode maps);
|
||||
|
||||
# I'm not sure if every one of these will work.
|
||||
allmap = toLuaBindings "" config.vim.maps.normalVisualOp;
|
||||
nmap = toLuaBindings "n" config.vim.maps.normal;
|
||||
vmap = toLuaBindings "v" config.vim.maps.visual;
|
||||
xmap = toLuaBindings "x" config.vim.maps.visualOnly;
|
||||
smap = toLuaBindings "s" config.vim.maps.select;
|
||||
imap = toLuaBindings "i" config.vim.maps.insert;
|
||||
cmap = toLuaBindings "c" config.vim.maps.command;
|
||||
tmap = toLuaBindings "t" config.vim.maps.terminal;
|
||||
lmap = toLuaBindings "l" config.vim.maps.lang;
|
||||
omap = toLuaBindings "o" config.vim.maps.operator;
|
||||
icmap = toLuaBindings "ic" config.vim.maps.insertCommand;
|
||||
|
||||
resolveDag = {
|
||||
name,
|
||||
dag,
|
||||
mapResult,
|
||||
}: let
|
||||
# When the value is a string, default it to dag.entryAnywhere
|
||||
finalDag = lib.mapAttrs (_: value:
|
||||
if isString value
|
||||
then nvim.dag.entryAnywhere value
|
||||
else value)
|
||||
dag;
|
||||
sortedDag = nvim.dag.topoSort finalDag;
|
||||
result =
|
||||
if sortedDag ? result
|
||||
then mapResult sortedDag.result
|
||||
else abort ("Dependency cycle in ${name}: " + toJSON sortedDag);
|
||||
in
|
||||
result;
|
||||
in {
|
||||
vim = {
|
||||
startPlugins = map (x: x.package) (attrValues cfg.extraPlugins);
|
||||
configRC = {
|
||||
globalsScript = nvim.dag.entryAnywhere (concatStringsSep "\n" globalsScript);
|
||||
|
||||
luaScript = let
|
||||
mkSection = r: ''
|
||||
-- SECTION: ${r.name}
|
||||
${r.data}
|
||||
'';
|
||||
mapResult = r: (wrapLuaConfig (concatStringsSep "\n" (map mkSection r)));
|
||||
luaConfig = resolveDag {
|
||||
name = "lua config script";
|
||||
dag = cfg.luaConfigRC;
|
||||
inherit mapResult;
|
||||
};
|
||||
in
|
||||
nvim.dag.entryAfter ["globalsScript"] luaConfig;
|
||||
|
||||
extraPluginConfigs = let
|
||||
mkSection = r: ''
|
||||
-- SECTION: ${r.name}
|
||||
${r.data}
|
||||
'';
|
||||
mapResult = r: (wrapLuaConfig (concatStringsSep "\n" (map mkSection r)));
|
||||
extraPluginsDag = mapAttrs (_: {
|
||||
after,
|
||||
setup,
|
||||
...
|
||||
}:
|
||||
nvim.dag.entryAfter after setup)
|
||||
cfg.extraPlugins;
|
||||
pluginConfig = resolveDag {
|
||||
name = "extra plugins config";
|
||||
dag = extraPluginsDag;
|
||||
inherit mapResult;
|
||||
};
|
||||
in
|
||||
nvim.dag.entryAfter ["luaScript"] pluginConfig;
|
||||
|
||||
# This is probably not the right way to set the config. I'm not sure how it should look like.
|
||||
mappings = let
|
||||
maps = [
|
||||
nmap
|
||||
imap
|
||||
vmap
|
||||
xmap
|
||||
smap
|
||||
cmap
|
||||
omap
|
||||
tmap
|
||||
lmap
|
||||
icmap
|
||||
allmap
|
||||
];
|
||||
mapConfig = wrapLuaConfig (concatStringsSep "\n" (map (v: concatStringsSep "\n" v) maps));
|
||||
in
|
||||
nvim.dag.entryAfter ["globalsScript"] mapConfig;
|
||||
};
|
||||
|
||||
builtConfigRC = let
|
||||
failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions);
|
||||
|
||||
baseSystemAssertWarn =
|
||||
if failedAssertions != []
|
||||
then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
|
||||
else lib.showWarnings config.warnings;
|
||||
|
||||
mkSection = r: ''
|
||||
" SECTION: ${r.name}
|
||||
${r.data}
|
||||
'';
|
||||
mapResult = r: (concatStringsSep "\n" (map mkSection r));
|
||||
vimConfig = resolveDag {
|
||||
name = "vim config script";
|
||||
dag = cfg.configRC;
|
||||
inherit mapResult;
|
||||
};
|
||||
in
|
||||
baseSystemAssertWarn vimConfig;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption;
|
||||
in {
|
||||
options.vim.dashboard.alpha = {
|
||||
enable = mkEnableOption "dashboard via alpha.nvim";
|
||||
};
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption;
|
||||
in {
|
||||
options.vim.dashboard.dashboard-nvim = {
|
||||
enable = mkEnableOption "dashboard via dashboard.nvim";
|
||||
};
|
||||
}
|
|
@ -4,33 +4,50 @@ inputs: {
|
|||
lib ? pkgs.lib,
|
||||
check ? true,
|
||||
extraSpecialArgs ? {},
|
||||
extraModules ? [],
|
||||
}: let
|
||||
inherit (builtins) map filter isString toString getAttr;
|
||||
inherit (pkgs) wrapNeovim vimPlugins;
|
||||
inherit (pkgs) wrapNeovimUnstable vimPlugins;
|
||||
inherit (pkgs.vimUtils) buildVimPlugin;
|
||||
inherit (pkgs.neovimUtils) makeNeovimConfig;
|
||||
inherit (lib.strings) makeBinPath escapeShellArgs concatStringsSep;
|
||||
inherit (lib.lists) concatLists optional;
|
||||
inherit (lib.attrsets) recursiveUpdate;
|
||||
inherit (lib.asserts) assertMsg;
|
||||
|
||||
extendedLib = import ../lib/stdlib-extended.nix lib;
|
||||
# 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
|
||||
# check can be disabled while calling this file is called
|
||||
# to avoid checking in all modules
|
||||
nvimModules = import ./modules.nix {
|
||||
inherit check pkgs;
|
||||
lib = extendedLib;
|
||||
};
|
||||
|
||||
# evaluate the extended library with the modules
|
||||
# optionally with any additional modules passed by the user
|
||||
module = extendedLib.evalModules {
|
||||
modules = [configuration] ++ nvimModules;
|
||||
specialArgs = {modulesPath = toString ./.;} // extraSpecialArgs;
|
||||
specialArgs = recursiveUpdate {modulesPath = toString ./.;} extraSpecialArgs;
|
||||
modules = concatLists [[configuration] nvimModules extraModules];
|
||||
};
|
||||
|
||||
# alias to the internal configuration
|
||||
vimOptions = module.config.vim;
|
||||
|
||||
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
|
||||
|
||||
# build a vim plugin with the given name and arguments
|
||||
# if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug
|
||||
# instead
|
||||
buildPlug = {pname, ...} @ args:
|
||||
assert lib.asserts.assertMsg (pname != "nvim-treesitter") "Use buildTreesitterPlug for building nvim-treesitter.";
|
||||
assert assertMsg (pname != "nvim-treesitter") "Use buildTreesitterPlug for building nvim-treesitter.";
|
||||
buildVimPlugin (args
|
||||
// {
|
||||
version = "master";
|
||||
src = getAttr pname inputs;
|
||||
src = getAttr ("plugin-" + pname) inputs;
|
||||
});
|
||||
|
||||
buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars);
|
||||
|
@ -57,23 +74,51 @@ inputs: {
|
|||
(f: f != null)
|
||||
plugins);
|
||||
|
||||
neovim = wrapNeovim vimOptions.package {
|
||||
inherit (vimOptions) viAlias;
|
||||
inherit (vimOptions) vimAlias;
|
||||
# built (or "normalized") plugins that are modified
|
||||
builtStartPlugins = buildConfigPlugins vimOptions.startPlugins;
|
||||
builtOptPlugins = map (package: {
|
||||
plugin = package;
|
||||
optional = false;
|
||||
}) (buildConfigPlugins vimOptions.optPlugins);
|
||||
|
||||
inherit extraLuaPackages;
|
||||
# combine built start and optional plugins
|
||||
# into a single list
|
||||
plugins = builtStartPlugins ++ builtOptPlugins;
|
||||
|
||||
configure = {
|
||||
customRC = vimOptions.builtConfigRC;
|
||||
# additional Lua and Python3 packages, mapped to their respective functions
|
||||
# to conform to the format makeNeovimConfig expects. end user should
|
||||
# only ever need to pass a list of packages, which are modified
|
||||
# here
|
||||
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
|
||||
extraPython3Packages = ps: map (x: ps.${x}) vimOptions.python3Packages;
|
||||
|
||||
packages.myVimPackage = {
|
||||
start = buildConfigPlugins vimOptions.startPlugins;
|
||||
opt = buildConfigPlugins vimOptions.optPlugins;
|
||||
};
|
||||
};
|
||||
extraWrapperArgs =
|
||||
concatStringsSep " " (optional (vimOptions.extraPackages != []) ''--prefix PATH : "${makeBinPath vimOptions.extraPackages}"'');
|
||||
|
||||
# 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 plugins extraLuaPackages extraPython3Packages;
|
||||
customRC = vimOptions.builtConfigRC;
|
||||
};
|
||||
|
||||
neovim-wrapped = wrapNeovimUnstable vimOptions.package (recursiveUpdate neovimConfigured {
|
||||
wrapperArgs = escapeShellArgs neovimConfigured.wrapperArgs + " " + extraWrapperArgs;
|
||||
});
|
||||
in {
|
||||
inherit (module) options config;
|
||||
inherit (module._module.args) pkgs;
|
||||
inherit neovim;
|
||||
|
||||
# expose wrapped neovim-package
|
||||
neovim = neovim-wrapped;
|
||||
}
|
||||
|
|
|
@ -1,308 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkMerge mkBinding nvim boolToString;
|
||||
|
||||
cfg = config.vim.filetree.nvimTree;
|
||||
self = import ./nvimtree.nix {
|
||||
inherit pkgs;
|
||||
lib = lib;
|
||||
};
|
||||
mappings = self.options.vim.filetree.nvimTree.mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["nvim-tree-lua"];
|
||||
|
||||
vim.maps.normal = mkMerge [
|
||||
(mkBinding cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description)
|
||||
(mkBinding cfg.mappings.refresh ":NvimTreeRefresh<cr>" mappings.refresh.description)
|
||||
(mkBinding cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description)
|
||||
(mkBinding cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description)
|
||||
];
|
||||
|
||||
vim.luaConfigRC.nvimtreelua = nvim.dag.entryAnywhere ''
|
||||
${
|
||||
lib.optionalString (cfg.disableNetrw) ''
|
||||
-- disable netrew completely
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
''
|
||||
}
|
||||
|
||||
require'nvim-tree'.setup({
|
||||
disable_netrw = ${boolToString cfg.disableNetrw},
|
||||
hijack_netrw = ${boolToString cfg.hijackNetrw},
|
||||
auto_reload_on_write = ${boolToString cfg.autoreloadOnWrite},
|
||||
|
||||
sort = {
|
||||
sorter = "${cfg.sort.sorter}",
|
||||
folders_first = ${boolToString cfg.sort.foldersFirst},
|
||||
},
|
||||
|
||||
hijack_unnamed_buffer_when_opening = ${boolToString cfg.hijackUnnamedBufferWhenOpening},
|
||||
hijack_cursor = ${boolToString cfg.hijackCursor},
|
||||
root_dirs = ${nvim.lua.listToLuaTable cfg.rootDirs},
|
||||
prefer_startup_root = ${boolToString cfg.preferStartupRoot},
|
||||
sync_root_with_cwd = ${boolToString cfg.syncRootWithCwd},
|
||||
reload_on_bufenter = ${boolToString cfg.reloadOnBufEnter},
|
||||
respect_buf_cwd = ${boolToString cfg.respectBufCwd},
|
||||
|
||||
hijack_directories = {
|
||||
enable = ${boolToString cfg.hijackDirectories.enable},
|
||||
auto_open = ${boolToString cfg.hijackDirectories.autoOpen},
|
||||
},
|
||||
|
||||
update_focused_file = {
|
||||
enable = ${boolToString cfg.updateFocusedFile.enable},
|
||||
update_root = ${boolToString cfg.updateFocusedFile.updateRoot},
|
||||
ignore_list = ${nvim.lua.listToLuaTable cfg.updateFocusedFile.ignoreList},
|
||||
},
|
||||
|
||||
system_open = {
|
||||
cmd = "${cfg.systemOpen.cmd}",
|
||||
args = ${nvim.lua.listToLuaTable cfg.systemOpen.args},
|
||||
},
|
||||
|
||||
diagnostics = {
|
||||
enable = ${boolToString cfg.diagnostics.enable},
|
||||
icons = {
|
||||
hint = "${cfg.diagnostics.icons.hint}",
|
||||
info = "${cfg.diagnostics.icons.info}",
|
||||
warning = "${cfg.diagnostics.icons.warning}",
|
||||
error = "${cfg.diagnostics.icons.error}",
|
||||
},
|
||||
|
||||
severity = {
|
||||
min = vim.diagnostic.severity.${cfg.diagnostics.severity.min},
|
||||
max = vim.diagnostic.severity.${cfg.diagnostics.severity.max},
|
||||
},
|
||||
},
|
||||
|
||||
git = {
|
||||
enable = ${boolToString cfg.git.enable},
|
||||
show_on_dirs = ${boolToString cfg.git.showOnDirs},
|
||||
show_on_open_dirs = ${boolToString cfg.git.showOnOpenDirs},
|
||||
disable_for_dirs = ${nvim.lua.listToLuaTable cfg.git.disableForDirs},
|
||||
timeout = ${toString cfg.git.timeout},
|
||||
},
|
||||
|
||||
modified = {
|
||||
enable = ${boolToString cfg.modified.enable},
|
||||
show_on_dirs = ${boolToString cfg.modified.showOnDirs},
|
||||
show_on_open_dirs = ${boolToString cfg.modified.showOnOpenDirs},
|
||||
},
|
||||
|
||||
filesystem_watchers = {
|
||||
enable = ${boolToString cfg.filesystemWatchers.enable},
|
||||
debounce_delay = ${toString cfg.filesystemWatchers.debounceDelay},
|
||||
ignore_dirs = ${nvim.lua.listToLuaTable cfg.filesystemWatchers.ignoreDirs},
|
||||
},
|
||||
|
||||
select_prompts = ${boolToString cfg.selectPrompts},
|
||||
|
||||
view = {
|
||||
centralize_selection = ${boolToString cfg.view.centralizeSelection},
|
||||
cursorline = ${boolToString cfg.view.cursorline},
|
||||
debounce_delay = ${toString cfg.view.debounceDelay},
|
||||
width = ${nvim.lua.expToLua cfg.view.width},
|
||||
side = "${cfg.view.side}",
|
||||
preserve_window_proportions = ${boolToString cfg.view.preserveWindowProportions},
|
||||
number = ${boolToString cfg.view.number},
|
||||
relativenumber = ${boolToString cfg.view.relativenumber},
|
||||
signcolumn = "${cfg.view.signcolumn}",
|
||||
float = {
|
||||
enable = ${boolToString cfg.view.float.enable},
|
||||
quit_on_focus_loss = ${boolToString cfg.view.float.quitOnFocusLoss},
|
||||
open_win_config = {
|
||||
relative = "${cfg.view.float.openWinConfig.relative}",
|
||||
border = "${cfg.view.float.openWinConfig.border}",
|
||||
width = ${toString cfg.view.float.openWinConfig.width},
|
||||
height = ${toString cfg.view.float.openWinConfig.height},
|
||||
row = ${toString cfg.view.float.openWinConfig.row},
|
||||
col = ${toString cfg.view.float.openWinConfig.col},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
renderer = {
|
||||
add_trailing = ${boolToString cfg.renderer.addTrailing},
|
||||
group_empty = ${boolToString cfg.renderer.groupEmpty},
|
||||
full_name = ${boolToString cfg.renderer.fullName},
|
||||
highlight_git = ${boolToString cfg.renderer.highlightGit},
|
||||
highlight_opened_files = ${cfg.renderer.highlightOpenedFiles},
|
||||
highlight_modified = ${cfg.renderer.highlightModified},
|
||||
root_folder_label = ${nvim.lua.expToLua cfg.renderer.rootFolderLabel},
|
||||
indent_width = ${toString cfg.renderer.indentWidth},
|
||||
indent_markers = {
|
||||
enable = ${boolToString cfg.renderer.indentMarkers.enable},
|
||||
inline_arrows = ${boolToString cfg.renderer.indentMarkers.inlineArrows},
|
||||
icons = ${nvim.lua.expToLua cfg.renderer.indentMarkers.icons},
|
||||
},
|
||||
|
||||
special_files = ${nvim.lua.listToLuaTable cfg.renderer.specialFiles},
|
||||
symlink_destination = ${boolToString cfg.renderer.symlinkDestination},
|
||||
|
||||
icons = {
|
||||
webdev_colors = ${boolToString cfg.renderer.icons.webdevColors},
|
||||
git_placement = "${cfg.renderer.icons.gitPlacement}",
|
||||
modified_placement = "${cfg.renderer.icons.modifiedPlacement}",
|
||||
padding = "${cfg.renderer.icons.padding}",
|
||||
symlink_arrow = "${cfg.renderer.icons.symlinkArrow}",
|
||||
|
||||
show = {
|
||||
git = ${boolToString cfg.renderer.icons.show.git},
|
||||
folder = ${boolToString cfg.renderer.icons.show.folder},
|
||||
folder_arrow = ${boolToString cfg.renderer.icons.show.folderArrow},
|
||||
file = ${boolToString cfg.renderer.icons.show.file},
|
||||
modified = ${boolToString cfg.renderer.icons.show.modified},
|
||||
},
|
||||
|
||||
glyphs = {
|
||||
default = "${cfg.renderer.icons.glyphs.default}",
|
||||
symlink = "${cfg.renderer.icons.glyphs.symlink}",
|
||||
modified = "${cfg.renderer.icons.glyphs.modified}",
|
||||
|
||||
folder = {
|
||||
default = "${cfg.renderer.icons.glyphs.folder.default}",
|
||||
open = "${cfg.renderer.icons.glyphs.folder.open}",
|
||||
arrow_open = "${cfg.renderer.icons.glyphs.folder.arrowOpen}",
|
||||
arrow_closed = "${cfg.renderer.icons.glyphs.folder.arrowClosed}",
|
||||
empty = "${cfg.renderer.icons.glyphs.folder.empty}",
|
||||
empty_open = "${cfg.renderer.icons.glyphs.folder.emptyOpen}",
|
||||
symlink = "${cfg.renderer.icons.glyphs.folder.symlink}",
|
||||
symlink_open = "${cfg.renderer.icons.glyphs.folder.symlinkOpen}",
|
||||
},
|
||||
|
||||
git = {
|
||||
unstaged = "${cfg.renderer.icons.glyphs.git.unstaged}",
|
||||
staged = "${cfg.renderer.icons.glyphs.git.staged}",
|
||||
unmerged = "${cfg.renderer.icons.glyphs.git.unmerged}",
|
||||
renamed = "${cfg.renderer.icons.glyphs.git.renamed}",
|
||||
untracked = "${cfg.renderer.icons.glyphs.git.untracked}",
|
||||
deleted = "${cfg.renderer.icons.glyphs.git.deleted}",
|
||||
ignored = "${cfg.renderer.icons.glyphs.git.ignored}",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
filters = {
|
||||
git_ignored = ${boolToString cfg.filters.gitIgnored},
|
||||
dotfiles = ${boolToString cfg.filters.dotfiles},
|
||||
git_clean = ${boolToString cfg.filters.gitClean},
|
||||
no_buffer = ${boolToString cfg.filters.noBuffer},
|
||||
exclude = ${nvim.lua.listToLuaTable cfg.filters.exclude},
|
||||
},
|
||||
|
||||
trash = {
|
||||
cmd = "${cfg.trash.cmd}",
|
||||
},
|
||||
|
||||
actions = {
|
||||
use_system_clipboard = ${boolToString cfg.actions.useSystemClipboard},
|
||||
change_dir = {
|
||||
enable = ${boolToString cfg.actions.changeDir.enable},
|
||||
global = ${boolToString cfg.actions.changeDir.global},
|
||||
restrict_above_cwd = ${boolToString cfg.actions.changeDir.restrictAboveCwd},
|
||||
},
|
||||
|
||||
expand_all = {
|
||||
max_folder_discovery = ${toString cfg.actions.expandAll.maxFolderDiscovery},
|
||||
exclude = ${nvim.lua.listToLuaTable cfg.actions.expandAll.exclude},
|
||||
},
|
||||
|
||||
file_popup = {
|
||||
open_win_config = ${nvim.lua.expToLua cfg.actions.filePopup.openWinConfig},
|
||||
},
|
||||
|
||||
open_file = {
|
||||
quit_on_open = ${boolToString cfg.actions.openFile.quitOnOpen},
|
||||
eject = ${boolToString cfg.actions.openFile.eject},
|
||||
resize_window = ${boolToString cfg.actions.openFile.resizeWindow},
|
||||
window_picker = {
|
||||
enable = ${boolToString cfg.actions.openFile.windowPicker.enable},
|
||||
picker = "${cfg.actions.openFile.windowPicker.picker}",
|
||||
chars = "${cfg.actions.openFile.windowPicker.chars}",
|
||||
exclude = {
|
||||
filetype = ${nvim.lua.listToLuaTable cfg.actions.openFile.windowPicker.exclude.filetype},
|
||||
buftype = ${nvim.lua.listToLuaTable cfg.actions.openFile.windowPicker.exclude.buftype},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
remove_file = {
|
||||
close_window = ${boolToString cfg.actions.removeFile.closeWindow},
|
||||
},
|
||||
},
|
||||
|
||||
live_filter = {
|
||||
prefix = "${cfg.liveFilter.prefix}",
|
||||
always_show_folders = ${boolToString cfg.liveFilter.alwaysShowFolders},
|
||||
},
|
||||
|
||||
tab = {
|
||||
sync = {
|
||||
open = ${boolToString cfg.tab.sync.open},
|
||||
close = ${boolToString cfg.tab.sync.close},
|
||||
ignore = ${nvim.lua.listToLuaTable cfg.tab.sync.ignore},
|
||||
},
|
||||
},
|
||||
|
||||
notify = {
|
||||
threshold = vim.log.levels.${cfg.notify.threshold},
|
||||
absolute_path = ${boolToString cfg.notify.absolutePath},
|
||||
},
|
||||
|
||||
ui = {
|
||||
confirm = {
|
||||
remove = ${boolToString cfg.ui.confirm.remove},
|
||||
trash = ${boolToString cfg.ui.confirm.trash},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- autostart behaviour
|
||||
${
|
||||
lib.optionalString (cfg.openOnSetup) ''
|
||||
-- Open on startup has been deprecated
|
||||
-- see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
|
||||
|
||||
-- use a nix eval to dynamically insert the open on startup function
|
||||
local function open_nvim_tree(data)
|
||||
local IGNORED_FT = {
|
||||
"markdown",
|
||||
}
|
||||
|
||||
-- buffer is a real file on the disk
|
||||
local real_file = vim.fn.filereadable(data.file) == 1
|
||||
|
||||
-- buffer is a [No Name]
|
||||
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
|
||||
|
||||
-- &ft
|
||||
local filetype = vim.bo[data.buf].ft
|
||||
|
||||
-- only files please
|
||||
if not real_file and not no_name then
|
||||
return
|
||||
end
|
||||
|
||||
-- skip ignored filetypes
|
||||
if vim.tbl_contains(IGNORED_FT, filetype) then
|
||||
return
|
||||
end
|
||||
|
||||
-- open the tree but don't focus it
|
||||
require("nvim-tree.api").tree.toggle({ focus = false })
|
||||
end
|
||||
|
||||
-- function to automatically open the tree on VimEnter
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,80 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) toJSON;
|
||||
inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetExprBinding mkSetLuaBinding nvim;
|
||||
|
||||
cfg = config.vim.git;
|
||||
|
||||
self = import ./git.nix {inherit lib;};
|
||||
gsMappingDefinitions = self.options.vim.git.gitsigns.mappings;
|
||||
|
||||
gsMappings = addDescriptionsToMappings cfg.gitsigns.mappings gsMappingDefinitions;
|
||||
in {
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.gitsigns.enable (mkMerge [
|
||||
{
|
||||
vim.startPlugins = ["gitsigns-nvim"];
|
||||
|
||||
vim.maps.normal = mkMerge [
|
||||
(mkSetExprBinding gsMappings.nextHunk ''
|
||||
function()
|
||||
if vim.wo.diff then return ${toJSON gsMappings.nextHunk.value} end
|
||||
|
||||
vim.schedule(function() package.loaded.gitsigns.next_hunk() end)
|
||||
|
||||
return '<Ignore>'
|
||||
end
|
||||
'')
|
||||
(mkSetExprBinding gsMappings.previousHunk ''
|
||||
function()
|
||||
if vim.wo.diff then return ${toJSON gsMappings.previousHunk.value} end
|
||||
|
||||
vim.schedule(function() package.loaded.gitsigns.prev_hunk() end)
|
||||
|
||||
return '<Ignore>'
|
||||
end
|
||||
'')
|
||||
|
||||
(mkSetLuaBinding gsMappings.stageHunk "package.loaded.gitsigns.stage_hunk")
|
||||
(mkSetLuaBinding gsMappings.resetHunk "package.loaded.gitsigns.reset_hunk")
|
||||
(mkSetLuaBinding gsMappings.undoStageHunk "package.loaded.gitsigns.undo_stage_hunk")
|
||||
|
||||
(mkSetLuaBinding gsMappings.stageBuffer "package.loaded.gitsigns.stage_buffer")
|
||||
(mkSetLuaBinding gsMappings.resetBuffer "package.loaded.gitsigns.reset_buffer")
|
||||
|
||||
(mkSetLuaBinding gsMappings.previewHunk "package.loaded.gitsigns.preview_hunk")
|
||||
|
||||
(mkSetLuaBinding gsMappings.blameLine "function() package.loaded.gitsigns.blame_line{full=true} end")
|
||||
(mkSetLuaBinding gsMappings.toggleBlame "package.loaded.gitsigns.toggle_current_line_blame")
|
||||
|
||||
(mkSetLuaBinding gsMappings.diffThis "package.loaded.gitsigns.diffthis")
|
||||
(mkSetLuaBinding gsMappings.diffProject "function() package.loaded.gitsigns.diffthis('~') end")
|
||||
|
||||
(mkSetLuaBinding gsMappings.toggleDeleted "package.loaded.gitsigns.toggle_deleted")
|
||||
];
|
||||
|
||||
vim.maps.visual = mkMerge [
|
||||
(mkSetLuaBinding gsMappings.stageHunk "function() package.loaded.gitsigns.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end")
|
||||
(mkSetLuaBinding gsMappings.resetHunk "function() package.loaded.gitsigns.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end")
|
||||
];
|
||||
|
||||
vim.luaConfigRC.gitsigns = nvim.dag.entryAnywhere ''
|
||||
require('gitsigns').setup{}
|
||||
'';
|
||||
}
|
||||
|
||||
(mkIf cfg.gitsigns.codeActions {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.gitsigns-ca = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.code_actions.gitsigns
|
||||
)
|
||||
'';
|
||||
})
|
||||
]))
|
||||
]);
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
./config.nix
|
||||
./git.nix
|
||||
];
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib) mkEnableOption mkMappingOption;
|
||||
in {
|
||||
options.vim.git = {
|
||||
enable = mkEnableOption "git tools via gitsigns";
|
||||
|
||||
gitsigns = {
|
||||
enable = mkEnableOption "gitsigns";
|
||||
|
||||
mappings = {
|
||||
nextHunk = mkMappingOption "Next hunk [Gitsigns]" "]c";
|
||||
previousHunk = mkMappingOption "Previous hunk [Gitsigns]" "[c";
|
||||
|
||||
stageHunk = mkMappingOption "Stage hunk [Gitsigns]" "<leader>hs";
|
||||
undoStageHunk = mkMappingOption "Undo stage hunk [Gitsigns]" "<leader>hu";
|
||||
resetHunk = mkMappingOption "Reset hunk [Gitsigns]" "<leader>hr";
|
||||
|
||||
stageBuffer = mkMappingOption "Stage buffer [Gitsigns]" "<leader>hS";
|
||||
resetBuffer = mkMappingOption "Reset buffer [Gitsigns]" "<leader>hR";
|
||||
|
||||
previewHunk = mkMappingOption "Preview hunk [Gitsigns]" "<leader>hP";
|
||||
|
||||
blameLine = mkMappingOption "Blame line [Gitsigns]" "<leader>hb";
|
||||
toggleBlame = mkMappingOption "Toggle blame [Gitsigns]" "<leader>tb";
|
||||
|
||||
diffThis = mkMappingOption "Diff this [Gitsigns]" "<leader>hd";
|
||||
diffProject = mkMappingOption "Diff project [Gitsigns]" "<leader>hD";
|
||||
|
||||
toggleDeleted = mkMappingOption "Toggle deleted [Gitsigns]" "<leader>td";
|
||||
};
|
||||
|
||||
codeActions = mkEnableOption "gitsigns codeactions through null-ls";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption types nvim mkIf mkMerge optional;
|
||||
|
||||
cfg = config.vim.languages.html;
|
||||
in {
|
||||
options.vim.languages.html = {
|
||||
enable = mkEnableOption "HTML language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkOption {
|
||||
description = "Enable HTML treesitter";
|
||||
type = types.bool;
|
||||
default = config.vim.languages.enableTreesitter;
|
||||
};
|
||||
package = nvim.types.mkGrammarOption pkgs "html";
|
||||
|
||||
autotagHtml = mkOption {
|
||||
description = "Enable autoclose/autorename of html tags (nvim-ts-autotag)";
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
|
||||
vim.startPlugins = optional cfg.treesitter.autotagHtml "nvim-ts-autotag";
|
||||
|
||||
vim.luaConfigRC.html-autotag = mkIf cfg.treesitter.autotagHtml (nvim.dag.entryAnywhere ''
|
||||
require('nvim-ts-autotag').setup()
|
||||
'');
|
||||
})
|
||||
]);
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge optionalString getExe;
|
||||
|
||||
cfg = config.vim.languages.lua;
|
||||
in {
|
||||
options.vim.languages.lua = {
|
||||
enable = mkEnableOption "Lua language support";
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Lua Treesitter support" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = nvim.types.mkGrammarOption pkgs "lua";
|
||||
};
|
||||
lsp = {
|
||||
enable = mkEnableOption "Lua LSP support via LuaLS" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
package = mkOption {
|
||||
description = "LuaLS package, or the command to run as a list of strings";
|
||||
type = with types; either package (listOf str);
|
||||
default = pkgs.lua-language-server;
|
||||
};
|
||||
|
||||
neodev.enable = mkEnableOption "neodev.nvim integration, useful for neovim plugin developers";
|
||||
};
|
||||
};
|
||||
|
||||
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.lua-lsp = ''
|
||||
lspconfig.lua_ls.setup {
|
||||
capabilities = capabilities;
|
||||
on_attach = default_on_attach;
|
||||
${optionalString cfg.lsp.neodev.enable "before_init = require('neodev.lsp').before_init;"}
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
else ''{"${getExe cfg.lsp.package}"}''
|
||||
};
|
||||
}
|
||||
'';
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.neodev.enable {
|
||||
vim.startPlugins = ["neodev-nvim"];
|
||||
vim.luaConfigRC.neodev = nvim.dag.entryBefore ["lua-lsp"] ''
|
||||
require("neodev").setup({})
|
||||
'';
|
||||
})
|
||||
]);
|
||||
}
|
|
@ -1,146 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge optionalString boolToString optionals;
|
||||
|
||||
cfg = config.vim.languages.rust;
|
||||
in {
|
||||
options.vim.languages.rust = {
|
||||
enable = mkEnableOption "Rust language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Rust treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = nvim.types.mkGrammarOption pkgs "rust";
|
||||
};
|
||||
|
||||
crates = {
|
||||
enable = mkEnableOption "crates-nvim, tools for managing dependencies";
|
||||
codeActions = mkOption {
|
||||
description = "Enable code actions through null-ls";
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Rust LSP support (rust-analyzer with extra tools)" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
package = mkOption {
|
||||
description = "rust-analyzer package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
|
||||
type = with types; either package (listOf str);
|
||||
default = pkgs.rust-analyzer;
|
||||
};
|
||||
|
||||
opts = mkOption {
|
||||
description = "Options to pass to rust analyzer";
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
|
||||
dap = {
|
||||
enable = mkOption {
|
||||
description = "Rust Debug Adapter support";
|
||||
type = types.bool;
|
||||
default = config.vim.languages.enableDAP;
|
||||
};
|
||||
package = mkOption {
|
||||
description = "lldb pacakge";
|
||||
type = types.package;
|
||||
default = pkgs.lldb;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.crates.enable {
|
||||
vim.lsp.null-ls.enable = mkIf cfg.crates.codeActions true;
|
||||
|
||||
vim.startPlugins = ["crates-nvim"];
|
||||
|
||||
vim.autocomplete.sources = {"crates" = "[Crates]";};
|
||||
vim.luaConfigRC.rust-crates = nvim.dag.entryAnywhere ''
|
||||
require('crates').setup {
|
||||
null_ls = {
|
||||
enabled = ${boolToString cfg.crates.codeActions},
|
||||
name = "crates.nvim",
|
||||
}
|
||||
}
|
||||
'';
|
||||
})
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
|
||||
vim.startPlugins = ["rust-tools"] ++ optionals cfg.dap.enable [cfg.dap.package];
|
||||
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.rust-lsp = ''
|
||||
local rt = require('rust-tools')
|
||||
rust_on_attach = function(client, bufnr)
|
||||
default_on_attach(client, bufnr)
|
||||
local opts = { noremap=true, silent=true, buffer = bufnr }
|
||||
vim.keymap.set("n", "<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,
|
||||
on_attach = rust_on_attach,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
||||
},
|
||||
settings = {
|
||||
${cfg.lsp.opts}
|
||||
}
|
||||
},
|
||||
|
||||
${optionalString cfg.dap.enable ''
|
||||
dap = {
|
||||
adapter = {
|
||||
type = "executable",
|
||||
command = "${cfg.dap.package}/bin/lldb-vscode",
|
||||
name = "rt_lldb",
|
||||
},
|
||||
},
|
||||
''}
|
||||
}
|
||||
rt.setup(rustopts)
|
||||
'';
|
||||
})
|
||||
]);
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) addDescriptionsToMappings mkIf optional boolToString optionalString;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
usingNvimCmp = config.vim.autocomplete.enable && config.vim.autocomplete.type == "nvim-cmp";
|
||||
self = import ./module.nix {inherit config lib pkgs;};
|
||||
|
||||
mappingDefinitions = self.options.vim.lsp.mappings;
|
||||
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}'})";
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = optional usingNvimCmp "cmp-nvim-lsp";
|
||||
|
||||
vim.autocomplete.sources = {"nvim_lsp" = "[LSP]";};
|
||||
vim.luaConfigRC.lsp-setup = ''
|
||||
vim.g.formatsave = ${boolToString cfg.formatOnSave};
|
||||
|
||||
local attach_keymaps = function(client, bufnr)
|
||||
${mkBinding mappings.goToDeclaration "vim.lsp.buf.declaration()"}
|
||||
${mkBinding mappings.goToDefinition "vim.lsp.buf.definition()"}
|
||||
${mkBinding mappings.goToType "vim.lsp.buf.type_definition()"}
|
||||
${mkBinding mappings.listImplementations "vim.lsp.buf.implementation()"}
|
||||
${mkBinding mappings.listReferences "vim.lsp.buf.references()"}
|
||||
${mkBinding mappings.nextDiagnostic "vim.diagnostic.goto_next()"}
|
||||
${mkBinding mappings.previousDiagnostic "vim.diagnostic.goto_prev()"}
|
||||
${mkBinding mappings.openDiagnosticFloat "vim.diagnostic.open_float()"}
|
||||
${mkBinding mappings.documentHighlight "vim.lsp.buf.document_highlight()"}
|
||||
${mkBinding mappings.listDocumentSymbols "vim.lsp.buf.document_symbol()"}
|
||||
${mkBinding mappings.addWorkspaceFolder "vim.lsp.buf.add_workspace_folder()"}
|
||||
${mkBinding mappings.removeWorkspaceFolder "vim.lsp.buf.remove_workspace_folder()"}
|
||||
${mkBinding mappings.listWorkspaceFolders "print(vim.inspect(vim.lsp.buf.list_workspace_folders()))"}
|
||||
${mkBinding mappings.listWorkspaceSymbols "vim.lsp.buf.workspace_symbol()"}
|
||||
${mkBinding mappings.hover "vim.lsp.buf.hover()"}
|
||||
${mkBinding mappings.signatureHelp "vim.lsp.buf.signature_help()"}
|
||||
${mkBinding mappings.renameSymbol "vim.lsp.buf.rename()"}
|
||||
${mkBinding mappings.codeAction "vim.lsp.buf.code_action()"}
|
||||
${mkBinding mappings.format "vim.lsp.buf.format()"}
|
||||
${mkBinding mappings.toggleFormatOnSave "vim.b.disableFormatSave = not vim.b.disableFormatSave"}
|
||||
end
|
||||
|
||||
-- Enable formatting
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
format_callback = function(client, bufnr)
|
||||
if vim.g.formatsave then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
${
|
||||
if config.vim.lsp.null-ls.enable
|
||||
then ''
|
||||
if vim.b.disableFormatSave then
|
||||
return
|
||||
end
|
||||
|
||||
local function is_null_ls_formatting_enabled(bufnr)
|
||||
local file_type = vim.api.nvim_buf_get_option(bufnr, "filetype")
|
||||
local generators = require("null-ls.generators").get_available(
|
||||
file_type,
|
||||
require("null-ls.methods").internal.FORMATTING
|
||||
)
|
||||
return #generators > 0
|
||||
end
|
||||
|
||||
if is_null_ls_formatting_enabled(bufnr) then
|
||||
vim.lsp.buf.format({
|
||||
bufnr = bufnr,
|
||||
filter = function(client)
|
||||
return client.name == "null-ls"
|
||||
end
|
||||
})
|
||||
else
|
||||
vim.lsp.buf.format({
|
||||
bufnr = bufnr,
|
||||
})
|
||||
end
|
||||
''
|
||||
else "
|
||||
vim.lsp.buf.format({
|
||||
bufnr = bufnr,
|
||||
})
|
||||
"
|
||||
}
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
${optionalString (config.vim.ui.breadcrumbs.enable) ''local navic = require("nvim-navic")''}
|
||||
default_on_attach = function(client, bufnr)
|
||||
attach_keymaps(client, bufnr)
|
||||
format_callback(client, bufnr)
|
||||
${optionalString (config.vim.ui.breadcrumbs.enable) ''
|
||||
-- let navic attach to buffers
|
||||
if client.server_capabilities.documentSymbolProvider then
|
||||
navic.attach(client, bufnr)
|
||||
end
|
||||
''}
|
||||
end
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
${optionalString usingNvimCmp "capabilities = require('cmp_nvim_lsp').default_capabilities()"}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf nvim;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
in {
|
||||
config = mkIf (cfg.enable && cfg.lightbulb.enable) {
|
||||
vim.startPlugins = ["nvim-lightbulb"];
|
||||
|
||||
vim.configRC.lightbulb = nvim.dag.entryAnywhere ''
|
||||
autocmd CursorHold,CursorHoldI * lua require'nvim-lightbulb'.update_lightbulb()
|
||||
'';
|
||||
|
||||
vim.luaConfigRC.lightbulb = nvim.dag.entryAnywhere ''
|
||||
-- Enable trouble diagnostics viewer
|
||||
require'nvim-lightbulb'.setup()
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf nvim optionalString;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
in {
|
||||
config = mkIf (cfg.enable && cfg.lspSignature.enable) {
|
||||
vim.startPlugins = [
|
||||
"lsp-signature"
|
||||
];
|
||||
|
||||
vim.luaConfigRC.lsp-signature = nvim.dag.entryAnywhere ''
|
||||
-- Enable lsp signature viewer
|
||||
require("lsp_signature").setup({
|
||||
${optionalString (config.vim.ui.borders.plugins.lsp-signature.enable) ''
|
||||
bind = true, -- This is mandatory, otherwise border config won't get registered.
|
||||
handler_opts = {
|
||||
border = "${config.vim.ui.borders.plugins.lsp-signature.style}"
|
||||
}
|
||||
''}
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue