mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-01 19:11:15 +00:00
Merge branch 'v0.7' into refactor-languages
This commit is contained in:
commit
79447a0024
67 changed files with 1735 additions and 1020 deletions
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
|
@ -16,7 +16,7 @@ If you have any questions regarding those files, feel free to open an issue or [
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
The contribution process is mostly documented in the [pull request template](.github/pull_request_template.md). You will find a checklist of items to complete before submitting a pull request. Please make sure you complete it before submitting a pull request. If you are unsure about any of the items, please ask.
|
The contribution process is mostly documented in the [pull request template](pull_request_template.md). You will find a checklist of items to complete before submitting a pull request. Please make sure you complete it before submitting a pull request. If you are unsure about any of the items, please ask.
|
||||||
|
|
||||||
### Guidelines
|
### Guidelines
|
||||||
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
# Description
|
|
||||||
|
|
||||||
A clear and concise description of the aim of your Pull Request.
|
|
||||||
|
|
||||||
**If your pull request aims to fix an open issue or a present bug, please link the relevant issue below. If not, please remove this section**
|
|
||||||
Fixes #(issue)
|
|
||||||
|
|
||||||
## Type of change
|
|
||||||
|
|
||||||
Please delete any options that are not relevant.
|
|
||||||
|
|
||||||
- Bug fix (non-breaking change which fixes an issue)
|
|
||||||
- New feature (non-breaking change which adds functionality)
|
|
||||||
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
||||||
- Translation/Language update
|
|
||||||
- Docs
|
|
||||||
- Other
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
|
|
||||||
Please try to check at least a majority of the checklist before opening your pull request. Exceptions to this will be reviewed on a case by case basis.
|
|
||||||
|
|
||||||
- [ ] My code follows the style and contributing guidelines of this project.
|
|
||||||
- [ ] I ran Alejandra to format my code (`nix fmt`).
|
|
||||||
- [ ] I have performed a self-review of my own code and tested it.
|
|
||||||
- [ ] I have commented my code, particularly in hard-to-understand areas.
|
|
||||||
- [ ] My changes generate no new warnings.
|
|
||||||
- [ ] This change requires a documentation update.
|
|
||||||
- [ ] I have updated the documentation accordingly.
|
|
||||||
|
|
||||||
## Screenshots & Logs
|
|
||||||
|
|
||||||
You are kindly requested to attach screenshots of your changes in actions and preferably your build/run logs for all available packages. If you are not sure how to do this, you can refer to the [documentation](https://notashelf.github.io/neovim-flake/).
|
|
||||||
|
|
||||||
**Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.**
|
|
||||||
|
|
||||||
```console
|
|
||||||
# Paste your logs here
|
|
||||||
```
|
|
196
.github/README.md
vendored
196
.github/README.md
vendored
|
@ -33,10 +33,9 @@
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<a>
|
<a>
|
||||||
A highly modular, configurable, extensible and easy to use Neovim configuration
|
nvf is a highly modular, configurable, extensible and easy to use Neovim configuration
|
||||||
framework in Nix. Designed for flexibility and ease of use, this flake
|
in Nix. Designed for flexibility and ease of use, nvf allows you to easily configure
|
||||||
allows you to easily configure your Neovim instance with a few lines of
|
your fully featured Neovim instance with a few lines of Nix.
|
||||||
Nix code.
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -44,6 +43,7 @@
|
||||||
|
|
||||||
<div align="center"><p>
|
<div align="center"><p>
|
||||||
|
|
||||||
|
[Features]: #features
|
||||||
[Get Started]: #get-started
|
[Get Started]: #get-started
|
||||||
[Documentation]: #documentation
|
[Documentation]: #documentation
|
||||||
[Help]: #help
|
[Help]: #help
|
||||||
|
@ -51,119 +51,156 @@
|
||||||
[FAQ]: #faq
|
[FAQ]: #faq
|
||||||
[Credits]: #credits
|
[Credits]: #credits
|
||||||
|
|
||||||
**[<kbd> <br> Get Started <br> </kbd>][Get Started]**
|
**[<kbd><br> Features <br></kbd>][Features]**
|
||||||
**[<kbd> <br> Documentation <br> </kbd>][Documentation]**
|
**[<kbd><br> Get Started <br></kbd>][Get Started]**
|
||||||
**[<kbd> <br> Help <br> </kbd>][Help]**
|
**[<kbd><br> Documentation <br></kbd>][Documentation]**
|
||||||
**[<kbd> <br> Contribute <br> </kbd>][Contribute]**
|
**[<kbd><br> Help <br></kbd>][Help]**
|
||||||
**[<kbd> <br> FAQ <br> </kbd>][Faq]**
|
**[<kbd><br> Contribute <br></kbd>][Contribute]**
|
||||||
**[<kbd> <br> Credits <br> </kbd>][Credits]**
|
**[<kbd><br> FAQ <br></kbd>][Faq]** **[<kbd><br> Credits <br></kbd>][Credits]**
|
||||||
|
|
||||||
</p></div>
|
</p></div>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- **Reproducible**: Your configuration will behave the same _anywhere_. No
|
||||||
|
surprises, promise!
|
||||||
|
- **Portable**: nvf depends _solely_ on your Nix store, and nothing else. No
|
||||||
|
more global binaries! Works on all platforms, without hassle.
|
||||||
|
- **Customizable**: There are _almost no defaults_ to annoy you. nvf is fully
|
||||||
|
customizable through the Nix module system.
|
||||||
|
- **Well-documented**: Documentation is priority. You will _never_ face
|
||||||
|
undocumented, obscure behaviour.
|
||||||
|
- **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and
|
||||||
|
will, remain maintainable for myself and any contributors.
|
||||||
|
|
||||||
## Get Started
|
## Get Started
|
||||||
|
|
||||||
### Using `nix` CLI
|
[nvf manual]: https://notashelf.github.io/nvf/
|
||||||
|
[issue tracker]: https://github.com/NotAShelf/nvf/issues
|
||||||
|
|
||||||
If you would like to try out the configuration before even thinking about
|
If you are not sold on the concepts of **nvf**, and would like to try out the
|
||||||
installing it, you can run the following command
|
default configuration before even _thinking about_ installing it, you may run
|
||||||
|
the following in order to take **nvf** out for a spin.
|
||||||
|
|
||||||
```console
|
```bash
|
||||||
|
# Run the default package
|
||||||
nix run github:notashelf/nvf
|
nix run github:notashelf/nvf
|
||||||
```
|
```
|
||||||
|
|
||||||
This will get you a feel for the base configuration and UI design.
|
This will get you a feel for the base configuration and UI design. Though, none
|
||||||
The flake exposes `#nix` as the default package, providing minimal
|
of the configuration options are final as **nvf** is designed to be modular and
|
||||||
language support and various utilities.You may also use `#nix`,
|
configurable.
|
||||||
`#tidal` or `#maximal` to get try out different configurations.
|
|
||||||
|
|
||||||
It is as simple as changing the target output to get a different
|
> [!TIP]
|
||||||
configuration. For example, to get a configuration with `tidal` support, run:
|
> The flake exposes `#nix` as the default package, providing minimal language
|
||||||
|
> support and various utilities. You may also use the `#nix` or `#maximal`
|
||||||
|
> packages provided by the this flake to get try out different configurations.
|
||||||
|
|
||||||
```console
|
It is as simple as changing the target output to get a different configuration.
|
||||||
nix run github:notashelf/nvf#tidal
|
For example, to get a configuration with large language coverage, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run the maximal package
|
||||||
|
nix run github:notashelf/nvf#maximal
|
||||||
```
|
```
|
||||||
|
|
||||||
Similar instructions will apply for `nix profile install`. However, you are
|
Similar instructions will apply for `nix profile install`. However, you are
|
||||||
recommended to instead use the module system as described in the manual.
|
recommended to instead use the module system as described in the manual.
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> The `maximal` configuration is _massive_ and will take a while to build.
|
> The `maximal` configuration is quite large, and might take a while to build.
|
||||||
> To get a feel for the configuration, use the default `nix` or `tidal`
|
> To get a feel for the configuration, use the default `nix` configuration.
|
||||||
> configurations. Should you choose to try out the `maximal` configuration,
|
> Should you choose to try out the `maximal` configuration, using the binary
|
||||||
> using the binary cache as described in the manual is _strongly_ recommended.
|
> cache as described in the manual is _strongly_ recommended.
|
||||||
|
|
||||||
|
If you are convinced, proceed to the next section to view the installation
|
||||||
|
instructions.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
See the [**nvf** Manual](https://notashelf.github.io/nvf/) for
|
The _recommended_ way of installing **nvf** is using either the NixOS or the
|
||||||
detailed installation guides, configurations, available options, release notes
|
Home-Manager module, though it is completely possible and no less supported to
|
||||||
and more. Tips for installing userspace plugins is also contained in the
|
install **nvf** as a standalone package, or a flake output.
|
||||||
documentation.
|
|
||||||
|
|
||||||
If you want to dive right into trying **nvf** you can get a fully
|
See the rendered [nvf manual] for detailed and up-to-date installation guides,
|
||||||
featured configuration with `nix` language support by running:
|
configurations, available options, release notes and more. Tips for installing
|
||||||
|
userspace plugins is also contained in the documentation.
|
||||||
|
|
||||||
```console
|
> [!TIP]
|
||||||
nix run github:notashelf/nvf#nix
|
> While using NixOS or Home-Manager modules,
|
||||||
```
|
> `programs.nvf.enableManpages = true;` will allow you to view option
|
||||||
|
> documentation from the comfort of your terminal via `man 5 nvf`. The more you
|
||||||
|
> know.
|
||||||
|
|
||||||
[Issues]: https://github.com/NotAShelf/nvf/issues
|
Please create an issue on the [issue tracker] if you find the documentation
|
||||||
|
lacking or confusing. Any improvements to the documentation through pull
|
||||||
Please create an issue on the [issue tracker](issues) if you find
|
requests are also welcome, and appreciated.
|
||||||
the documentation lacking or confusing. I also appreciate any contributions
|
|
||||||
to the documentation.
|
|
||||||
|
|
||||||
## Help
|
## Help
|
||||||
|
|
||||||
You can create an issue on the [issue tracker](issues) to ask questions
|
You can create an issue on the [issue tracker] to ask questions or report bugs.
|
||||||
or report bugs. I am not yet on spaces like matrix or IRC, so please use the issue
|
I am not yet on spaces like matrix or IRC, so please use the issue tracker for
|
||||||
tracker for now.
|
now.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
I am always looking for new ways to help improve this flake. If you would like
|
I am always looking for new ways to help improve this flake. If you would like
|
||||||
to contribute, please read the [contributing guide](CONTRIBUTING.md) before
|
to contribute, please read the [contributing guide](CONTRIBUTING.md) before
|
||||||
submitting a pull request. You can also create an issue on the
|
submitting a pull request. You can also create an issue on the [issue tracker]
|
||||||
[issue tracker](issues) before submitting a pull request if you would
|
before submitting a pull request if you would like to discuss a feature or bug
|
||||||
like to discuss a feature or bug fix.
|
fix.
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
|
[appropriate issue template]: https://github.com/NotAShelf/nvf/issues/new/choose
|
||||||
|
[list of branches]: https://github.com/NotAShelf/nvf/branches
|
||||||
|
[list of open pull requests]: https://github.com/NotAShelf/nvf/pulls
|
||||||
|
|
||||||
|
**Q**: What platforms are supported?
|
||||||
|
<br/> **A**: nvf actively supports Linux and Darwin platforms using standalone
|
||||||
|
Nix, NixOS or Home-Manager. Please take a look at the
|
||||||
|
|
||||||
**Q**: Can you add _X_?
|
**Q**: Can you add _X_?
|
||||||
<br/>
|
<br/> **A**: Maybe! It is not one of our goals to support each and every Neovim
|
||||||
**A**: Maybe! It is not one of our goals to support each and every Neovim
|
plugin, however, I am always open to new modules and plugin setup additions to
|
||||||
plugin, however, I am always open to new modules and plugin setup additions
|
**nvf**. Use the [appropriate issue template] and I will consider a module
|
||||||
to **nvf**. Use the [appropritate issue template](issues/new/choose) and I will
|
addition. As mentioned before, PRs adding new features are also welcome.
|
||||||
consider a module addition.
|
|
||||||
|
|
||||||
**Q**: A plugin I need is not available in **nvf**. What to do?
|
**Q**: A plugin I need is not available in **nvf**. What to do?
|
||||||
<br/>
|
<br/> **A**: **nvf** exposes several APIs for you to be able to add your own
|
||||||
**A**: **nvf** exposes several APIs for you to be able to add your own
|
plugin configurations! Please see the documentation on how you may do this.
|
||||||
plugin configurations! Please see the documentation on how you may do
|
|
||||||
this.
|
|
||||||
|
|
||||||
**Q**: Main branch is awfully silent, is the project dead?
|
**Q**: Main branch is awfully silent, is the project dead?
|
||||||
<br/>
|
<br/> **A**: No! Sometimes we branch out (e.g. `v0.6`) to avoid breaking
|
||||||
**A**: No! Sometimes we branch out (e.g. v0.6) to avoid breaking userspace
|
userspace and work in a separate branch until we make sure the new additions are
|
||||||
and work in a separate branch until we make sure the new additions are
|
implemented in the most comfortable way possible for the end user. If you have
|
||||||
implemented in the most comfortable way available to the end user. If you have
|
not noticed any activity on the main branch, consider taking a look at the
|
||||||
not noticed any activity on the main branch, consider taking a look at the [list
|
[list of branches] or the [list of open pull requests]. You may also consider
|
||||||
of branches](https://github.com/NotAShelf/nvf/branches=) or the [list of open
|
_testing_ those release branches to get access to new features ahead of time and
|
||||||
pull requests](https://github.com/NotAShelf/nvf)
|
better prepare to breaking changes.
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
### Contributors
|
### Contributors
|
||||||
|
|
||||||
Special thanks to
|
Special, heart-felt thanks to
|
||||||
|
|
||||||
- [@fufexan](https://github.com/fufexan) - For the transition to flake-parts
|
- [@fufexan](https://github.com/fufexan) - For the transition to flake-parts
|
||||||
- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to work
|
- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to
|
||||||
- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally possible
|
work
|
||||||
- [@horriblename](https://github.com/horriblename) - For actively implementing planned features and quality of life updates
|
- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally
|
||||||
|
possible
|
||||||
|
- [@horriblename](https://github.com/horriblename) - For actively implementing
|
||||||
|
planned features and quality of life updates
|
||||||
- [@Yavko](https://github.com/Yavko) - For the amazing **nvf** logo
|
- [@Yavko](https://github.com/Yavko) - For the amazing **nvf** logo
|
||||||
- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I could not
|
- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I
|
||||||
|
could not
|
||||||
|
- [@Diniamo](https://github.com/Diniamo) - For actively submitting PRs, pull
|
||||||
|
requests and overall assistence
|
||||||
|
- [@Gerg-l](https://github.com/gerg-l) - For the modern Neovim wrapper, mnw and
|
||||||
|
occasional code improvements
|
||||||
|
|
||||||
and everyone who has submitted issues or pull requests!
|
and everyone who has submitted issues or pull requests!
|
||||||
|
|
||||||
|
@ -172,10 +209,18 @@ and everyone who has submitted issues or pull requests!
|
||||||
This configuration borrows from and is based on a few other configurations,
|
This configuration borrows from and is based on a few other configurations,
|
||||||
including:
|
including:
|
||||||
|
|
||||||
- [@jordanisaacs's](https://github.com/jordanisaacs) [neovim-flake](https://github.com/jordanisaacs/neovim-flake) that this flake is originally based on.
|
- [@jordanisaacs's](https://github.com/jordanisaacs)
|
||||||
- [@sioodmy's](https://github.com/sioodmy) [dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design choices.
|
[neovim-flake](https://github.com/jordanisaacs/neovim-flake) that this flake
|
||||||
- [@wiltaylor's](https://github.com/wiltaylor) [neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and design ideas.
|
is originally based on.
|
||||||
- [@gvolpe's](https://github.com/gvolpe) [neovim-flake](https://github.com/gvolpe/neovim-flake) for plugin, design and nix concepts.
|
- [@sioodmy's](https://github.com/sioodmy)
|
||||||
|
[dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design
|
||||||
|
choices.
|
||||||
|
- [@wiltaylor's](https://github.com/wiltaylor)
|
||||||
|
[neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and
|
||||||
|
design ideas.
|
||||||
|
- [@gvolpe's](https://github.com/gvolpe)
|
||||||
|
[neovim-flake](https://github.com/gvolpe/neovim-flake) for plugin, design and
|
||||||
|
nix concepts.
|
||||||
|
|
||||||
I am grateful for their previous work and inspiration, and I wholeheartedly
|
I am grateful for their previous work and inspiration, and I wholeheartedly
|
||||||
recommend checking their work out.
|
recommend checking their work out.
|
||||||
|
@ -183,11 +228,14 @@ recommend checking their work out.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Following the license of the [original neovim-flake](https://github.com/jordanisaacs/neovim-flake),
|
Following the license of the
|
||||||
**nvf** has been made available under the [**MIT License**](LICENSE). However, all assets
|
[original neovim-flake](https://github.com/jordanisaacs/neovim-flake), **nvf**
|
||||||
and documentation are published under the
|
has been made available under the [**MIT License**](LICENSE). However, all
|
||||||
|
assets and documentation are published under the
|
||||||
[**CC BY License**](https://github.com/NotAShelf/nvf/blob/main/.github/assets/LICENSE).
|
[**CC BY License**](https://github.com/NotAShelf/nvf/blob/main/.github/assets/LICENSE).
|
||||||
|
|
||||||
|
<h6 align="center">Yes, this includes the logo work too. Stop taking artwork that is not yours!</h6>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<div align="right">
|
<div align="right">
|
||||||
|
|
57
.github/pull_request_template.md
vendored
Normal file
57
.github/pull_request_template.md
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<!--
|
||||||
|
^ Please include a clear and concise description of the aim of your Pull Request above this line ^
|
||||||
|
|
||||||
|
For plugin dependency/module additions, please make sure to link the source link of the added plugin
|
||||||
|
or dependency in this section.
|
||||||
|
|
||||||
|
If your pull request aims to fix an open issue or a please bug, please also link the relevant issue
|
||||||
|
below this line. You may attach an issue to your pull request with `Fixes #<issue number>` outside
|
||||||
|
this comment.
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Sanity Checking
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Please check all that apply. As before, this section is not a hard requirement but checklists with more checked
|
||||||
|
items are likely to be merged faster. You may save some time in maintainer review by performing self-reviews here
|
||||||
|
before submitting your pull request.
|
||||||
|
|
||||||
|
If your pull request includes any change or unexpected behaviour not covered below, please do make sure to include
|
||||||
|
it above in your description.
|
||||||
|
-->
|
||||||
|
|
||||||
|
[editorconfig]: https://editorconfig.org
|
||||||
|
[changelog]: https://github.com/NotAShelf/nvf/tree/main/docs/release-notes
|
||||||
|
|
||||||
|
- [ ] I have updated the [changelog] as per my changes.
|
||||||
|
- [ ] I have tested, and self-reviewed my code.
|
||||||
|
- Style and consistency
|
||||||
|
- [ ] I ran **Alejandra** to format my code (`nix fmt`).
|
||||||
|
- [ ] My code conforms to the [editorconfig] configuration of the project.
|
||||||
|
- [ ] My changes are consistent with the rest of the codebase.
|
||||||
|
- If new changes are particularly complex:
|
||||||
|
- [ ] My code includes comments in particularly complex areas
|
||||||
|
- [ ] I have added a section in the manual.
|
||||||
|
- [ ] _(For breaking changes)_ I have included a migration guide.
|
||||||
|
- Package(s) built:
|
||||||
|
- [ ] `.#nix` (default package)
|
||||||
|
- [ ] `.#maximal`
|
||||||
|
- [ ] `.#docs-html`
|
||||||
|
- Tested on platform(s)
|
||||||
|
- [ ] `x86_64-linux`
|
||||||
|
- [ ] `aarch64-linux`
|
||||||
|
- [ ] `x86_64-darwin`
|
||||||
|
- [ ] `aarch64-darwin`
|
||||||
|
|
||||||
|
<!--
|
||||||
|
If your changes touch upon a portion of the codebase that you do not understand well, please make sure to consult
|
||||||
|
the maintainers on your changes. In most cases, making an issue before creating your PR will help you avoid duplicate
|
||||||
|
efforts in the long run.
|
||||||
|
-->
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Add a :+1: [reaction] to [pull requests you find important].
|
||||||
|
|
||||||
|
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
|
||||||
|
[pull requests you find important]: https://github.com/NixOS/nixpkgs/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc
|
22
.github/workflows/cleanup.yml
vendored
Normal file
22
.github/workflows/cleanup.yml
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
name: Cleanup
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 4 1 * *" # 4AM on 1st of every month
|
||||||
|
- cron: "0 4 15 * *" # 4AM on the 15th of every month
|
||||||
|
jobs:
|
||||||
|
branches:
|
||||||
|
name: Cleanup old branches
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: "Checkout"
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: "Delete old branches"
|
||||||
|
uses: beatlabs/delete-old-branches-action@v0.0.10
|
||||||
|
with:
|
||||||
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
date: "1 months ago"
|
||||||
|
dry_run: false
|
||||||
|
delete_tags: false
|
||||||
|
exclude_open_pr_branches: true
|
|
@ -19,6 +19,7 @@ isMaximal: {
|
||||||
lspsaga.enable = false;
|
lspsaga.enable = false;
|
||||||
trouble.enable = true;
|
trouble.enable = true;
|
||||||
lspSignature.enable = true;
|
lspSignature.enable = true;
|
||||||
|
otter-nvim.enable = isMaximal;
|
||||||
lsplines.enable = isMaximal;
|
lsplines.enable = isMaximal;
|
||||||
nvim-docs-view.enable = isMaximal;
|
nvim-docs-view.enable = isMaximal;
|
||||||
};
|
};
|
||||||
|
@ -50,9 +51,11 @@ isMaximal: {
|
||||||
css.enable = isMaximal;
|
css.enable = isMaximal;
|
||||||
sql.enable = isMaximal;
|
sql.enable = isMaximal;
|
||||||
java.enable = isMaximal;
|
java.enable = isMaximal;
|
||||||
|
kotlin.enable = isMaximal;
|
||||||
ts.enable = isMaximal;
|
ts.enable = isMaximal;
|
||||||
svelte.enable = isMaximal;
|
svelte.enable = isMaximal;
|
||||||
go.enable = isMaximal;
|
go.enable = isMaximal;
|
||||||
|
lua.enable = isMaximal;
|
||||||
elixir.enable = isMaximal;
|
elixir.enable = isMaximal;
|
||||||
zig.enable = isMaximal;
|
zig.enable = isMaximal;
|
||||||
ocaml.enable = isMaximal;
|
ocaml.enable = isMaximal;
|
||||||
|
@ -67,6 +70,7 @@ isMaximal: {
|
||||||
lsp.server = "clangd";
|
lsp.server = "clangd";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
scala.enable = isMaximal;
|
||||||
rust = {
|
rust = {
|
||||||
enable = isMaximal;
|
enable = isMaximal;
|
||||||
crates.enable = isMaximal;
|
crates.enable = isMaximal;
|
||||||
|
@ -104,12 +108,10 @@ isMaximal: {
|
||||||
transparent = false;
|
transparent = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
autopairs.enable = true;
|
autopairs.nvim-autopairs.enable = true;
|
||||||
|
|
||||||
autocomplete = {
|
autocomplete.nvim-cmp.enable = true;
|
||||||
enable = true;
|
snippets.luasnip.enable = true;
|
||||||
type = "nvim-cmp";
|
|
||||||
};
|
|
||||||
|
|
||||||
filetree = {
|
filetree = {
|
||||||
nvimTree = {
|
nvimTree = {
|
||||||
|
@ -155,7 +157,7 @@ isMaximal: {
|
||||||
};
|
};
|
||||||
|
|
||||||
utility = {
|
utility = {
|
||||||
ccc.enable = isMaximal;
|
ccc.enable = false;
|
||||||
vim-wakatime.enable = false;
|
vim-wakatime.enable = false;
|
||||||
icon-picker.enable = isMaximal;
|
icon-picker.enable = isMaximal;
|
||||||
surround.enable = isMaximal;
|
surround.enable = isMaximal;
|
||||||
|
@ -172,6 +174,7 @@ isMaximal: {
|
||||||
|
|
||||||
notes = {
|
notes = {
|
||||||
obsidian.enable = false; # FIXME: neovim fails to build if obsidian is enabled
|
obsidian.enable = false; # FIXME: neovim fails to build if obsidian is enabled
|
||||||
|
neorg.enable = false;
|
||||||
orgmode.enable = false;
|
orgmode.enable = false;
|
||||||
mind-nvim.enable = isMaximal;
|
mind-nvim.enable = isMaximal;
|
||||||
todo-comments.enable = true;
|
todo-comments.enable = true;
|
||||||
|
|
|
@ -5,16 +5,19 @@ can add code that relies on other code. However, if you don't know what the
|
||||||
entries are called, it's hard to do that, so here is a list of the internal
|
entries are called, it's hard to do that, so here is a list of the internal
|
||||||
entries in nvf:
|
entries in nvf:
|
||||||
|
|
||||||
`vim.luaConfigRC` (top-level DAG):
|
## `vim.luaConfigRC` (top-level DAG) {#ch-vim-luaconfigrc}
|
||||||
|
|
||||||
1. (`luaConfigPre`) - not a part of the actual DAG, instead, it's simply
|
1. (`luaConfigPre`) - not a part of the actual DAG, instead, it's simply
|
||||||
inserted before the rest of the DAG
|
inserted before the rest of the DAG
|
||||||
2. `globalsScript` - used to set globals defined in `vim.globals`
|
2. `globalsScript` - used to set globals defined in `vim.globals`
|
||||||
3. `basic` - used to set basic configuration options
|
3. `basic` - used to set basic configuration options
|
||||||
4. `theme` (this is simply placed before `pluginConfigs`, meaning that surrounding entries don't depend on it) - used to set up the theme, which has to be done before other plugins
|
4. `optionsScript` - used to set options defined in `vim.o`
|
||||||
5. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option,
|
5. `theme` (this is simply placed before `pluginConfigs`, meaning that
|
||||||
see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your own
|
surrounding entries don't depend on it) - used to set up the theme, which has
|
||||||
plugins) DAG, used to set up internal plugins
|
to be done before other plugins
|
||||||
6. `extraPluginConfigs` - the result of `vim.extraPlugins`, which is not a
|
6. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option,
|
||||||
|
see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your
|
||||||
|
own plugins) DAG, used to set up internal plugins
|
||||||
|
7. `extraPluginConfigs` - the result of `vim.extraPlugins`, which is not a
|
||||||
direct DAG, but is converted to, and resolved as one internally
|
direct DAG, but is converted to, and resolved as one internally
|
||||||
7. `mappings` - the result of `vim.maps`
|
8. `mappings` - the result of `vim.maps`
|
||||||
|
|
|
@ -7,37 +7,26 @@ section contains a general overview to how you may utilize said functions.
|
||||||
|
|
||||||
## Custom Key Mappings Support for a Plugin {#sec-custom-key-mappings}
|
## Custom Key Mappings Support for a Plugin {#sec-custom-key-mappings}
|
||||||
|
|
||||||
To set a mapping, you should define it in `vim.maps.<<mode>>`.
|
To set a mapping, you should define it in `vim.keymaps`.
|
||||||
The available modes are:
|
|
||||||
|
|
||||||
- normal
|
|
||||||
- insert
|
|
||||||
- select
|
|
||||||
- visual
|
|
||||||
- terminal
|
|
||||||
- normalVisualOp
|
|
||||||
- visualOnly
|
|
||||||
- operator
|
|
||||||
- insertCommand
|
|
||||||
- lang
|
|
||||||
- command
|
|
||||||
|
|
||||||
An example, simple keybinding, can look like this:
|
An example, simple keybinding, can look like this:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
vim.maps.normal = {
|
vim.keymaps = [
|
||||||
"<leader>wq" = {
|
{
|
||||||
|
key = "<leader>wq";
|
||||||
|
mode = ["n"];
|
||||||
action = ":wq<CR>";
|
action = ":wq<CR>";
|
||||||
silent = true;
|
silent = true;
|
||||||
desc = "Save file and quit";
|
desc = "Save file and quit";
|
||||||
};
|
}
|
||||||
};
|
];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
There are many settings available in the options. Please refer to the
|
There are many settings available in the options. Please refer to the
|
||||||
[documentation](https://notashelf.github.io/nvf/options.html#opt-vim.maps.command._name_.action)
|
[documentation](https://notashelf.github.io/nvf/options.html#opt-vim.keymaps)
|
||||||
to see a list of them.
|
to see a list of them.
|
||||||
|
|
||||||
**nvf** provides a list of helper commands, so that you don't have to write the
|
**nvf** provides a list of helper commands, so that you don't have to write the
|
||||||
|
|
|
@ -26,6 +26,32 @@ making good use of its extensive Lua API. Additionally, Vimscript is slow and
|
||||||
brings unnecessary performance overhead while working with different
|
brings unnecessary performance overhead while working with different
|
||||||
configuration formats.
|
configuration formats.
|
||||||
|
|
||||||
|
### `vim.maps` rewrite {#sec-vim-maps-rewrite}
|
||||||
|
|
||||||
|
Instead of specifying map modes using submodules (eg.: `vim.maps.normal`), a new
|
||||||
|
`vim.keymaps` submodule with support for a `mode` option has been introduced. It
|
||||||
|
can be either a string, or a list of strings, where a string represents the
|
||||||
|
short-name of the map mode(s), that the mapping should be set for. See
|
||||||
|
`:help map-modes` for more information.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
vim.maps.normal."<leader>m" = { ... };
|
||||||
|
```
|
||||||
|
|
||||||
|
has to be replaced by
|
||||||
|
|
||||||
|
```nix
|
||||||
|
vim.keymaps = [
|
||||||
|
{
|
||||||
|
key = "<leader>m";
|
||||||
|
mode = "n";
|
||||||
|
}
|
||||||
|
...
|
||||||
|
];
|
||||||
|
```
|
||||||
|
|
||||||
### `vim.lsp.nvimCodeActionMenu` removed in favor of `vim.ui.fastaction` {#sec-nvim-code-action-menu-deprecation}
|
### `vim.lsp.nvimCodeActionMenu` removed in favor of `vim.ui.fastaction` {#sec-nvim-code-action-menu-deprecation}
|
||||||
|
|
||||||
The nvim-code-action-menu plugin has been archived and broken for a long time,
|
The nvim-code-action-menu plugin has been archived and broken for a long time,
|
||||||
|
@ -67,6 +93,9 @@ everyone.
|
||||||
- Add dap-go for better dap configurations
|
- Add dap-go for better dap configurations
|
||||||
- Make noice.nvim customizable
|
- Make noice.nvim customizable
|
||||||
- Standardize border style options and add custom borders
|
- Standardize border style options and add custom borders
|
||||||
|
- Remove `vim.disableDefaultRuntimePaths` in wrapper options.
|
||||||
|
- As nvf uses `$NVIM_APP_NAME` as of recent changes, we can safely assume any
|
||||||
|
configuration in `$XDG_CONFIG_HOME/nvf` is intentional.
|
||||||
|
|
||||||
[rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim
|
[rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim
|
||||||
[rustaceanvim]: https://github.com/mrcjkb/rustaceanvim
|
[rustaceanvim]: https://github.com/mrcjkb/rustaceanvim
|
||||||
|
@ -80,13 +109,17 @@ everyone.
|
||||||
|
|
||||||
[ocaml-lsp]: https://github.com/ocaml/ocaml-lsp
|
[ocaml-lsp]: https://github.com/ocaml/ocaml-lsp
|
||||||
[new-file-template.nvim]: https://github.com/otavioschwanck/new-file-template.nvim
|
[new-file-template.nvim]: https://github.com/otavioschwanck/new-file-template.nvim
|
||||||
|
[neo-tree.nvim]: https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||||
|
|
||||||
- Add [ocaml-lsp] support
|
- Add [ocaml-lsp] support
|
||||||
|
|
||||||
- Fix "Emac" typo
|
- Fix "Emac" typo
|
||||||
|
|
||||||
- Add [new-file-template.nvim] to automatically fill new file contents using
|
- Add [new-file-template.nvim] to automatically fill new file contents using
|
||||||
templates.
|
templates
|
||||||
|
|
||||||
|
- Make [neo-tree.nvim] display file icons properly by enabling
|
||||||
|
`visuals.nvimWebDevicons`
|
||||||
|
|
||||||
[diniamo](https://github.com/diniamo):
|
[diniamo](https://github.com/diniamo):
|
||||||
|
|
||||||
|
@ -120,10 +153,29 @@ everyone.
|
||||||
- Replace `vim.lsp.nvimCodeActionMenu` with `vim.ui.fastaction`, see the
|
- Replace `vim.lsp.nvimCodeActionMenu` with `vim.ui.fastaction`, see the
|
||||||
breaking changes section above for more details
|
breaking changes section above for more details
|
||||||
|
|
||||||
|
- Add a `setupOpts` option to nvim-surround, which allows modifying options that
|
||||||
|
aren't defined in nvf. Move the alternate nvim-surround keybinds to use
|
||||||
|
`setupOpts`.
|
||||||
|
|
||||||
|
- Remove `autopairs.type`, and rename `autopairs.enable` to
|
||||||
|
`autopairs.nvim-autopairs.enable`. The new
|
||||||
|
[](#opt-vim.autopairs.nvim-autopairs.enable) supports `setupOpts` format by
|
||||||
|
default.
|
||||||
|
|
||||||
|
- Refactor of `nvim-cmp` and completion related modules
|
||||||
|
- Remove `autocomplete.type` in favor of per-plugin enable options such as
|
||||||
|
[](#opt-vim.autocomplete.nvim-cmp.enable).
|
||||||
|
- Deprecate legacy Vimsnip in favor of Luasnip, and integrate
|
||||||
|
friendly-snippets for bundled snippets. [](#opt-vim.snippets.luasnip.enable)
|
||||||
|
can be used to toggle Luasnip.
|
||||||
|
- Add sorting function options for completion sources under
|
||||||
|
[](#opt-vim.autocomplete.nvim-cmp.setupOpts.sorting.comparators)
|
||||||
|
|
||||||
[Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd()
|
[Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd()
|
||||||
|
|
||||||
- Make Neovim's configuration file entirely Lua based. This comes with a few
|
- Make Neovim's configuration file entirely Lua based. This comes with a few
|
||||||
breaking changes:
|
breaking changes:
|
||||||
|
|
||||||
- `vim.configRC` has been removed. You will need to migrate your entries to
|
- `vim.configRC` has been removed. You will need to migrate your entries to
|
||||||
Neovim-compliant Lua code, and add them to `vim.luaConfigRC` instead.
|
Neovim-compliant Lua code, and add them to `vim.luaConfigRC` instead.
|
||||||
Existing vimscript configurations may be preserved in `vim.cmd` functions.
|
Existing vimscript configurations may be preserved in `vim.cmd` functions.
|
||||||
|
@ -132,6 +184,8 @@ everyone.
|
||||||
has been introduced for setting up internal plugins. See the "DAG entries in
|
has been introduced for setting up internal plugins. See the "DAG entries in
|
||||||
nvf" manual page for more information.
|
nvf" manual page for more information.
|
||||||
|
|
||||||
|
- Rewrite `vim.maps`, see the breaking changes section above.
|
||||||
|
|
||||||
[NotAShelf](https://github.com/notashelf):
|
[NotAShelf](https://github.com/notashelf):
|
||||||
|
|
||||||
[ts-error-translator.nvim]: https://github.com/dmmulroy/ts-error-translator.nvim
|
[ts-error-translator.nvim]: https://github.com/dmmulroy/ts-error-translator.nvim
|
||||||
|
@ -187,12 +241,40 @@ everyone.
|
||||||
- Add [python-lsp-server](https://github.com/python-lsp/python-lsp-server) as an
|
- Add [python-lsp-server](https://github.com/python-lsp/python-lsp-server) as an
|
||||||
additional Python LSP server.
|
additional Python LSP server.
|
||||||
|
|
||||||
|
- Add [](#opt-vim.options) to set `vim.o` values in in your nvf configuration
|
||||||
|
without using additional Lua. See option documentation for more details.
|
||||||
|
|
||||||
|
- Add [](#opt-vim.dashboard.dashboard-nvim.setupOpts) to allow user
|
||||||
|
configuration for [dashboard.nvim](https://github.com/nvimdev/dashboard-nvim)
|
||||||
|
|
||||||
|
- Update `lualine.nvim` input and add missing themes:
|
||||||
|
- Adds `ayu`, `gruvbox_dark`, `iceberg`, `moonfly`, `onedark`,
|
||||||
|
`powerline_dark` and `solarized_light` themes.
|
||||||
|
|
||||||
[ppenguin](https://github.com/ppenguin):
|
[ppenguin](https://github.com/ppenguin):
|
||||||
|
|
||||||
- Telescope:
|
- Telescope:
|
||||||
- Fixed `project-nvim` command and keybinding
|
- Fixed `project-nvim` command and keybinding
|
||||||
- Added default ikeybind/command for `Telescope resume` (`<leader>fr`)
|
- Added default ikeybind/command for `Telescope resume` (`<leader>fr`)
|
||||||
|
|
||||||
[Soliprem](https://github.com/Soliprem)
|
[Soliprem](https://github.com/Soliprem):
|
||||||
|
|
||||||
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
||||||
|
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
||||||
|
ccc
|
||||||
|
- Add Neorg support under `vim.notes.neorg`
|
||||||
|
- Add LSP, diagnostics, formatter and Treesitter support for Kotlin under
|
||||||
|
`vim.languages.kotlin`
|
||||||
|
- changed default keybinds for leap.nvim to avoid altering expected behavior
|
||||||
|
|
||||||
|
[Bloxx12](https://github.com/Bloxx12)
|
||||||
|
|
||||||
|
- Add support for [base16 theming](https://github.com/RRethy/base16-nvim) under
|
||||||
|
`vim.theme`
|
||||||
|
- Fix internal breakage in `elixir-tools` setup.
|
||||||
|
|
||||||
|
[ksonj](https://github.com/ksonj):
|
||||||
|
|
||||||
|
- Add LSP support for Scala via
|
||||||
|
[nvim-metals](https://github.com/scalameta/nvim-metals)
|
||||||
|
|
||||||
|
|
216
flake.lock
216
flake.lock
|
@ -172,6 +172,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-base16": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1716483968,
|
||||||
|
"narHash": "sha256-GRF/6AobXHamw8TZ3FjL7SI6ulcpwpcohsIuZeCSh2A=",
|
||||||
|
"owner": "rrethy",
|
||||||
|
"repo": "base16-nvim",
|
||||||
|
"rev": "6ac181b5733518040a33017dde654059cd771b7c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rrethy",
|
||||||
|
"repo": "base16-nvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-bufdelete-nvim": {
|
"plugin-bufdelete-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -191,11 +207,11 @@
|
||||||
"plugin-catppuccin": {
|
"plugin-catppuccin": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1716704960,
|
"lastModified": 1728131011,
|
||||||
"narHash": "sha256-UDPS+1o8FQGkfqiG4GX4DNUI2pU5hIvagmfnWTKDb44=",
|
"narHash": "sha256-j6F078taxuGzr3jngrc+Pc5I1kDdxTLMETgq6Xn4w/4=",
|
||||||
"owner": "catppuccin",
|
"owner": "catppuccin",
|
||||||
"repo": "nvim",
|
"repo": "nvim",
|
||||||
"rev": "5215ea59df6d0a7e27da9a5cd1165e06d1b04cbe",
|
"rev": "7be452ee067978cdc8b2c5f3411f0c71ffa612b9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -300,6 +316,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-cmp-luasnip": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696878902,
|
||||||
|
"narHash": "sha256-nUJJl2zyK/oSwz5RzI9j3gf9zpDfCImCYbPbVsyXgz8=",
|
||||||
|
"owner": "saadparwaiz1",
|
||||||
|
"repo": "cmp_luasnip",
|
||||||
|
"rev": "05a9ab28b53f71d1aece421ef32fee2cb857a843",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "saadparwaiz1",
|
||||||
|
"repo": "cmp_luasnip",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-cmp-nvim-lsp": {
|
"plugin-cmp-nvim-lsp": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -348,22 +380,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"plugin-cmp-vsnip": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1669100283,
|
|
||||||
"narHash": "sha256-2mkN03noOr5vBvRbSb35xZKorSH+8savQNZtgM9+QcM=",
|
|
||||||
"owner": "hrsh7th",
|
|
||||||
"repo": "cmp-vsnip",
|
|
||||||
"rev": "989a8a73c44e926199bfd05fa7a516d51f2d2752",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "hrsh7th",
|
|
||||||
"repo": "cmp-vsnip",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"plugin-codewindow-nvim": {
|
"plugin-codewindow-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -588,6 +604,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-friendly-snippets": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1727061933,
|
||||||
|
"narHash": "sha256-yTsuV5unoujY0mhLINssYYBWCeefe+nJaxQHJKm7hlk=",
|
||||||
|
"owner": "rafamadriz",
|
||||||
|
"repo": "friendly-snippets",
|
||||||
|
"rev": "00ba9dd3df89509f95437b8d595553707c46d5ea",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rafamadriz",
|
||||||
|
"repo": "friendly-snippets",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-gesture-nvim": {
|
"plugin-gesture-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -812,14 +844,30 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-lua-utils-nvim": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1708177208,
|
||||||
|
"narHash": "sha256-9ildzQEMkXKZ3LHq+khGFgRQFxlIXQclQ7QU3fcU1C4=",
|
||||||
|
"owner": "nvim-neorg",
|
||||||
|
"repo": "lua-utils.nvim",
|
||||||
|
"rev": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nvim-neorg",
|
||||||
|
"repo": "lua-utils.nvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-lualine": {
|
"plugin-lualine": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712310396,
|
"lastModified": 1723473562,
|
||||||
"narHash": "sha256-WcH2dWdRDgMkwBQhcgT+Z/ArMdm+VbRhmQftx4t2kNI=",
|
"narHash": "sha256-gCm7m96PkZyrgjmt7Efc+NMZKStAq1zr7JRCYOgGDuE=",
|
||||||
"owner": "hoob3rt",
|
"owner": "hoob3rt",
|
||||||
"repo": "lualine.nvim",
|
"repo": "lualine.nvim",
|
||||||
"rev": "0a5a66803c7407767b799067986b4dc3036e1983",
|
"rev": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -828,6 +876,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-luasnip": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1726165831,
|
||||||
|
"narHash": "sha256-nkaa1NGOI28Et2QitQB+Spv+J42QVdHE1oywteLcJJw=",
|
||||||
|
"owner": "L3MON4D3",
|
||||||
|
"repo": "LuaSnip",
|
||||||
|
"rev": "e808bee352d1a6fcf902ca1a71cee76e60e24071",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "L3MON4D3",
|
||||||
|
"repo": "LuaSnip",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-mind-nvim": {
|
"plugin-mind-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -924,6 +988,38 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-neorg": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1727821831,
|
||||||
|
"narHash": "sha256-yfWQ6yKytu1jkWUtRZTVICslUWej6jVYv7frmSB7/6Q=",
|
||||||
|
"owner": "nvim-neorg",
|
||||||
|
"repo": "neorg",
|
||||||
|
"rev": "afc9a37bf021acb0853e95714c4c6436e1588286",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nvim-neorg",
|
||||||
|
"repo": "neorg",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plugin-neorg-telescope": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1722358034,
|
||||||
|
"narHash": "sha256-ei4uUqpIQjGKzu5ryu0Hlmis9TS9FJsYnjt4J4QdWlw=",
|
||||||
|
"owner": "nvim-neorg",
|
||||||
|
"repo": "neorg-telescope",
|
||||||
|
"rev": "ddb2556644cae922699a239bbb0fe16e25b084b7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nvim-neorg",
|
||||||
|
"repo": "neorg-telescope",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-new-file-template-nvim": {
|
"plugin-new-file-template-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1181,6 +1277,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-nvim-metals": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1728295172,
|
||||||
|
"narHash": "sha256-ja/+MNxZ3H9io9jDwm5rhE6iKNi86a22eCOY75g19O8=",
|
||||||
|
"owner": "scalameta",
|
||||||
|
"repo": "nvim-metals",
|
||||||
|
"rev": "f861db9fda55939797ac1b05238c49b0dcdc3bdb",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "scalameta",
|
||||||
|
"repo": "nvim-metals",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-nvim-navbuddy": {
|
"plugin-nvim-navbuddy": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1405,6 +1517,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-otter-nvim": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1724585935,
|
||||||
|
"narHash": "sha256-euHwoK2WHLF/hrjLY2P4yGrIbYyBN38FL3q4CKNZmLY=",
|
||||||
|
"owner": "jmbuhr",
|
||||||
|
"repo": "otter.nvim",
|
||||||
|
"rev": "ca9ce67d0399380b659923381b58d174344c9ee7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "jmbuhr",
|
||||||
|
"repo": "otter.nvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-oxocarbon": {
|
"plugin-oxocarbon": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1421,6 +1549,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-pathlib-nvim": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1724943804,
|
||||||
|
"narHash": "sha256-YhCJeNKlcjgg3q51UWFhuIEPzNueC8YTpeuPPJDndvw=",
|
||||||
|
"owner": "pysan3",
|
||||||
|
"repo": "pathlib.nvim",
|
||||||
|
"rev": "57e5598af6fe253761c1b48e0b59b7cd6699e2c1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "pysan3",
|
||||||
|
"repo": "pathlib.nvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-plenary-nvim": {
|
"plugin-plenary-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1757,22 +1901,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"plugin-vim-vsnip": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1704937299,
|
|
||||||
"narHash": "sha256-gvm6z4pgSULBVPukewRyjwxZ0vZgreQWbG/0kOB1QBo=",
|
|
||||||
"owner": "hrsh7th",
|
|
||||||
"repo": "vim-vsnip",
|
|
||||||
"rev": "02a8e79295c9733434aab4e0e2b8c4b7cea9f3a9",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "hrsh7th",
|
|
||||||
"repo": "vim-vsnip",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"plugin-which-key": {
|
"plugin-which-key": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1818,6 +1946,7 @@
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nmd": "nmd",
|
"nmd": "nmd",
|
||||||
"plugin-alpha-nvim": "plugin-alpha-nvim",
|
"plugin-alpha-nvim": "plugin-alpha-nvim",
|
||||||
|
"plugin-base16": "plugin-base16",
|
||||||
"plugin-bufdelete-nvim": "plugin-bufdelete-nvim",
|
"plugin-bufdelete-nvim": "plugin-bufdelete-nvim",
|
||||||
"plugin-catppuccin": "plugin-catppuccin",
|
"plugin-catppuccin": "plugin-catppuccin",
|
||||||
"plugin-ccc": "plugin-ccc",
|
"plugin-ccc": "plugin-ccc",
|
||||||
|
@ -1826,10 +1955,10 @@
|
||||||
"plugin-cheatsheet-nvim": "plugin-cheatsheet-nvim",
|
"plugin-cheatsheet-nvim": "plugin-cheatsheet-nvim",
|
||||||
"plugin-cinnamon-nvim": "plugin-cinnamon-nvim",
|
"plugin-cinnamon-nvim": "plugin-cinnamon-nvim",
|
||||||
"plugin-cmp-buffer": "plugin-cmp-buffer",
|
"plugin-cmp-buffer": "plugin-cmp-buffer",
|
||||||
|
"plugin-cmp-luasnip": "plugin-cmp-luasnip",
|
||||||
"plugin-cmp-nvim-lsp": "plugin-cmp-nvim-lsp",
|
"plugin-cmp-nvim-lsp": "plugin-cmp-nvim-lsp",
|
||||||
"plugin-cmp-path": "plugin-cmp-path",
|
"plugin-cmp-path": "plugin-cmp-path",
|
||||||
"plugin-cmp-treesitter": "plugin-cmp-treesitter",
|
"plugin-cmp-treesitter": "plugin-cmp-treesitter",
|
||||||
"plugin-cmp-vsnip": "plugin-cmp-vsnip",
|
|
||||||
"plugin-codewindow-nvim": "plugin-codewindow-nvim",
|
"plugin-codewindow-nvim": "plugin-codewindow-nvim",
|
||||||
"plugin-comment-nvim": "plugin-comment-nvim",
|
"plugin-comment-nvim": "plugin-comment-nvim",
|
||||||
"plugin-conform-nvim": "plugin-conform-nvim",
|
"plugin-conform-nvim": "plugin-conform-nvim",
|
||||||
|
@ -1844,6 +1973,7 @@
|
||||||
"plugin-fastaction-nvim": "plugin-fastaction-nvim",
|
"plugin-fastaction-nvim": "plugin-fastaction-nvim",
|
||||||
"plugin-fidget-nvim": "plugin-fidget-nvim",
|
"plugin-fidget-nvim": "plugin-fidget-nvim",
|
||||||
"plugin-flutter-tools": "plugin-flutter-tools",
|
"plugin-flutter-tools": "plugin-flutter-tools",
|
||||||
|
"plugin-friendly-snippets": "plugin-friendly-snippets",
|
||||||
"plugin-gesture-nvim": "plugin-gesture-nvim",
|
"plugin-gesture-nvim": "plugin-gesture-nvim",
|
||||||
"plugin-gitsigns-nvim": "plugin-gitsigns-nvim",
|
"plugin-gitsigns-nvim": "plugin-gitsigns-nvim",
|
||||||
"plugin-glow-nvim": "plugin-glow-nvim",
|
"plugin-glow-nvim": "plugin-glow-nvim",
|
||||||
|
@ -1858,13 +1988,17 @@
|
||||||
"plugin-lsp-signature": "plugin-lsp-signature",
|
"plugin-lsp-signature": "plugin-lsp-signature",
|
||||||
"plugin-lspkind": "plugin-lspkind",
|
"plugin-lspkind": "plugin-lspkind",
|
||||||
"plugin-lspsaga": "plugin-lspsaga",
|
"plugin-lspsaga": "plugin-lspsaga",
|
||||||
|
"plugin-lua-utils-nvim": "plugin-lua-utils-nvim",
|
||||||
"plugin-lualine": "plugin-lualine",
|
"plugin-lualine": "plugin-lualine",
|
||||||
|
"plugin-luasnip": "plugin-luasnip",
|
||||||
"plugin-mind-nvim": "plugin-mind-nvim",
|
"plugin-mind-nvim": "plugin-mind-nvim",
|
||||||
"plugin-minimap-vim": "plugin-minimap-vim",
|
"plugin-minimap-vim": "plugin-minimap-vim",
|
||||||
"plugin-modes-nvim": "plugin-modes-nvim",
|
"plugin-modes-nvim": "plugin-modes-nvim",
|
||||||
"plugin-neo-tree-nvim": "plugin-neo-tree-nvim",
|
"plugin-neo-tree-nvim": "plugin-neo-tree-nvim",
|
||||||
"plugin-neocord": "plugin-neocord",
|
"plugin-neocord": "plugin-neocord",
|
||||||
"plugin-neodev-nvim": "plugin-neodev-nvim",
|
"plugin-neodev-nvim": "plugin-neodev-nvim",
|
||||||
|
"plugin-neorg": "plugin-neorg",
|
||||||
|
"plugin-neorg-telescope": "plugin-neorg-telescope",
|
||||||
"plugin-new-file-template-nvim": "plugin-new-file-template-nvim",
|
"plugin-new-file-template-nvim": "plugin-new-file-template-nvim",
|
||||||
"plugin-noice-nvim": "plugin-noice-nvim",
|
"plugin-noice-nvim": "plugin-noice-nvim",
|
||||||
"plugin-none-ls": "plugin-none-ls",
|
"plugin-none-ls": "plugin-none-ls",
|
||||||
|
@ -1881,6 +2015,7 @@
|
||||||
"plugin-nvim-lightbulb": "plugin-nvim-lightbulb",
|
"plugin-nvim-lightbulb": "plugin-nvim-lightbulb",
|
||||||
"plugin-nvim-lint": "plugin-nvim-lint",
|
"plugin-nvim-lint": "plugin-nvim-lint",
|
||||||
"plugin-nvim-lspconfig": "plugin-nvim-lspconfig",
|
"plugin-nvim-lspconfig": "plugin-nvim-lspconfig",
|
||||||
|
"plugin-nvim-metals": "plugin-nvim-metals",
|
||||||
"plugin-nvim-navbuddy": "plugin-nvim-navbuddy",
|
"plugin-nvim-navbuddy": "plugin-nvim-navbuddy",
|
||||||
"plugin-nvim-navic": "plugin-nvim-navic",
|
"plugin-nvim-navic": "plugin-nvim-navic",
|
||||||
"plugin-nvim-neoclip": "plugin-nvim-neoclip",
|
"plugin-nvim-neoclip": "plugin-nvim-neoclip",
|
||||||
|
@ -1895,7 +2030,9 @@
|
||||||
"plugin-obsidian-nvim": "plugin-obsidian-nvim",
|
"plugin-obsidian-nvim": "plugin-obsidian-nvim",
|
||||||
"plugin-onedark": "plugin-onedark",
|
"plugin-onedark": "plugin-onedark",
|
||||||
"plugin-orgmode-nvim": "plugin-orgmode-nvim",
|
"plugin-orgmode-nvim": "plugin-orgmode-nvim",
|
||||||
|
"plugin-otter-nvim": "plugin-otter-nvim",
|
||||||
"plugin-oxocarbon": "plugin-oxocarbon",
|
"plugin-oxocarbon": "plugin-oxocarbon",
|
||||||
|
"plugin-pathlib-nvim": "plugin-pathlib-nvim",
|
||||||
"plugin-plenary-nvim": "plugin-plenary-nvim",
|
"plugin-plenary-nvim": "plugin-plenary-nvim",
|
||||||
"plugin-project-nvim": "plugin-project-nvim",
|
"plugin-project-nvim": "plugin-project-nvim",
|
||||||
"plugin-registers": "plugin-registers",
|
"plugin-registers": "plugin-registers",
|
||||||
|
@ -1917,7 +2054,6 @@
|
||||||
"plugin-vim-markdown": "plugin-vim-markdown",
|
"plugin-vim-markdown": "plugin-vim-markdown",
|
||||||
"plugin-vim-repeat": "plugin-vim-repeat",
|
"plugin-vim-repeat": "plugin-vim-repeat",
|
||||||
"plugin-vim-startify": "plugin-vim-startify",
|
"plugin-vim-startify": "plugin-vim-startify",
|
||||||
"plugin-vim-vsnip": "plugin-vim-vsnip",
|
|
||||||
"plugin-which-key": "plugin-which-key",
|
"plugin-which-key": "plugin-which-key",
|
||||||
"rnix-lsp": "rnix-lsp",
|
"rnix-lsp": "rnix-lsp",
|
||||||
"systems": "systems_2"
|
"systems": "systems_2"
|
||||||
|
|
74
flake.nix
74
flake.nix
|
@ -13,8 +13,8 @@
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
specialArgs = {inherit lib;};
|
specialArgs = {inherit lib;};
|
||||||
} {
|
} {
|
||||||
# provide overridable systems
|
# Allow users to bring their own systems.
|
||||||
# https://github.com/nix-systems/nix-systems
|
# «https://github.com/nix-systems/nix-systems»
|
||||||
systems = import inputs.systems;
|
systems = import inputs.systems;
|
||||||
imports = [
|
imports = [
|
||||||
./flake/apps.nix
|
./flake/apps.nix
|
||||||
|
@ -62,7 +62,6 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
formatter = pkgs.alejandra;
|
|
||||||
devShells = {
|
devShells = {
|
||||||
default = self'.devShells.lsp;
|
default = self'.devShells.lsp;
|
||||||
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
|
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
|
||||||
|
@ -70,6 +69,21 @@
|
||||||
packages = with pkgs; [nil statix deadnix alejandra];
|
packages = with pkgs; [nil statix deadnix alejandra];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Provide the default formatter. `nix fmt` in project root
|
||||||
|
# will format available files with the correct formatter.
|
||||||
|
# P.S: Please do not format with nixfmt! It messes with many
|
||||||
|
# syntax elements and results in unreadable code.
|
||||||
|
formatter = pkgs.alejandra;
|
||||||
|
|
||||||
|
# Check if codebase is properly formatted.
|
||||||
|
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
|
||||||
|
# or with `nix flake check`
|
||||||
|
checks = {
|
||||||
|
nix-fmt = pkgs.runCommand "nix-fmt-check" {nativeBuildInputs = [pkgs.alejandra];} ''
|
||||||
|
alejandra --check ${self} < /dev/null | tee $out
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -156,6 +170,11 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin-otter-nvim = {
|
||||||
|
url = "github:jmbuhr/otter.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
# Language support
|
# Language support
|
||||||
plugin-sqls-nvim = {
|
plugin-sqls-nvim = {
|
||||||
url = "github:nanotee/sqls.nvim";
|
url = "github:nanotee/sqls.nvim";
|
||||||
|
@ -187,6 +206,11 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin-nvim-metals = {
|
||||||
|
url = "github:scalameta/nvim-metals";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
# Formatters
|
# Formatters
|
||||||
plugin-conform-nvim = {
|
plugin-conform-nvim = {
|
||||||
url = "github:stevearc/conform.nvim";
|
url = "github:stevearc/conform.nvim";
|
||||||
|
@ -270,11 +294,6 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin-cmp-vsnip = {
|
|
||||||
url = "github:hrsh7th/cmp-vsnip";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
plugin-cmp-path = {
|
plugin-cmp-path = {
|
||||||
url = "github:hrsh7th/cmp-path";
|
url = "github:hrsh7th/cmp-path";
|
||||||
flake = false;
|
flake = false;
|
||||||
|
@ -285,9 +304,19 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin-cmp-luasnip = {
|
||||||
|
url = "github:saadparwaiz1/cmp_luasnip";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
# snippets
|
# snippets
|
||||||
plugin-vim-vsnip = {
|
plugin-luasnip = {
|
||||||
url = "github:hrsh7th/vim-vsnip";
|
url = "github:L3MON4D3/LuaSnip";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
plugin-friendly-snippets = {
|
||||||
|
url = "github:rafamadriz/friendly-snippets";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -342,6 +371,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# Themes
|
# Themes
|
||||||
|
plugin-base16 = {
|
||||||
|
url = "github:rrethy/base16-nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
plugin-tokyonight = {
|
plugin-tokyonight = {
|
||||||
url = "github:folke/tokyonight.nvim";
|
url = "github:folke/tokyonight.nvim";
|
||||||
flake = false;
|
flake = false;
|
||||||
|
@ -624,6 +658,26 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin-lua-utils-nvim = {
|
||||||
|
url = "github:nvim-neorg/lua-utils.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
plugin-pathlib-nvim = {
|
||||||
|
url = "github:pysan3/pathlib.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
plugin-neorg = {
|
||||||
|
url = "github:nvim-neorg/neorg";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
plugin-neorg-telescope = {
|
||||||
|
url = "github:nvim-neorg/neorg-telescope";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
plugin-nui-nvim = {
|
plugin-nui-nvim = {
|
||||||
# (required by noice.nvim)
|
# (required by noice.nvim)
|
||||||
url = "github:MunifTanjim/nui.nvim";
|
url = "github:MunifTanjim/nui.nvim";
|
||||||
|
|
5
lib/attrsets.nix
Normal file
5
lib/attrsets.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{lib}: let
|
||||||
|
inherit (builtins) listToAttrs;
|
||||||
|
in {
|
||||||
|
mapListToAttrs = f: list: listToAttrs (map f list);
|
||||||
|
}
|
|
@ -10,6 +10,7 @@
|
||||||
dag = import ./dag.nix {inherit lib;};
|
dag = import ./dag.nix {inherit lib;};
|
||||||
languages = import ./languages.nix {inherit lib;};
|
languages = import ./languages.nix {inherit lib;};
|
||||||
lists = import ./lists.nix {inherit lib;};
|
lists = import ./lists.nix {inherit lib;};
|
||||||
|
attrsets = import ./attrsets.nix {inherit lib;};
|
||||||
lua = import ./lua.nix {inherit lib;};
|
lua = import ./lua.nix {inherit lib;};
|
||||||
neovimConfiguration = import ../modules {inherit inputs lib;};
|
neovimConfiguration = import ../modules {inherit inputs lib;};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
{lib}: let
|
{lib}: let
|
||||||
inherit (builtins) isString getAttr;
|
inherit (builtins) isString getAttr;
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.attrsets) listToAttrs;
|
|
||||||
inherit (lib.types) bool;
|
inherit (lib.types) bool;
|
||||||
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
in {
|
in {
|
||||||
# A wrapper around `mkOption` to create a boolean option that is
|
# A wrapper around `mkOption` to create a boolean option that is
|
||||||
# used for Language Server modules.
|
# used for Language Server modules.
|
||||||
|
@ -21,19 +21,19 @@ in {
|
||||||
config,
|
config,
|
||||||
diagnosticsProviders,
|
diagnosticsProviders,
|
||||||
}:
|
}:
|
||||||
listToAttrs
|
mapListToAttrs
|
||||||
(map (v: let
|
(v: let
|
||||||
type =
|
type =
|
||||||
if isString v
|
if isString v
|
||||||
then v
|
then v
|
||||||
else getAttr v.type;
|
else getAttr v.type;
|
||||||
package =
|
package =
|
||||||
if isString v
|
if isString v
|
||||||
then diagnosticsProviders.${type}.package
|
then diagnosticsProviders.${type}.package
|
||||||
else v.package;
|
else v.package;
|
||||||
in {
|
in {
|
||||||
name = "${lang}-diagnostics-${type}";
|
name = "${lang}-diagnostics-${type}";
|
||||||
value = diagnosticsProviders.${type}.nullConfig package;
|
value = diagnosticsProviders.${type}.nullConfig package;
|
||||||
})
|
})
|
||||||
config);
|
config;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
{lib}: let
|
{lib}: let
|
||||||
inherit (lib) isStringLike showOption showFiles getFiles mergeOneOption mergeEqualOption mkOptionType;
|
inherit (lib.options) showOption showFiles getFiles mergeOneOption mergeEqualOption;
|
||||||
inherit (lib.types) anything attrsOf;
|
inherit (lib.strings) isString isStringLike;
|
||||||
|
inherit (lib.types) anything attrsOf listOf mkOptionType;
|
||||||
inherit (lib.nvim.types) anythingConcatLists;
|
inherit (lib.nvim.types) anythingConcatLists;
|
||||||
inherit (builtins) typeOf isAttrs any head concatLists stringLength;
|
inherit (builtins) typeOf isAttrs any head concatLists stringLength match;
|
||||||
in {
|
in {
|
||||||
# HACK: Does this break anything in our case?
|
# HACK: Does this break anything in our case?
|
||||||
# A modified version of the nixpkgs anything type that concatenates lists
|
# A modified version of the nixpkgs anything type that concatenates lists
|
||||||
|
@ -51,6 +52,16 @@ in {
|
||||||
(mergeFunctions.${commonType} or mergeEqualOption) loc defs;
|
(mergeFunctions.${commonType} or mergeEqualOption) loc defs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mergelessListOf = elemType: let
|
||||||
|
super = listOf elemType;
|
||||||
|
in
|
||||||
|
super
|
||||||
|
// {
|
||||||
|
name = "mergelessListOf";
|
||||||
|
description = "mergeless ${super.description}";
|
||||||
|
merge = mergeEqualOption;
|
||||||
|
};
|
||||||
|
|
||||||
char = mkOptionType {
|
char = mkOptionType {
|
||||||
name = "char";
|
name = "char";
|
||||||
description = "character";
|
description = "character";
|
||||||
|
@ -58,4 +69,11 @@ in {
|
||||||
check = value: stringLength value < 2;
|
check = value: stringLength value < 2;
|
||||||
merge = mergeEqualOption;
|
merge = mergeEqualOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hexColor = mkOptionType {
|
||||||
|
name = "hex-color";
|
||||||
|
descriptionClass = "noun";
|
||||||
|
description = "RGB color in hex format";
|
||||||
|
check = v: isString v && (match "#?[0-9a-fA-F]{6}" v) != null;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
typesDag = import ./dag.nix {inherit lib;};
|
typesDag = import ./dag.nix {inherit lib;};
|
||||||
typesPlugin = import ./plugins.nix {inherit inputs lib;};
|
typesPlugin = import ./plugins.nix {inherit inputs lib;};
|
||||||
typesLanguage = import ./languages.nix {inherit lib;};
|
typesLanguage = import ./languages.nix {inherit lib;};
|
||||||
typesCustom = import ./custom.nix {inherit lib;};
|
customTypes = import ./custom.nix {inherit lib;};
|
||||||
in {
|
in {
|
||||||
inherit (typesDag) dagOf;
|
inherit (typesDag) dagOf;
|
||||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
||||||
inherit (typesLanguage) diagnostics mkGrammarOption;
|
inherit (typesLanguage) diagnostics mkGrammarOption;
|
||||||
inherit (typesCustom) anythingConcatLists char;
|
inherit (customTypes) anythingConcatLists char hexColor mergelessListOf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ in {
|
||||||
|
|
||||||
default = {};
|
default = {};
|
||||||
type = submodule {
|
type = submodule {
|
||||||
freeformType = attrsOf anything;
|
freeformType = anything;
|
||||||
options = opts;
|
options = opts;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.modules) mkRemovedOptionModule;
|
inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
# 2024-06-06
|
# 2024-06-06
|
||||||
|
@ -14,5 +14,40 @@ in {
|
||||||
available under `vim.ui.fastaction` as a replacement. Simply remove everything under
|
available under `vim.ui.fastaction` as a replacement. Simply remove everything under
|
||||||
`vim.lsp.nvimCodeActionMenu`, and set `vim.ui.fastaction.enable` to `true`.
|
`vim.lsp.nvimCodeActionMenu`, and set `vim.ui.fastaction.enable` to `true`.
|
||||||
'')
|
'')
|
||||||
|
|
||||||
|
(mkRemovedOptionModule ["vim" "autopairs" "enable"] ''
|
||||||
|
vim.autopairs.enable has been removed in favor of per-plugin modules.
|
||||||
|
You can enable nvim-autopairs with vim.autopairs.nvim-autopairs.enable instead.
|
||||||
|
'')
|
||||||
|
(mkRemovedOptionModule ["vim" "autopairs" "type"] ''
|
||||||
|
vim.autopairs.type has been removed in favor of per-plugin modules.
|
||||||
|
You can enable nvim-autopairs with vim.autopairs.nvim-autopairs.enable instead.
|
||||||
|
'')
|
||||||
|
(mkRemovedOptionModule ["vim" "autocomplete" "enable"] ''
|
||||||
|
vim.autocomplete.enable has been removed in favor of per-plugin modules.
|
||||||
|
You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead.
|
||||||
|
'')
|
||||||
|
(mkRemovedOptionModule ["vim" "autocomplete" "type"] ''
|
||||||
|
vim.autocomplete.type has been removed in favor of per-plugin modules.
|
||||||
|
You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead.
|
||||||
|
'')
|
||||||
|
(mkRemovedOptionModule ["vim" "snippets" "vsnip" "enable"] ''
|
||||||
|
vim.snippets.vsnip.enable has been removed in favor of the more modern luasnip.
|
||||||
|
'')
|
||||||
|
(mkRenamedOptionModule ["vim" "lsp" "lspkind" "mode"] ["vim" "lsp" "lspkind" "setupOpts" "mode"])
|
||||||
|
|
||||||
|
# 2024-10-14
|
||||||
|
(mkRemovedOptionModule ["vim" "configRC"] ''
|
||||||
|
Please migrate your configRC sections to Neovim's Lua format, and
|
||||||
|
add them to `vim.luaConfigRC`.
|
||||||
|
|
||||||
|
See the v0.7 release notes for more information on why and how to
|
||||||
|
migrate your existing configurations to the new format.
|
||||||
|
'')
|
||||||
|
|
||||||
|
(mkRemovedOptionModule ["vim" "disableDefaultRuntimePaths"] ''
|
||||||
|
Nvf now uses $NVIM_APP_NAME so there is no longer the problem of
|
||||||
|
(accidental) leaking of user configuration.
|
||||||
|
'')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,51 +3,75 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.trivial) pipe;
|
||||||
|
inherit (lib.attrsets) mapAttrsToList;
|
||||||
|
inherit (lib.lists) flatten;
|
||||||
|
|
||||||
|
legacyMapModes = {
|
||||||
|
normal = ["n"];
|
||||||
|
insert = ["i"];
|
||||||
|
select = ["s"];
|
||||||
|
visual = ["v"];
|
||||||
|
terminal = ["t"];
|
||||||
|
normalVisualOp = ["n" "v" "o"];
|
||||||
|
visualOnly = ["n" "x"];
|
||||||
|
operator = ["o"];
|
||||||
|
insertCommand = ["i" "c"];
|
||||||
|
lang = ["l"];
|
||||||
|
command = ["c"];
|
||||||
|
};
|
||||||
|
|
||||||
cfg = config.vim;
|
cfg = config.vim;
|
||||||
in {
|
in {
|
||||||
config = {
|
config = {
|
||||||
vim.maps = {
|
vim.keymaps = mkMerge [
|
||||||
normal = mkIf cfg.disableArrows {
|
(
|
||||||
"<up>" = {
|
mkIf cfg.disableArrows [
|
||||||
action = "<nop>";
|
{
|
||||||
|
key = "<up>";
|
||||||
noremap = false;
|
mode = ["n" "i"];
|
||||||
};
|
action = "<nop>";
|
||||||
"<down>" = {
|
noremap = false;
|
||||||
action = "<nop>";
|
}
|
||||||
|
{
|
||||||
noremap = false;
|
key = "<down>";
|
||||||
};
|
mode = ["n" "i"];
|
||||||
"<left>" = {
|
action = "<nop>";
|
||||||
action = "<nop>";
|
noremap = false;
|
||||||
noremap = false;
|
}
|
||||||
};
|
{
|
||||||
"<right>" = {
|
key = "<left>";
|
||||||
action = "<nop>";
|
mode = ["n" "i"];
|
||||||
noremap = false;
|
action = "<nop>";
|
||||||
};
|
noremap = false;
|
||||||
};
|
}
|
||||||
|
{
|
||||||
insert = mkIf cfg.disableArrows {
|
key = "<right>";
|
||||||
"<up>" = {
|
mode = ["n" "i"];
|
||||||
action = "<nop>";
|
action = "<nop>";
|
||||||
noremap = false;
|
noremap = false;
|
||||||
};
|
}
|
||||||
"<down>" = {
|
]
|
||||||
action = "<nop>";
|
)
|
||||||
noremap = false;
|
(
|
||||||
};
|
pipe cfg.maps
|
||||||
"<left>" = {
|
[
|
||||||
action = "<nop>";
|
(mapAttrsToList (
|
||||||
noremap = false;
|
oldMode: keybinds:
|
||||||
};
|
mapAttrsToList (
|
||||||
"<right>" = {
|
key: bind:
|
||||||
action = "<nop>";
|
bind
|
||||||
noremap = false;
|
// {
|
||||||
};
|
inherit key;
|
||||||
};
|
mode = legacyMapModes.${oldMode};
|
||||||
};
|
}
|
||||||
|
)
|
||||||
|
keybinds
|
||||||
|
))
|
||||||
|
flatten
|
||||||
|
]
|
||||||
|
)
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,101 +1,97 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption literalMD;
|
||||||
inherit (lib.types) bool str attrsOf nullOr submodule;
|
inherit (lib.types) either str listOf attrsOf nullOr submodule;
|
||||||
inherit (lib.nvim.config) mkBool;
|
inherit (lib.nvim.config) mkBool;
|
||||||
# Most of the keybindings code is highly inspired by pta2002/nixvim.
|
|
||||||
# Thank you!
|
|
||||||
mapConfigOptions = {
|
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 {
|
desc = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
description = "A description of this keybind, to be shown in which-key, if you have it enabled.";
|
description = "A description of this keybind, to be shown in which-key, if you have it enabled.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
action = mkOption {
|
||||||
|
type = str;
|
||||||
|
description = "The command to execute.";
|
||||||
|
};
|
||||||
|
lua = mkBool false ''
|
||||||
|
If true, `action` is considered to be lua code.
|
||||||
|
Thus, it will not be wrapped in `""`.
|
||||||
|
'';
|
||||||
|
|
||||||
|
silent = mkBool true "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.";
|
||||||
};
|
};
|
||||||
|
|
||||||
mapOption = submodule {
|
mapType = submodule {
|
||||||
options =
|
options =
|
||||||
mapConfigOptions
|
mapConfigOptions
|
||||||
// {
|
// {
|
||||||
action = mkOption {
|
key = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
description = "The action to execute.";
|
description = "The key that triggers this keybind.";
|
||||||
};
|
};
|
||||||
|
mode = mkOption {
|
||||||
lua = mkOption {
|
type = either str (listOf str);
|
||||||
type = bool;
|
|
||||||
description = ''
|
description = ''
|
||||||
If true, `action` is considered to be lua code.
|
The short-name of the mode to set the keymapping for. Passing an empty string is the equivalent of `:map`.
|
||||||
Thus, it will not be wrapped in `""`.
|
|
||||||
|
See `:help map-modes` for a list of modes.
|
||||||
'';
|
'';
|
||||||
default = false;
|
example = literalMD ''`["n" "v" "c"]` for normal, visual and command mode'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
mapOptions = mode:
|
legacyMapOption = mode:
|
||||||
mkOption {
|
mkOption {
|
||||||
description = "Mappings for ${mode} mode";
|
description = "Mappings for ${mode} mode";
|
||||||
type = attrsOf mapOption;
|
type = attrsOf (submodule {
|
||||||
|
options = mapConfigOptions;
|
||||||
|
});
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
options.vim = {
|
options.vim = {
|
||||||
maps = mkOption {
|
keymaps = mkOption {
|
||||||
type = submodule {
|
type = listOf mapType;
|
||||||
options = {
|
description = "Custom keybindings.";
|
||||||
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 = ''
|
example = ''
|
||||||
maps = {
|
vim.keymaps = [
|
||||||
normal."<leader>m" = {
|
{
|
||||||
|
key = "<leader>m";
|
||||||
|
mode = "n";
|
||||||
silent = true;
|
silent = true;
|
||||||
action = "<cmd>make<CR>";
|
action = ":make<CR>";
|
||||||
}; # Same as nnoremap <leader>m <silent> <cmd>make<CR>
|
}
|
||||||
};
|
{
|
||||||
|
key = "<leader>l";
|
||||||
|
mode = ["n" "x"];
|
||||||
|
silent = true;
|
||||||
|
action = "<cmd>cnext<CR>";
|
||||||
|
}
|
||||||
|
];
|
||||||
'';
|
'';
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
maps = {
|
||||||
|
normal = legacyMapOption "normal";
|
||||||
|
insert = legacyMapOption "insert";
|
||||||
|
select = legacyMapOption "select";
|
||||||
|
visual = legacyMapOption "visual and select";
|
||||||
|
terminal = legacyMapOption "terminal";
|
||||||
|
normalVisualOp = legacyMapOption "normal, visual, select and operator-pending (same as plain 'map')";
|
||||||
|
|
||||||
|
visualOnly = legacyMapOption "visual only";
|
||||||
|
operator = legacyMapOption "operator-pending";
|
||||||
|
insertCommand = legacyMapOption "insert and command-line";
|
||||||
|
lang = legacyMapOption "insert, command-line and lang-arg";
|
||||||
|
command = legacyMapOption "command-line";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@ in {
|
||||||
"copilot-cmp"
|
"copilot-cmp"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
vim.autocomplete.nvim-cmp.sources = {copilot = "[Copilot]";};
|
||||||
|
|
||||||
vim.pluginRC.copilot = entryAnywhere ''
|
vim.pluginRC.copilot = entryAnywhere ''
|
||||||
require("copilot").setup(${toLuaObject cfg.setupOpts})
|
require("copilot").setup(${toLuaObject cfg.setupOpts})
|
||||||
|
|
||||||
|
|
|
@ -4,16 +4,17 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.trivial) boolToString;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.autopairs;
|
cfg = config.vim.autopairs.nvim-autopairs;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = ["nvim-autopairs"];
|
vim = {
|
||||||
|
startPlugins = ["nvim-autopairs"];
|
||||||
vim.pluginRC.autopairs = entryAnywhere ''
|
pluginRC.autopairs = entryAnywhere ''
|
||||||
require("nvim-autopairs").setup({ map_cr = ${boolToString (!config.vim.autocomplete.enable)} })
|
require('nvim-autopairs').setup(${toLuaObject cfg.setupOpts})
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,14 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib) mkRemovedOptionModule;
|
inherit (lib) mkRemovedOptionModule;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption;
|
||||||
inherit (lib.types) enum;
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
(mkRemovedOptionModule ["vim" "autopairs" "nvim-compe"] "nvim-compe is deprecated and no longer suported.")
|
(mkRemovedOptionModule ["vim" "autopairs" "nvim-compe"] "nvim-compe is deprecated and no longer suported.")
|
||||||
];
|
];
|
||||||
|
|
||||||
options.vim = {
|
options.vim.autopairs.nvim-autopairs = {
|
||||||
autopairs = {
|
enable = mkEnableOption "autopairs";
|
||||||
enable = mkEnableOption "autopairs" // {default = false;};
|
setupOpts = mkPluginSetupOption "nvim-autopairs" {};
|
||||||
|
|
||||||
type = mkOption {
|
|
||||||
type = enum ["nvim-autopairs"];
|
|
||||||
default = "nvim-autopairs";
|
|
||||||
description = "Set the autopairs type. Options: nvim-autopairs [nvim-autopairs]";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,7 @@
|
||||||
inherit (self.options.vim.comments.comment-nvim) mappings;
|
inherit (self.options.vim.comments.comment-nvim) mappings;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim.startPlugins = ["comment-nvim"];
|
||||||
"comment-nvim"
|
|
||||||
];
|
|
||||||
|
|
||||||
vim.maps.normal = mkMerge [
|
vim.maps.normal = mkMerge [
|
||||||
(mkBinding cfg.mappings.toggleOpLeaderLine "<Plug>(comment_toggle_linewise)" mappings.toggleOpLeaderLine.description)
|
(mkBinding cfg.mappings.toggleOpLeaderLine "<Plug>(comment_toggle_linewise)" mappings.toggleOpLeaderLine.description)
|
||||||
|
@ -36,7 +34,7 @@ in {
|
||||||
mappings.toggleCurrentBlock.description)
|
mappings.toggleCurrentBlock.description)
|
||||||
];
|
];
|
||||||
|
|
||||||
vim.maps.visualOnly = mkMerge [
|
vim.maps.visual = mkMerge [
|
||||||
(mkBinding cfg.mappings.toggleSelectedLine "<Plug>(comment_toggle_linewise_visual)" mappings.toggleSelectedLine.description)
|
(mkBinding cfg.mappings.toggleSelectedLine "<Plug>(comment_toggle_linewise_visual)" mappings.toggleSelectedLine.description)
|
||||||
(mkBinding cfg.mappings.toggleSelectedBlock "<Plug>(comment_toggle_blockwise_visual)" mappings.toggleSelectedBlock.description)
|
(mkBinding cfg.mappings.toggleSelectedBlock "<Plug>(comment_toggle_blockwise_visual)" mappings.toggleSelectedBlock.description)
|
||||||
];
|
];
|
||||||
|
|
|
@ -3,246 +3,115 @@
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) toJSON;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.attrsets) attrNames mapAttrsToList;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.strings) concatMapStringsSep concatStringsSep optionalString;
|
inherit (lib.nvim.binds) addDescriptionsToMappings;
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
inherit (lib.nvim.dag) entryAnywhere entryAfter;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
|
||||||
cfg = config.vim.autocomplete;
|
cfg = config.vim.autocomplete.nvim-cmp;
|
||||||
lspkindEnabled = config.vim.lsp.enable && config.vim.lsp.lspkind.enable;
|
luasnipEnable = config.vim.snippets.luasnip.enable;
|
||||||
|
|
||||||
self = import ./nvim-cmp.nix {inherit lib;};
|
|
||||||
mappingDefinitions = self.options.vim.autocomplete.mappings;
|
|
||||||
|
|
||||||
|
self = import ./nvim-cmp.nix {inherit lib config;};
|
||||||
|
mappingDefinitions = self.options.vim.autocomplete.nvim-cmp.mappings;
|
||||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||||
|
|
||||||
builtSources =
|
|
||||||
concatMapStringsSep
|
|
||||||
"\n"
|
|
||||||
(n: "{ name = '${n}'},")
|
|
||||||
(attrNames cfg.sources);
|
|
||||||
|
|
||||||
builtMaps =
|
|
||||||
concatStringsSep
|
|
||||||
"\n"
|
|
||||||
(mapAttrsToList
|
|
||||||
(n: v:
|
|
||||||
if v == null
|
|
||||||
then ""
|
|
||||||
else "${n} = '${v}',")
|
|
||||||
cfg.sources);
|
|
||||||
|
|
||||||
dagPlacement =
|
|
||||||
if lspkindEnabled
|
|
||||||
then entryAfter ["lspkind"]
|
|
||||||
else entryAnywhere;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim = {
|
||||||
"nvim-cmp"
|
startPlugins = [
|
||||||
"cmp-buffer"
|
"nvim-cmp"
|
||||||
"cmp-vsnip"
|
"cmp-buffer"
|
||||||
"cmp-path"
|
"cmp-path"
|
||||||
"vim-vsnip"
|
];
|
||||||
];
|
|
||||||
|
|
||||||
vim.autocomplete.sources = {
|
autocomplete.nvim-cmp.sources = {
|
||||||
"nvim-cmp" = null;
|
nvim-cmp = null;
|
||||||
"vsnip" = "[VSnip]";
|
buffer = "[Buffer]";
|
||||||
"buffer" = "[Buffer]";
|
path = "[Path]";
|
||||||
"crates" = "[Crates]";
|
};
|
||||||
"path" = "[Path]";
|
|
||||||
"copilot" = "[Copilot]";
|
|
||||||
};
|
|
||||||
|
|
||||||
vim.maps.insert = mkMerge [
|
autocomplete.nvim-cmp.setupOpts = {
|
||||||
(mkSetLuaBinding mappings.complete ''
|
sources = map (s: {name = s;}) (attrNames cfg.sources);
|
||||||
require('cmp').complete
|
|
||||||
'')
|
# TODO: try to get nvim-cmp to follow global border style
|
||||||
(let
|
window = mkIf config.vim.ui.borders.enable {
|
||||||
defaultKeys =
|
completion = mkLuaInline "cmp.config.window.bordered()";
|
||||||
if config.vim.autopairs.enable
|
documentation = mkLuaInline "cmp.config.window.bordered()";
|
||||||
then "require('nvim-autopairs').autopairs_cr()"
|
};
|
||||||
else "vim.api.nvim_replace_termcodes(${toJSON mappings.confirm.value}, true, false, true)";
|
|
||||||
in
|
formatting.format = cfg.format;
|
||||||
mkSetLuaBinding mappings.confirm ''
|
};
|
||||||
function()
|
|
||||||
if not require('cmp').confirm({ select = true }) then
|
pluginRC.nvim-cmp = mkIf cfg.enable (entryAfter ["autopairs" "luasnip"] ''
|
||||||
vim.fn.feedkeys(${defaultKeys}, 'n')
|
local luasnip = require("luasnip")
|
||||||
|
local cmp = require("cmp")
|
||||||
|
cmp.setup(${toLuaObject cfg.setupOpts})
|
||||||
|
'');
|
||||||
|
|
||||||
|
# `cmp` and `luasnip` are defined above, in the `nvim-cmp` section
|
||||||
|
autocomplete.nvim-cmp.setupOpts.mapping = {
|
||||||
|
${mappings.complete.value} = mkLuaInline "cmp.mapping.complete()";
|
||||||
|
${mappings.close.value} = mkLuaInline "cmp.mapping.abort()";
|
||||||
|
${mappings.scrollDocsUp.value} = mkLuaInline "cmp.mapping.scroll_docs(-4)";
|
||||||
|
${mappings.scrollDocsDown.value} = mkLuaInline "cmp.mapping.scroll_docs(4)";
|
||||||
|
|
||||||
|
${mappings.confirm.value} = mkLuaInline ''
|
||||||
|
cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
${
|
||||||
|
if luasnipEnable
|
||||||
|
then ''
|
||||||
|
if luasnip.expandable() then
|
||||||
|
luasnip.expand()
|
||||||
|
else
|
||||||
|
cmp.confirm({ select = true })
|
||||||
|
end
|
||||||
|
''
|
||||||
|
else "cmp.confirm({ select = true })"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
end
|
end
|
||||||
end
|
end)
|
||||||
'')
|
'';
|
||||||
(mkSetLuaBinding mappings.next ''
|
|
||||||
function()
|
|
||||||
local has_words_before = function()
|
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
|
||||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local cmp = require('cmp')
|
${mappings.next.value} = mkLuaInline ''
|
||||||
|
cmp.mapping(function(fallback)
|
||||||
|
local has_words_before = function()
|
||||||
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
|
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||||
|
end
|
||||||
|
|
||||||
local feedkey = function(key, mode)
|
if cmp.visible() then
|
||||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
|
cmp.select_next_item()
|
||||||
end
|
${optionalString luasnipEnable ''
|
||||||
|
elseif luasnip.locally_jumpable(1) then
|
||||||
|
luasnip.jump(1)
|
||||||
|
''}
|
||||||
|
elseif has_words_before() then
|
||||||
|
cmp.complete()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
'';
|
||||||
|
|
||||||
if cmp.visible() then
|
${mappings.previous.value} = mkLuaInline ''
|
||||||
cmp.select_next_item()
|
cmp.mapping(function(fallback)
|
||||||
elseif vim.fn['vsnip#available'](1) == 1 then
|
if cmp.visible() then
|
||||||
feedkey("<Plug>(vsnip-expand-or-jump)", "")
|
cmp.select_prev_item()
|
||||||
elseif has_words_before() then
|
${optionalString luasnipEnable ''
|
||||||
cmp.complete()
|
elseif luasnip.locally_jumpable(-1) then
|
||||||
else
|
luasnip.jump(-1)
|
||||||
local termcode = vim.api.nvim_replace_termcodes(${toJSON mappings.next.value}, true, false, true)
|
''}
|
||||||
|
else
|
||||||
vim.fn.feedkeys(termcode, 'n')
|
fallback()
|
||||||
end
|
end
|
||||||
end
|
end)
|
||||||
'')
|
'';
|
||||||
(mkSetLuaBinding mappings.previous ''
|
};
|
||||||
function()
|
};
|
||||||
local cmp = require('cmp')
|
|
||||||
|
|
||||||
local feedkey = function(key, mode)
|
|
||||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif vim.fn['vsnip#available'](-1) == 1 then
|
|
||||||
feedkeys("<Plug>(vsnip-jump-prev)", "")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
'')
|
|
||||||
(mkSetLuaBinding mappings.close ''
|
|
||||||
require('cmp').mapping.abort()
|
|
||||||
'')
|
|
||||||
(mkSetLuaBinding mappings.scrollDocsUp ''
|
|
||||||
require('cmp').mapping.scroll_docs(-4)
|
|
||||||
'')
|
|
||||||
(mkSetLuaBinding mappings.scrollDocsDown ''
|
|
||||||
require('cmp').mapping.scroll_docs(4)
|
|
||||||
'')
|
|
||||||
];
|
|
||||||
|
|
||||||
vim.maps.command = mkMerge [
|
|
||||||
(mkSetLuaBinding mappings.complete ''
|
|
||||||
require('cmp').complete
|
|
||||||
'')
|
|
||||||
(mkSetLuaBinding mappings.close ''
|
|
||||||
require('cmp').mapping.close()
|
|
||||||
'')
|
|
||||||
(mkSetLuaBinding mappings.scrollDocsUp ''
|
|
||||||
require('cmp').mapping.scroll_docs(-4)
|
|
||||||
'')
|
|
||||||
(mkSetLuaBinding mappings.scrollDocsDown ''
|
|
||||||
require('cmp').mapping.scroll_docs(4)
|
|
||||||
'')
|
|
||||||
];
|
|
||||||
|
|
||||||
vim.maps.select = mkMerge [
|
|
||||||
(mkSetLuaBinding mappings.next ''
|
|
||||||
function()
|
|
||||||
local cmp = require('cmp')
|
|
||||||
local has_words_before = function()
|
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
|
||||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local feedkey = function(key, mode)
|
|
||||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
elseif vim.fn['vsnip#available'](1) == 1 then
|
|
||||||
feedkey("<Plug>(vsnip-expand-or-jump)", "")
|
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
else
|
|
||||||
local termcode = vim.api.nvim_replace_termcodes(${toJSON mappings.next.value}, true, false, true)
|
|
||||||
|
|
||||||
vim.fn.feedkeys(termcode, 'n')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
'')
|
|
||||||
(mkSetLuaBinding mappings.previous ''
|
|
||||||
function()
|
|
||||||
local cmp = require('cmp')
|
|
||||||
|
|
||||||
local feedkey = function(key, mode)
|
|
||||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif vim.fn['vsnip#available'](-1) == 1 then
|
|
||||||
feedkeys("<Plug>(vsnip-jump-prev)", "")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
'')
|
|
||||||
];
|
|
||||||
|
|
||||||
# TODO: alternative snippet engines to vsnip
|
|
||||||
# https://github.com/hrsh7th/nvim-cmp/blob/main/doc/cmp.txt#L82
|
|
||||||
vim.pluginRC.completion = mkIf (cfg.type == "nvim-cmp") (dagPlacement ''
|
|
||||||
local nvim_cmp_menu_map = function(entry, vim_item)
|
|
||||||
-- name for each source
|
|
||||||
vim_item.menu = ({
|
|
||||||
${builtMaps}
|
|
||||||
})[entry.source.name]
|
|
||||||
return vim_item
|
|
||||||
end
|
|
||||||
|
|
||||||
${optionalString lspkindEnabled ''
|
|
||||||
lspkind_opts.before = ${cfg.formatting.format}
|
|
||||||
''}
|
|
||||||
|
|
||||||
local cmp = require'cmp'
|
|
||||||
cmp.setup({
|
|
||||||
${optionalString config.vim.ui.borders.enable ''
|
|
||||||
-- explicitly enabled by setting ui.borders.enable = true
|
|
||||||
-- TODO: try to get nvim-cmp to follow global border style
|
|
||||||
window = {
|
|
||||||
completion = cmp.config.window.bordered(),
|
|
||||||
documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
''}
|
|
||||||
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
vim.fn["vsnip#anonymous"](args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
sources = {
|
|
||||||
${builtSources}
|
|
||||||
},
|
|
||||||
|
|
||||||
completion = {
|
|
||||||
completeopt = 'menu,menuone,noinsert',
|
|
||||||
${optionalString (!cfg.alwaysComplete) "autocomplete = false"}
|
|
||||||
},
|
|
||||||
|
|
||||||
formatting = {
|
|
||||||
format =
|
|
||||||
${
|
|
||||||
if lspkindEnabled
|
|
||||||
then "lspkind.cmp_format(lspkind_opts)"
|
|
||||||
else cfg.formatting.format
|
|
||||||
},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
${optionalString (config.vim.autopairs.enable && config.vim.autopairs.type == "nvim-autopairs") ''
|
|
||||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
|
||||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({ map_char = { text = ""} }))
|
|
||||||
''}
|
|
||||||
'');
|
|
||||||
|
|
||||||
vim.snippets.vsnip.enable =
|
|
||||||
if (cfg.type == "nvim-cmp")
|
|
||||||
then true
|
|
||||||
else config.vim.snippets.vsnip.enable;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
_: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./config.nix
|
./config.nix
|
||||||
./nvim-cmp.nix
|
./nvim-cmp.nix
|
||||||
|
|
|
@ -1,72 +1,103 @@
|
||||||
{lib, ...}: let
|
{
|
||||||
inherit (lib.options) mkEnableOption mkOption literalMD;
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption literalExpression literalMD;
|
||||||
|
inherit (lib.types) str attrsOf nullOr either;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
inherit (lib.types) enum attrsOf nullOr str bool;
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline mergelessListOf;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (builtins) isString;
|
||||||
|
|
||||||
|
cfg = config.vim.autocomplete.nvim-cmp;
|
||||||
in {
|
in {
|
||||||
options.vim = {
|
options.vim.autocomplete.nvim-cmp = {
|
||||||
autocomplete = {
|
enable = mkEnableOption "nvim-cmp";
|
||||||
enable = mkEnableOption "autocomplete" // {default = false;};
|
setupOpts = mkPluginSetupOption "the autocomplete plugin" {
|
||||||
|
completion.completeopt = mkOption {
|
||||||
alwaysComplete = mkOption {
|
type = str;
|
||||||
type = bool;
|
default = "menu,menuone,noinsert";
|
||||||
description = "Automatically show completion.";
|
|
||||||
default = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
mappings = {
|
|
||||||
complete = mkMappingOption "Complete [nvim-cmp]" "<C-Space>";
|
|
||||||
confirm = mkMappingOption "Confirm [nvim-cmp]" "<CR>";
|
|
||||||
next = mkMappingOption "Next item [nvim-cmp]" "<Tab>";
|
|
||||||
previous = mkMappingOption "Previous item [nvim-cmp]" "<S-Tab>";
|
|
||||||
close = mkMappingOption "Close [nvim-cmp]" "<C-e>";
|
|
||||||
scrollDocsUp = mkMappingOption "Scroll docs up [nvim-cmp]" "<C-d>";
|
|
||||||
scrollDocsDown = mkMappingOption "Scroll docs down [nvim-cmp]" "<C-f>";
|
|
||||||
};
|
|
||||||
|
|
||||||
type = mkOption {
|
|
||||||
type = enum ["nvim-cmp"];
|
|
||||||
default = "nvim-cmp";
|
|
||||||
description = "Set the autocomplete plugin. Options: [nvim-cmp]";
|
|
||||||
};
|
|
||||||
|
|
||||||
sources = mkOption {
|
|
||||||
description = ''
|
description = ''
|
||||||
Attribute set of source names for nvim-cmp.
|
A comma-separated list of options for completion.
|
||||||
|
|
||||||
If an attribute set is provided, then the menu value of
|
See `:help completeopt` for the complete list.
|
||||||
`vim_item` in the format will be set to the value (if
|
|
||||||
utilizing the `nvim_cmp_menu_map` function).
|
|
||||||
|
|
||||||
Note: only use a single attribute name per attribute set
|
|
||||||
'';
|
|
||||||
type = attrsOf (nullOr str);
|
|
||||||
default = {};
|
|
||||||
example = ''
|
|
||||||
{nvim-cmp = null; buffer = "[Buffer]";}
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
formatting = {
|
sorting.comparators = mkOption {
|
||||||
format = mkOption {
|
type = mergelessListOf (either str luaInline);
|
||||||
description = ''
|
default = [
|
||||||
The function used to customize the appearance of the completion menu.
|
"offset"
|
||||||
|
"exact"
|
||||||
|
"score"
|
||||||
|
"kind"
|
||||||
|
"length"
|
||||||
|
"sort_text"
|
||||||
|
];
|
||||||
|
description = ''
|
||||||
|
The comparator functions used for sorting completions.
|
||||||
|
|
||||||
If [](#opt-vim.lsp.lspkind.enable) is true, then the function
|
You can either pass a valid inline lua function
|
||||||
will be called before modifications from lspkind.
|
(see `:help cmp-config.sorting.comparators`),
|
||||||
|
or a string, in which case the builtin comparator with that name will
|
||||||
Default is to call the menu mapping function.
|
be used.
|
||||||
'';
|
'';
|
||||||
type = str;
|
apply = map (
|
||||||
default = "nvim_cmp_menu_map";
|
c:
|
||||||
example = literalMD ''
|
if isString c
|
||||||
```lua
|
then mkLuaInline ("cmp.config.compare." + c)
|
||||||
function(entry, vim_item)
|
else c
|
||||||
return vim_item
|
);
|
||||||
end
|
|
||||||
```
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mappings = {
|
||||||
|
complete = mkMappingOption "Complete [nvim-cmp]" "<C-Space>";
|
||||||
|
confirm = mkMappingOption "Confirm [nvim-cmp]" "<CR>";
|
||||||
|
next = mkMappingOption "Next item [nvim-cmp]" "<Tab>";
|
||||||
|
previous = mkMappingOption "Previous item [nvim-cmp]" "<S-Tab>";
|
||||||
|
close = mkMappingOption "Close [nvim-cmp]" "<C-e>";
|
||||||
|
scrollDocsUp = mkMappingOption "Scroll docs up [nvim-cmp]" "<C-d>";
|
||||||
|
scrollDocsDown = mkMappingOption "Scroll docs down [nvim-cmp]" "<C-f>";
|
||||||
|
};
|
||||||
|
|
||||||
|
format = mkOption {
|
||||||
|
type = luaInline;
|
||||||
|
default = mkLuaInline ''
|
||||||
|
function(entry, vim_item)
|
||||||
|
vim_item.menu = (${toLuaObject cfg.sources})[entry.source.name]
|
||||||
|
return vim_item
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
defaultText = literalMD ''
|
||||||
|
```lua
|
||||||
|
function(entry, vim_item)
|
||||||
|
vim_item.menu = (''${toLuaObject config.vim.autocomplete.nvim-cmp.sources})[entry.source.name]
|
||||||
|
return vim_item
|
||||||
|
end
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
The function used to customize the completion menu entires. This is
|
||||||
|
outside of `setupOpts` to allow for an easier integration with
|
||||||
|
lspkind.nvim.
|
||||||
|
|
||||||
|
See `:help cmp-config.formatting.format`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
sources = mkOption {
|
||||||
|
type = attrsOf (nullOr str);
|
||||||
|
default = {};
|
||||||
|
description = "The list of sources used by nvim-cmp";
|
||||||
|
example = literalExpression ''
|
||||||
|
{
|
||||||
|
nvim-cmp = null;
|
||||||
|
buffer = "[Buffer]";
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,16 +5,17 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.dashboard.dashboard-nvim;
|
cfg = config.vim.dashboard.dashboard-nvim;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim = {
|
||||||
"dashboard-nvim"
|
startPlugins = ["dashboard-nvim"];
|
||||||
];
|
|
||||||
|
|
||||||
vim.pluginRC.dashboard-nvim = entryAnywhere ''
|
pluginRC.dashboard-nvim = entryAnywhere ''
|
||||||
require("dashboard").setup{}
|
require("dashboard").setup(${toLuaObject cfg.setupOpts})
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.dashboard.dashboard-nvim = {
|
options.vim.dashboard.dashboard-nvim = {
|
||||||
enable = mkEnableOption "Fancy and Blazing Fast start screen plugin of neovim [dashboard.nvim]";
|
enable = mkEnableOption "Fancy and Blazing Fast start screen plugin of neovim [dashboard.nvim]";
|
||||||
|
setupOpts = mkPluginSetupOption "dashboard.nvim" {};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,57 +16,61 @@
|
||||||
in {
|
in {
|
||||||
config = mkMerge [
|
config = mkMerge [
|
||||||
(mkIf cfg.enable {
|
(mkIf cfg.enable {
|
||||||
vim.startPlugins = ["nvim-dap"];
|
vim = {
|
||||||
|
startPlugins = ["nvim-dap"];
|
||||||
|
|
||||||
vim.pluginRC =
|
pluginRC =
|
||||||
{
|
{
|
||||||
# TODO customizable keymaps
|
# TODO customizable keymaps
|
||||||
nvim-dap = entryAnywhere ''
|
nvim-dap = entryAnywhere ''
|
||||||
local dap = require("dap")
|
local dap = require("dap")
|
||||||
vim.fn.sign_define("DapBreakpoint", { text = "🛑", texthl = "ErrorMsg", linehl = "", numhl = "" })
|
vim.fn.sign_define("DapBreakpoint", { text = "🛑", texthl = "ErrorMsg", linehl = "", numhl = "" })
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
// mapAttrs (_: v: (entryAfter ["nvim-dap"] v)) cfg.sources;
|
// mapAttrs (_: v: (entryAfter ["nvim-dap"] v)) cfg.sources;
|
||||||
|
|
||||||
vim.maps.normal = mkMerge [
|
maps.normal = mkMerge [
|
||||||
(mkSetLuaBinding mappings.continue "require('dap').continue")
|
(mkSetLuaBinding mappings.continue "require('dap').continue")
|
||||||
(mkSetLuaBinding mappings.restart "require('dap').restart")
|
(mkSetLuaBinding mappings.restart "require('dap').restart")
|
||||||
(mkSetLuaBinding mappings.terminate "require('dap').terminate")
|
(mkSetLuaBinding mappings.terminate "require('dap').terminate")
|
||||||
(mkSetLuaBinding mappings.runLast "require('dap').run_last")
|
(mkSetLuaBinding mappings.runLast "require('dap').run_last")
|
||||||
|
|
||||||
(mkSetLuaBinding mappings.toggleRepl "require('dap').repl.toggle")
|
(mkSetLuaBinding mappings.toggleRepl "require('dap').repl.toggle")
|
||||||
(mkSetLuaBinding mappings.hover "require('dap.ui.widgets').hover")
|
(mkSetLuaBinding mappings.hover "require('dap.ui.widgets').hover")
|
||||||
(mkSetLuaBinding mappings.toggleBreakpoint "require('dap').toggle_breakpoint")
|
(mkSetLuaBinding mappings.toggleBreakpoint "require('dap').toggle_breakpoint")
|
||||||
|
|
||||||
(mkSetLuaBinding mappings.runToCursor "require('dap').run_to_cursor")
|
(mkSetLuaBinding mappings.runToCursor "require('dap').run_to_cursor")
|
||||||
(mkSetLuaBinding mappings.stepInto "require('dap').step_into")
|
(mkSetLuaBinding mappings.stepInto "require('dap').step_into")
|
||||||
(mkSetLuaBinding mappings.stepOut "require('dap').step_out")
|
(mkSetLuaBinding mappings.stepOut "require('dap').step_out")
|
||||||
(mkSetLuaBinding mappings.stepOver "require('dap').step_over")
|
(mkSetLuaBinding mappings.stepOver "require('dap').step_over")
|
||||||
(mkSetLuaBinding mappings.stepBack "require('dap').step_back")
|
(mkSetLuaBinding mappings.stepBack "require('dap').step_back")
|
||||||
|
|
||||||
(mkSetLuaBinding mappings.goUp "require('dap').up")
|
(mkSetLuaBinding mappings.goUp "require('dap').up")
|
||||||
(mkSetLuaBinding mappings.goDown "require('dap').down")
|
(mkSetLuaBinding mappings.goDown "require('dap').down")
|
||||||
];
|
];
|
||||||
|
};
|
||||||
})
|
})
|
||||||
(mkIf (cfg.enable && cfg.ui.enable) {
|
(mkIf (cfg.enable && cfg.ui.enable) {
|
||||||
vim.startPlugins = ["nvim-dap-ui" "nvim-nio"];
|
vim = {
|
||||||
|
startPlugins = ["nvim-dap-ui" "nvim-nio"];
|
||||||
|
|
||||||
vim.pluginRC.nvim-dap-ui = entryAfter ["nvim-dap"] (''
|
pluginRC.nvim-dap-ui = entryAfter ["nvim-dap"] (''
|
||||||
local dapui = require("dapui")
|
local dapui = require("dapui")
|
||||||
dapui.setup()
|
dapui.setup()
|
||||||
''
|
''
|
||||||
+ optionalString cfg.ui.autoStart ''
|
+ optionalString cfg.ui.autoStart ''
|
||||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||||
dapui.open()
|
dapui.open()
|
||||||
end
|
end
|
||||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||||
dapui.close()
|
dapui.close()
|
||||||
end
|
end
|
||||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||||
dapui.close()
|
dapui.close()
|
||||||
end
|
end
|
||||||
'');
|
'');
|
||||||
vim.maps.normal = mkSetLuaBinding mappings.toggleDapUI "require('dapui').toggle";
|
maps.normal = mkSetLuaBinding mappings.toggleDapUI "require('dapui').toggle";
|
||||||
|
};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ in {
|
||||||
"neo-tree-nvim"
|
"neo-tree-nvim"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
visuals.nvimWebDevicons.enable = true;
|
||||||
|
|
||||||
pluginRC.neo-tree = entryAnywhere ''
|
pluginRC.neo-tree = entryAnywhere ''
|
||||||
require("neo-tree").setup(${toLuaObject cfg.setupOpts})
|
require("neo-tree").setup(${toLuaObject cfg.setupOpts})
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -8,6 +8,7 @@ in {
|
||||||
./css.nix
|
./css.nix
|
||||||
./elixir.nix
|
./elixir.nix
|
||||||
./go.nix
|
./go.nix
|
||||||
|
./kotlin.nix
|
||||||
./html.nix
|
./html.nix
|
||||||
./java.nix
|
./java.nix
|
||||||
./lua.nix
|
./lua.nix
|
||||||
|
@ -19,6 +20,7 @@ in {
|
||||||
./python.nix
|
./python.nix
|
||||||
./r.nix
|
./r.nix
|
||||||
./rust.nix
|
./rust.nix
|
||||||
|
./scala.nix
|
||||||
./sql.nix
|
./sql.nix
|
||||||
./svelte.nix
|
./svelte.nix
|
||||||
./tailwind.nix
|
./tailwind.nix
|
||||||
|
|
|
@ -114,12 +114,12 @@ in {
|
||||||
(mkIf cfg.elixir-tools.enable {
|
(mkIf cfg.elixir-tools.enable {
|
||||||
vim.startPlugins = ["elixir-tools"];
|
vim.startPlugins = ["elixir-tools"];
|
||||||
vim.pluginRC.elixir-tools = entryAnywhere ''
|
vim.pluginRC.elixir-tools = entryAnywhere ''
|
||||||
local elixir-tools = require("elixir")
|
local elixir = require("elixir")
|
||||||
local elixirls = require("elixir-tools.elixirls")
|
local elixirls = require("elixir.elixirls")
|
||||||
|
|
||||||
-- disable imperative insstallations of various
|
-- disable imperative insstallations of various
|
||||||
-- elixir related tools installed by elixir-tools
|
-- elixir related tools installed by elixir-tools
|
||||||
elixir-tools.setup {
|
elixir.setup {
|
||||||
nextls = {
|
nextls = {
|
||||||
enable = false -- defaults to false
|
enable = false -- defaults to false
|
||||||
},
|
},
|
||||||
|
|
107
modules/plugins/languages/kotlin.nix
Normal file
107
modules/plugins/languages/kotlin.nix
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
|
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||||
|
inherit (lib.types) package;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
|
inherit (lib.lists) isList;
|
||||||
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.kotlin;
|
||||||
|
|
||||||
|
defaultDiagnosticsProvider = ["ktlint"];
|
||||||
|
diagnosticsProviders = {
|
||||||
|
ktlint = {
|
||||||
|
package = pkgs.ktlint;
|
||||||
|
nullConfig = pkg: ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.diagnostics.ktlint.with({
|
||||||
|
command = "${getExe pkg}",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.languages.kotlin = {
|
||||||
|
enable = mkEnableOption "Kotlin/HCL support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "Kotlin treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "kotlin";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "Kotlin LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
description = "kotlin_language_server package with Kotlin runtime";
|
||||||
|
type = package;
|
||||||
|
example = literalExpression ''
|
||||||
|
pkgs.symlinkJoin {
|
||||||
|
name = "kotlin-language-server-wrapped";
|
||||||
|
paths = [pkgs.kotlin-language-server];
|
||||||
|
nativeBuildInputs = [pkgs.makeWrapper];
|
||||||
|
postBuild = '''
|
||||||
|
wrapProgram $out/bin/kotlin-language-server \
|
||||||
|
--prefix PATH : ''${pkgs.kotlin}/bin
|
||||||
|
''';
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
default = pkgs.kotlin-language-server;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
extraDiagnostics = {
|
||||||
|
enable = mkEnableOption "extra Kotlin diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||||
|
|
||||||
|
types = diagnostics {
|
||||||
|
langDesc = "Kotlin";
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
inherit defaultDiagnosticsProvider;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
|
vim.lsp.null-ls.enable = true;
|
||||||
|
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||||
|
lang = "kotlin";
|
||||||
|
config = cfg.extraDiagnostics.types;
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.kotlin_language_server = ''
|
||||||
|
lspconfig.kotlin_language_server.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
root_dir = lspconfig.util.root_pattern("main.kt", ".git"),
|
||||||
|
on_attach=default_on_attach,
|
||||||
|
init_options = {
|
||||||
|
-- speeds up the startup time for the LSP
|
||||||
|
storagePath = vim.fn.stdpath('state') .. '/kotlin',
|
||||||
|
},
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else ''{"${cfg.lsp.package}/bin/kotlin-language-server"}''
|
||||||
|
},
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
|
@ -9,7 +9,7 @@
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.trivial) boolToString;
|
inherit (lib.trivial) boolToString;
|
||||||
inherit (lib.lists) isList optionals;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) bool package str listOf either enum;
|
inherit (lib.types) bool package str listOf either enum;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
@ -101,7 +101,7 @@ in {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["crates-nvim"];
|
startPlugins = ["crates-nvim"];
|
||||||
lsp.null-ls.enable = mkIf cfg.crates.codeActions true;
|
lsp.null-ls.enable = mkIf cfg.crates.codeActions true;
|
||||||
autocomplete.sources = {"crates" = "[Crates]";};
|
autocomplete.nvim-cmp.sources = {crates = "[Crates]";};
|
||||||
pluginRC.rust-crates = entryAnywhere ''
|
pluginRC.rust-crates = entryAnywhere ''
|
||||||
require('crates').setup {
|
require('crates').setup {
|
||||||
null_ls = {
|
null_ls = {
|
||||||
|
|
149
modules/plugins/languages/scala.nix
Normal file
149
modules/plugins/languages/scala.nix
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption luaInline;
|
||||||
|
inherit (lib.options) mkOption mkEnableOption mkPackageOption;
|
||||||
|
inherit (lib.strings) optionalString;
|
||||||
|
inherit (lib.types) attrsOf anything bool;
|
||||||
|
|
||||||
|
listCommandsAction =
|
||||||
|
if config.vim.telescope.enable
|
||||||
|
then ''require("telescope").extensions.metals.commands()''
|
||||||
|
else ''require("metals").commands()'';
|
||||||
|
|
||||||
|
cfg = config.vim.languages.scala;
|
||||||
|
|
||||||
|
usingDap = config.vim.debugger.nvim-dap.enable && cfg.dap.enable;
|
||||||
|
usingLualine = config.vim.statusline.lualine.enable;
|
||||||
|
in {
|
||||||
|
options.vim.languages.scala = {
|
||||||
|
enable = mkEnableOption "Scala language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "Scala treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "scala";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "Scala LSP support (metals)" // {default = config.vim.languages.enableLSP;};
|
||||||
|
package = mkPackageOption pkgs "metals" {
|
||||||
|
default = ["metals"];
|
||||||
|
};
|
||||||
|
|
||||||
|
extraMappings = {
|
||||||
|
listCommands = mkMappingOption "List Metals commands" "<leader>lc";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraSettings = mkOption {
|
||||||
|
type = attrsOf anything;
|
||||||
|
description = "Extra settings passed to the metals config. Check nvim-metals docs for available options";
|
||||||
|
default = {
|
||||||
|
showImplicitArguments = true;
|
||||||
|
showImplicitConversionsAndClasses = true;
|
||||||
|
showInferredType = true;
|
||||||
|
excludedPackages = [
|
||||||
|
"akka.actor.typed.javadsl"
|
||||||
|
"com.github.swagger.akka.javadsl"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
dap = {
|
||||||
|
enable = mkEnableOption "Scala Debug Adapter support (metals)" // {default = config.vim.languages.enableDAP;};
|
||||||
|
config = mkOption {
|
||||||
|
description = "Lua configuration for dap";
|
||||||
|
type = luaInline;
|
||||||
|
default = mkLuaInline ''
|
||||||
|
dap.configurations.scala = {
|
||||||
|
{
|
||||||
|
type = "scala",
|
||||||
|
request = "launch",
|
||||||
|
name = "RunOrTest",
|
||||||
|
metals = {
|
||||||
|
runType = "runOrTestFile",
|
||||||
|
--args = { "firstArg", "secondArg", "thirdArg" }, -- here just as an example
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "scala",
|
||||||
|
request = "launch",
|
||||||
|
name = "Test Target",
|
||||||
|
metals = {
|
||||||
|
runType = "testTarget",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
fixShortmess = mkOption {
|
||||||
|
type = bool;
|
||||||
|
description = "Remove the 'F' flag from shortmess to allow messages to be shown. Without doing this, autocommands that deal with filetypes prohibit messages from being shown";
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (
|
||||||
|
mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
|
||||||
|
vim = {
|
||||||
|
startPlugins = ["nvim-metals"];
|
||||||
|
pluginRC.nvim-metals = entryAfter ["lsp-setup"] ''
|
||||||
|
local metals_caps = capabilities -- from lsp-setup
|
||||||
|
|
||||||
|
local attach_metals_keymaps = function(client, bufnr)
|
||||||
|
attach_keymaps(client, bufnr) -- from lsp-setup
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '${cfg.lsp.extraMappings.listCommands}', '<cmd>lua ${listCommandsAction}<CR>', {noremap=true, silent=true, desc='Show all Metals commands'})
|
||||||
|
end
|
||||||
|
|
||||||
|
metals_config = require('metals').bare_config()
|
||||||
|
${optionalString usingLualine "metals_config.init_options.statusBarProvider = 'on'"}
|
||||||
|
|
||||||
|
metals_config.capabilities = metals_caps
|
||||||
|
metals_config.on_attach = function(client, bufnr)
|
||||||
|
${optionalString usingDap "require('metals').setup_dap()"}
|
||||||
|
attach_metals_keymaps(client, bufnr)
|
||||||
|
end
|
||||||
|
|
||||||
|
metals_config.settings = ${toLuaObject cfg.lsp.extraSettings}
|
||||||
|
metals_config.settings.metalsBinaryPath = "${cfg.lsp.package}/bin/metals"
|
||||||
|
|
||||||
|
metals_config.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||||
|
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
virtual_text = {
|
||||||
|
prefix = '⚠',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
${optionalString cfg.fixShortmess ''vim.opt_global.shortmess:remove("F")''}
|
||||||
|
|
||||||
|
local lsp_group = vim.api.nvim_create_augroup('lsp', { clear = true })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
group = lsp_group,
|
||||||
|
pattern = {'java', 'scala', 'sbt'},
|
||||||
|
callback = function()
|
||||||
|
require('metals').initialize_or_attach(metals_config)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
|
@ -226,7 +226,7 @@ in {
|
||||||
{
|
{
|
||||||
assertion = cfg.lsp.enable -> cfg.lsp.server != "tsserver";
|
assertion = cfg.lsp.enable -> cfg.lsp.server != "tsserver";
|
||||||
message = ''
|
message = ''
|
||||||
As of a recent lspconfig update, he `tsserver` configuration has been renamed
|
As of a recent lspconfig update, the `tsserver` configuration has been renamed
|
||||||
to `ts_ls` to match upstream behaviour of `lspconfig`, and the name `tsserver`
|
to `ts_ls` to match upstream behaviour of `lspconfig`, and the name `tsserver`
|
||||||
is no longer considered valid by nvf. Please set `vim.languages.ts.lsp.server`
|
is no longer considered valid by nvf. Please set `vim.languages.ts.lsp.server`
|
||||||
to `"ts_ls"` instead of to `${cfg.lsp.server}`
|
to `"ts_ls"` instead of to `${cfg.lsp.server}`
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings;
|
inherit (lib.nvim.binds) addDescriptionsToMappings;
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp;
|
||||||
usingNvimCmp = config.vim.autocomplete.enable && config.vim.autocomplete.type == "nvim-cmp";
|
usingNvimCmp = config.vim.autocomplete.nvim-cmp.enable;
|
||||||
self = import ./module.nix {inherit config lib pkgs;};
|
self = import ./module.nix {inherit config lib pkgs;};
|
||||||
|
|
||||||
mappingDefinitions = self.options.vim.lsp.mappings;
|
mappingDefinitions = self.options.vim.lsp.mappings;
|
||||||
|
@ -25,7 +25,7 @@ in {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = optional usingNvimCmp "cmp-nvim-lsp";
|
startPlugins = optional usingNvimCmp "cmp-nvim-lsp";
|
||||||
|
|
||||||
autocomplete.sources = {"nvim_lsp" = "[LSP]";};
|
autocomplete.nvim-cmp.sources = {nvim_lsp = "[LSP]";};
|
||||||
|
|
||||||
pluginRC.lsp-setup = ''
|
pluginRC.lsp-setup = ''
|
||||||
vim.g.formatsave = ${boolToString cfg.formatOnSave};
|
vim.g.formatsave = ${boolToString cfg.formatOnSave};
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
./trouble
|
./trouble
|
||||||
./lsp-signature
|
./lsp-signature
|
||||||
./lightbulb
|
./lightbulb
|
||||||
|
./otter
|
||||||
./lspkind
|
./lspkind
|
||||||
./lsplines
|
./lsplines
|
||||||
./nvim-docs-view
|
./nvim-docs-view
|
||||||
|
|
|
@ -3,18 +3,32 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf mkForce;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp.lspkind;
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable && cfg.lspkind.enable) {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = ["lspkind"];
|
assertions = [
|
||||||
vim.pluginRC.lspkind = entryAnywhere ''
|
{
|
||||||
local lspkind = require'lspkind'
|
assertion = config.vim.autocomplete.nvim-cmp.enable;
|
||||||
local lspkind_opts = {
|
message = ''
|
||||||
mode = '${cfg.lspkind.mode}'
|
While lspkind supports Neovim's native lsp upstream, using that over
|
||||||
|
nvim-cmp isn't recommended, nor supported by nvf.
|
||||||
|
|
||||||
|
Please migrate to nvim-cmp if you want to use lspkind.
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
'';
|
];
|
||||||
|
|
||||||
|
vim = {
|
||||||
|
startPlugins = ["lspkind"];
|
||||||
|
|
||||||
|
lsp.lspkind.setupOpts.before = config.vim.autocomplete.nvim-cmp.format;
|
||||||
|
autocomplete.nvim-cmp.setupOpts.formatting.format = mkForce (mkLuaInline ''
|
||||||
|
require("lspkind").cmp_format(${toLuaObject cfg.setupOpts})
|
||||||
|
'');
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,22 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.types) enum;
|
inherit (lib.types) enum nullOr;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||||
in {
|
in {
|
||||||
options.vim.lsp = {
|
options.vim.lsp.lspkind = {
|
||||||
lspkind = {
|
enable = mkEnableOption "vscode-like pictograms for lsp [lspkind]";
|
||||||
enable = mkEnableOption "vscode-like pictograms for lsp [lspkind]";
|
setupOpts = mkPluginSetupOption "lspkind.nvim" {
|
||||||
|
|
||||||
mode = mkOption {
|
mode = mkOption {
|
||||||
description = "Defines how annotations are shown";
|
description = "Defines how annotations are shown";
|
||||||
type = enum ["text" "text_symbol" "symbol_text" "symbol"];
|
type = enum ["text" "text_symbol" "symbol_text" "symbol"];
|
||||||
default = "symbol_text";
|
default = "symbol_text";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
before = mkOption {
|
||||||
|
description = "The function that will be called before lspkind's modifications are applied";
|
||||||
|
type = nullOr luaInline;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
39
modules/plugins/lsp/otter/config.nix
Normal file
39
modules/plugins/lsp/otter/config.nix
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
||||||
|
|
||||||
|
cfg = config.vim.lsp;
|
||||||
|
|
||||||
|
self = import ./otter.nix {inherit lib;};
|
||||||
|
mappingDefinitions = self.options.vim.lsp.otter-nvim.mappings;
|
||||||
|
mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions;
|
||||||
|
in {
|
||||||
|
config = mkIf (cfg.enable && cfg.otter-nvim.enable) {
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = !config.vim.utility.ccc.enable;
|
||||||
|
message = ''
|
||||||
|
ccc and otter have a breaking conflict. It's been reported upstream. Until it's fixed, disable one of them
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
vim = {
|
||||||
|
startPlugins = ["otter-nvim"];
|
||||||
|
|
||||||
|
maps.normal = mkMerge [
|
||||||
|
(mkSetBinding mappings.toggle "<cmd>lua require'otter'.activate()<CR>")
|
||||||
|
];
|
||||||
|
|
||||||
|
pluginRC.otter-nvim = entryAnywhere ''
|
||||||
|
-- Enable otter diagnostics viewer
|
||||||
|
require("otter").setup({${toLuaObject cfg.otter-nvim.setupOpts}})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
6
modules/plugins/lsp/otter/default.nix
Normal file
6
modules/plugins/lsp/otter/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./otter.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
64
modules/plugins/lsp/otter/otter.nix
Normal file
64
modules/plugins/lsp/otter/otter.nix
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
inherit (lib.types) bool str listOf;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
in {
|
||||||
|
options.vim.lsp = {
|
||||||
|
otter-nvim = {
|
||||||
|
enable = mkEnableOption ''
|
||||||
|
lsp features and a code completion source for code embedded in other documents [otter-nvim]
|
||||||
|
'';
|
||||||
|
mappings = {
|
||||||
|
toggle = mkMappingOption "Activate LSP on Cursor Position [otter-nvim]" "<leader>lo";
|
||||||
|
};
|
||||||
|
setupOpts = mkPluginSetupOption "otter.nvim" {
|
||||||
|
lsp = {
|
||||||
|
diagnostic_update_event = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = ["BufWritePost"];
|
||||||
|
description = ''
|
||||||
|
`:h events` that cause the diagnostic to update.
|
||||||
|
Set to: {"BufWritePost", "InsertLeave", "TextChanged" }
|
||||||
|
for less performant but more instant diagnostic updates
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
buffers = {
|
||||||
|
set_filetype = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
if set to true, the filetype of the otterbuffers will be set. Other wide only
|
||||||
|
the autocommand of lspconfig that attaches the language server will be
|
||||||
|
executed without stting the filetype
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
write_to_disk = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
write <path>.otter.<embedded language extension> files to disk on save of main buffer.
|
||||||
|
Useful for some linters that require actual files.
|
||||||
|
Otter files are deleted on quit or main buffer close
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
strip_wrapping_quote_characters = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = ["'" ''"'' "`"];
|
||||||
|
description = ''
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
handle_leading_whitespace = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
otter may not work the way you expect when entire code blocks are indented
|
||||||
|
(eg. in Org files) When true, otter handles these cases fully.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
./obsidian
|
./obsidian
|
||||||
./orgmode
|
./orgmode
|
||||||
|
./neorg
|
||||||
./mind-nvim
|
./mind-nvim
|
||||||
./todo-comments
|
./todo-comments
|
||||||
];
|
];
|
||||||
|
|
41
modules/plugins/notes/neorg/config.nix
Normal file
41
modules/plugins/notes/neorg/config.nix
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.binds) pushDownDefault;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
|
cfg = config.vim.notes.neorg;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
{
|
||||||
|
vim = {
|
||||||
|
startPlugins = [
|
||||||
|
"lua-utils-nvim"
|
||||||
|
"nui-nvim"
|
||||||
|
"nvim-nio"
|
||||||
|
"pathlib-nvim"
|
||||||
|
"plenary-nvim"
|
||||||
|
"neorg"
|
||||||
|
"neorg-telescope"
|
||||||
|
];
|
||||||
|
|
||||||
|
binds.whichKey.register = pushDownDefault {
|
||||||
|
"<leader>o" = "+Notes";
|
||||||
|
};
|
||||||
|
|
||||||
|
pluginRC.neorg = entryAnywhere ''
|
||||||
|
require('neorg').setup(${toLuaObject cfg.setupOpts})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.norgPackage];
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
6
modules/plugins/notes/neorg/default.nix
Normal file
6
modules/plugins/notes/neorg/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./neorg.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
50
modules/plugins/notes/neorg/neorg.nix
Normal file
50
modules/plugins/notes/neorg/neorg.nix
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) submodule listOf str;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
||||||
|
in {
|
||||||
|
options.vim.notes.neorg = {
|
||||||
|
enable = mkEnableOption ''
|
||||||
|
Neorg: An intuitive note-taking and organization tool with a structured nested syntax.
|
||||||
|
'';
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "Neorg" {
|
||||||
|
load = {
|
||||||
|
"core.defaults" = mkOption {
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
all of the most important modules that any user would want to have a "just works" experience
|
||||||
|
'';
|
||||||
|
|
||||||
|
type = submodule {
|
||||||
|
options = {
|
||||||
|
enable = mkEnableOption ''
|
||||||
|
all of the most important modules that any user would want to have a "just works" experience
|
||||||
|
'';
|
||||||
|
config = {
|
||||||
|
disable = mkOption {
|
||||||
|
description = ''
|
||||||
|
list of modules from to be disabled from core.defaults
|
||||||
|
'';
|
||||||
|
type = listOf str;
|
||||||
|
default = [];
|
||||||
|
example = ["core.autocommands" "core.itero"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "Neorg treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
norgPackage = mkGrammarOption pkgs "norg";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -45,10 +45,10 @@ in {
|
||||||
|
|
||||||
completion = {
|
completion = {
|
||||||
nvim_cmp = mkOption {
|
nvim_cmp = mkOption {
|
||||||
# if using nvim-cmp, otherwise set to false
|
# If using nvim-cmp, otherwise set to false
|
||||||
type = bool;
|
type = bool;
|
||||||
description = "If using nvim-cmp, otherwise set to false";
|
description = "If using nvim-cmp, otherwise set to false";
|
||||||
default = config.vim.autocomplete.type == "nvim-cmp";
|
default = config.vim.autocomplete.nvim-cmp.enable;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./vsnip
|
./luasnip
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
17
modules/plugins/snippets/luasnip/config.nix
Normal file
17
modules/plugins/snippets/luasnip/config.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
|
||||||
|
cfg = config.vim.snippets.luasnip;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
startPlugins = ["luasnip" "cmp-luasnip"] ++ cfg.providers;
|
||||||
|
autocomplete.nvim-cmp.sources = {luasnip = "[LuaSnip]";};
|
||||||
|
pluginRC.luasnip = cfg.loaders;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
6
modules/plugins/snippets/luasnip/default.nix
Normal file
6
modules/plugins/snippets/luasnip/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./luasnip.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
36
modules/plugins/snippets/luasnip/luasnip.nix
Normal file
36
modules/plugins/snippets/luasnip/luasnip.nix
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption literalExpression literalMD;
|
||||||
|
inherit (lib.types) listOf lines;
|
||||||
|
inherit (lib.nvim.types) pluginType;
|
||||||
|
in {
|
||||||
|
options.vim.snippets.luasnip = {
|
||||||
|
enable = mkEnableOption "luasnip";
|
||||||
|
providers = mkOption {
|
||||||
|
type = listOf pluginType;
|
||||||
|
default = ["friendly-snippets"];
|
||||||
|
description = ''
|
||||||
|
The snippet provider packages.
|
||||||
|
|
||||||
|
::: {.note}
|
||||||
|
These are simply appended to {option} `vim.startPlugins`.
|
||||||
|
:::
|
||||||
|
'';
|
||||||
|
example = literalExpression "[\"vimPlugins.vim-snippets\"]";
|
||||||
|
};
|
||||||
|
loaders = mkOption {
|
||||||
|
type = lines;
|
||||||
|
default = "require('luasnip.loaders.from_vscode').lazy_load()";
|
||||||
|
defaultText = literalMD ''
|
||||||
|
```lua
|
||||||
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
description = "Lua code used to load snippet providers.";
|
||||||
|
example = literalMD ''
|
||||||
|
```lua
|
||||||
|
require("luasnip.loaders.from_snipmate").lazy_load()
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.modules) mkIf;
|
|
||||||
|
|
||||||
cfg = config.vim.snippets.vsnip;
|
|
||||||
in {
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
vim.startPlugins = ["vim-vsnip"];
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./vsnip.nix
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
{lib, ...}: let
|
|
||||||
inherit (lib.options) mkEnableOption;
|
|
||||||
in {
|
|
||||||
options.vim.snippets.vsnip = {
|
|
||||||
enable = mkEnableOption "vim-vsnip: snippet LSP/VSCode's format";
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -17,29 +17,36 @@
|
||||||
"ayu_dark"
|
"ayu_dark"
|
||||||
"ayu_light"
|
"ayu_light"
|
||||||
"ayu_mirage"
|
"ayu_mirage"
|
||||||
|
"ayu"
|
||||||
"codedark"
|
"codedark"
|
||||||
"dracula"
|
"dracula"
|
||||||
"everforest"
|
"everforest"
|
||||||
"gruvbox"
|
"gruvbox"
|
||||||
|
"gruvbox_dark"
|
||||||
"gruvbox_light"
|
"gruvbox_light"
|
||||||
"gruvbox_material"
|
"gruvbox_material"
|
||||||
"horizon"
|
"horizon"
|
||||||
"iceberg_dark"
|
"iceberg_dark"
|
||||||
"iceberg_light"
|
"iceberg_light"
|
||||||
|
"iceberg"
|
||||||
"jellybeans"
|
"jellybeans"
|
||||||
"material"
|
"material"
|
||||||
"modus_vivendi"
|
"modus_vivendi"
|
||||||
"molokai"
|
"molokai"
|
||||||
|
"moonfly"
|
||||||
"nightfly"
|
"nightfly"
|
||||||
"nord"
|
"nord"
|
||||||
"oceanicnext"
|
"oceanicnext"
|
||||||
|
"onedark"
|
||||||
"onelight"
|
"onelight"
|
||||||
"palenight"
|
"palenight"
|
||||||
"papercolor_dark"
|
"papercolor_dark"
|
||||||
"papercolor_light"
|
"papercolor_light"
|
||||||
|
"powerline_dark"
|
||||||
"powerline"
|
"powerline"
|
||||||
"seoul256"
|
"seoul256"
|
||||||
"solarized_dark"
|
"solarized_dark"
|
||||||
|
"solarized_light"
|
||||||
"tomorrow"
|
"tomorrow"
|
||||||
"wombat"
|
"wombat"
|
||||||
];
|
];
|
||||||
|
@ -224,7 +231,7 @@ in {
|
||||||
local buf_ft = vim.api.nvim_get_option_value('filetype', {})
|
local buf_ft = vim.api.nvim_get_option_value('filetype', {})
|
||||||
|
|
||||||
-- List of buffer types to exclude
|
-- List of buffer types to exclude
|
||||||
local excluded_buf_ft = {"toggleterm", "NvimTree", "TelescopePrompt"}
|
local excluded_buf_ft = {"toggleterm", "NvimTree", "neo-tree", "TelescopePrompt"}
|
||||||
|
|
||||||
-- Check if the current buffer type is in the excluded list
|
-- Check if the current buffer type is in the excluded list
|
||||||
for _, excluded_type in ipairs(excluded_buf_ft) do
|
for _, excluded_type in ipairs(excluded_buf_ft) do
|
||||||
|
|
|
@ -4,7 +4,14 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.trivial) boolToString warnIf;
|
inherit (lib.trivial) boolToString warnIf;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
in {
|
in {
|
||||||
|
base16 = {
|
||||||
|
setup = {base16-colors, ...}: ''
|
||||||
|
-- Base16 theme
|
||||||
|
require('base16-colorscheme').setup(${toLuaObject base16-colors})
|
||||||
|
'';
|
||||||
|
};
|
||||||
onedark = {
|
onedark = {
|
||||||
setup = {style ? "dark", ...}: ''
|
setup = {style ? "dark", ...}: ''
|
||||||
-- OneDark theme
|
-- OneDark theme
|
||||||
|
@ -20,6 +27,7 @@ in {
|
||||||
setup = {
|
setup = {
|
||||||
style ? "night",
|
style ? "night",
|
||||||
transparent,
|
transparent,
|
||||||
|
...
|
||||||
}: ''
|
}: ''
|
||||||
require('tokyonight').setup {
|
require('tokyonight').setup {
|
||||||
transparent = ${boolToString transparent};
|
transparent = ${boolToString transparent};
|
||||||
|
@ -42,6 +50,7 @@ in {
|
||||||
setup = {
|
setup = {
|
||||||
style ? "mocha",
|
style ? "mocha",
|
||||||
transparent ? false,
|
transparent ? false,
|
||||||
|
...
|
||||||
}: ''
|
}: ''
|
||||||
-- Catppuccin theme
|
-- Catppuccin theme
|
||||||
require('catppuccin').setup {
|
require('catppuccin').setup {
|
||||||
|
@ -69,7 +78,7 @@ in {
|
||||||
notify = true, -- nvim-notify
|
notify = true, -- nvim-notify
|
||||||
which_key = true,
|
which_key = true,
|
||||||
navic = {
|
navic = {
|
||||||
enabled = false,
|
enabled = true,
|
||||||
custom_bg = "NONE", -- "lualine" will set background to mantle
|
custom_bg = "NONE", -- "lualine" will set background to mantle
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,31 +5,52 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.attrsets) attrNames;
|
inherit (lib.attrsets) attrNames;
|
||||||
|
inherit (lib.strings) hasPrefix;
|
||||||
inherit (lib.types) bool lines enum;
|
inherit (lib.types) bool lines enum;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
inherit (lib.nvim.dag) entryBefore;
|
inherit (lib.nvim.dag) entryBefore;
|
||||||
|
inherit (lib.nvim.types) hexColor;
|
||||||
|
|
||||||
cfg = config.vim.theme;
|
cfg = config.vim.theme;
|
||||||
supportedThemes = import ./supported-themes.nix {
|
supportedThemes = import ./supported-themes.nix {
|
||||||
inherit lib config;
|
inherit lib config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"];
|
||||||
|
base16Options =
|
||||||
|
mapListToAttrs (n: {
|
||||||
|
name = "base0${n}";
|
||||||
|
value = mkOption {
|
||||||
|
description = "The base0${n} color to use";
|
||||||
|
type = hexColor;
|
||||||
|
apply = v:
|
||||||
|
if hasPrefix "#" v
|
||||||
|
then v
|
||||||
|
else "#${v}";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
numbers;
|
||||||
in {
|
in {
|
||||||
options.vim.theme = {
|
options.vim.theme = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
description = "Enable theming";
|
description = "Enable theming";
|
||||||
};
|
};
|
||||||
|
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
type = enum (attrNames supportedThemes);
|
type = enum (attrNames supportedThemes);
|
||||||
description = "Supported themes can be found in `supportedThemes.nix`";
|
description = ''
|
||||||
|
Supported themes can be found in {file}`supportedThemes.nix`.
|
||||||
|
Setting the theme to "base16" enables base16 theming and
|
||||||
|
requires all of the colors in {option}`vim.theme.base16-colors` to be set.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
base16-colors = base16Options;
|
||||||
|
|
||||||
style = mkOption {
|
style = mkOption {
|
||||||
type = enum supportedThemes.${cfg.name}.styles;
|
type = enum supportedThemes.${cfg.name}.styles;
|
||||||
description = "Specific style for theme if it supports it";
|
description = "Specific style for theme if it supports it";
|
||||||
};
|
};
|
||||||
|
|
||||||
transparent = mkOption {
|
transparent = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -47,7 +68,7 @@ in {
|
||||||
startPlugins = [cfg.name];
|
startPlugins = [cfg.name];
|
||||||
luaConfigRC.theme = entryBefore ["pluginConfigs"] ''
|
luaConfigRC.theme = entryBefore ["pluginConfigs"] ''
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
${supportedThemes.${cfg.name}.setup {inherit (cfg) style transparent;}}
|
${supportedThemes.${cfg.name}.setup {inherit (cfg) style transparent base16-colors;}}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
inherit (lib.nvim.dag) entryBefore entryAfter;
|
inherit (lib.nvim.dag) entryBefore entryAfter;
|
||||||
|
|
||||||
cfg = config.vim.treesitter;
|
cfg = config.vim.treesitter;
|
||||||
usingNvimCmp = config.vim.autocomplete.enable && config.vim.autocomplete.type == "nvim-cmp";
|
usingNvimCmp = config.vim.autocomplete.nvim-cmp.enable;
|
||||||
|
|
||||||
self = import ./treesitter.nix {inherit pkgs lib;};
|
self = import ./treesitter.nix {inherit pkgs lib;};
|
||||||
mappingDefinitions = self.options.vim.treesitter.mappings;
|
mappingDefinitions = self.options.vim.treesitter.mappings;
|
||||||
|
@ -21,7 +21,7 @@ in {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["nvim-treesitter"] ++ optional usingNvimCmp "cmp-treesitter";
|
startPlugins = ["nvim-treesitter"] ++ optional usingNvimCmp "cmp-treesitter";
|
||||||
|
|
||||||
autocomplete.sources = {"treesitter" = "[Treesitter]";};
|
autocomplete.nvim-cmp.sources = {treesitter = "[Treesitter]";};
|
||||||
treesitter.grammars = optionals cfg.addDefaultGrammars cfg.defaultGrammars;
|
treesitter.grammars = optionals cfg.addDefaultGrammars cfg.defaultGrammars;
|
||||||
|
|
||||||
maps = {
|
maps = {
|
||||||
|
|
|
@ -21,7 +21,7 @@ in {
|
||||||
mkBool true "override the lsp markdown formatter with Noice";
|
mkBool true "override the lsp markdown formatter with Noice";
|
||||||
|
|
||||||
"cmp.entry.get_documentation" =
|
"cmp.entry.get_documentation" =
|
||||||
mkBool (config.vim.autocomplete.type == "nvim-cmp") "override cmp documentation with Noice";
|
mkBool config.vim.autocomplete.nvim-cmp.enable "override cmp documentation with Noice";
|
||||||
};
|
};
|
||||||
|
|
||||||
signature = {
|
signature = {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge mkDefault;
|
||||||
inherit (lib.nvim.binds) mkBinding;
|
inherit (lib.nvim.binds) mkBinding;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
||||||
|
@ -37,6 +37,8 @@ in {
|
||||||
(mkBinding cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" "Leap from window")
|
(mkBinding cfg.mappings.leapFromWindow "<Plug>(leap-from-window)" "Leap from window")
|
||||||
];
|
];
|
||||||
|
|
||||||
|
vim.binds.whichKey.register."<leader>s" = mkDefault "+Leap";
|
||||||
|
|
||||||
vim.pluginRC.leap-nvim = entryAnywhere ''
|
vim.pluginRC.leap-nvim = entryAnywhere ''
|
||||||
require('leap').opts = {
|
require('leap').opts = {
|
||||||
max_phase_one_targets = nil,
|
max_phase_one_targets = nil,
|
||||||
|
|
|
@ -9,22 +9,22 @@ in {
|
||||||
leapForwardTo = mkOption {
|
leapForwardTo = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
description = "Leap forward to";
|
description = "Leap forward to";
|
||||||
default = "s";
|
default = "<leader>ss";
|
||||||
};
|
};
|
||||||
leapBackwardTo = mkOption {
|
leapBackwardTo = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
description = "Leap backward to";
|
description = "Leap backward to";
|
||||||
default = "S";
|
default = "<leader>sS";
|
||||||
};
|
};
|
||||||
leapForwardTill = mkOption {
|
leapForwardTill = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
description = "Leap forward till";
|
description = "Leap forward till";
|
||||||
default = "x";
|
default = "<leader>sx";
|
||||||
};
|
};
|
||||||
leapBackwardTill = mkOption {
|
leapBackwardTill = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
description = "Leap backward till";
|
description = "Leap backward till";
|
||||||
default = "X";
|
default = "<leader>sX";
|
||||||
};
|
};
|
||||||
leapFromWindow = mkOption {
|
leapFromWindow = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
|
|
|
@ -3,42 +3,29 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.utility.surround;
|
cfg = config.vim.utility.surround;
|
||||||
self = import ./surround.nix {inherit lib config;};
|
|
||||||
mappingDefinitions = self.options.vim.utility.surround.mappings;
|
|
||||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = [
|
startPlugins = ["nvim-surround"];
|
||||||
"nvim-surround"
|
pluginRC.surround = entryAnywhere "require('nvim-surround').setup(${toLuaObject cfg.setupOpts})";
|
||||||
];
|
|
||||||
|
|
||||||
pluginRC.surround = entryAnywhere ''
|
utility.surround.setupOpts.keymaps = mkIf cfg.useVendoredKeybindings {
|
||||||
require('nvim-surround').setup()
|
insert = "<C-g>z";
|
||||||
'';
|
insert_line = "<C-g>Z";
|
||||||
|
normal = "gz";
|
||||||
maps = {
|
normal_cur = "gZ";
|
||||||
insert = mkMerge [
|
normal_line = "gzz";
|
||||||
(mkIf (mappings.insert != null) (mkSetBinding mappings.insert "<Plug>(nvim-surround-insert)"))
|
normal_cur_line = "gZZ";
|
||||||
(mkIf (mappings.insertLine != null) (mkSetBinding mappings.insertLine "<Plug>(nvim-surround-insert-line)"))
|
visual = "gz";
|
||||||
];
|
visual_line = "gZ";
|
||||||
normal = mkMerge [
|
delete = "gzd";
|
||||||
(mkIf (mappings.normal != null) (mkSetBinding mappings.normal "<Plug>(nvim-surround-normal)"))
|
change = "gzr";
|
||||||
(mkIf (mappings.normalCur != null) (mkSetBinding mappings.normalCur "<Plug>(nvim-surround-normal-cur)"))
|
change_line = "gZR";
|
||||||
(mkIf (mappings.normalLine != null) (mkSetBinding mappings.normalLine "<Plug>(nvim-surround-normal-line)"))
|
|
||||||
(mkIf (mappings.normalCurLine != null) (mkSetBinding mappings.normalCurLine "<Plug>(nvim-surround-normal-cur-line)"))
|
|
||||||
(mkIf (mappings.delete != null) (mkSetBinding mappings.delete "<Plug>(nvim-surround-delete)"))
|
|
||||||
(mkIf (mappings.change != null) (mkSetBinding mappings.change "<Plug>(nvim-surround-change)"))
|
|
||||||
];
|
|
||||||
visualOnly = mkMerge [
|
|
||||||
(mkIf (mappings.visual != null) (mkSetBinding mappings.visual "<Plug>(nvim-surround-visual)"))
|
|
||||||
(mkIf (mappings.visualLine != null) (mkSetBinding mappings.visualLine "<Plug>(nvim-surround-visual-line)"))
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,90 +1,24 @@
|
||||||
{
|
{lib, ...}: let
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.modules) mkIf mkDefault;
|
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.types) bool nullOr str;
|
inherit (lib.types) bool;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.utility.surround = {
|
options.vim.utility.surround = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "nvim-surround: add/change/delete surrounding delimiter pairs with ease. Note that the default mappings deviate from upstreeam to avoid conflicts with nvim-leap.";
|
description = ''
|
||||||
|
nvim-surround: add/change/delete surrounding delimiter pairs with ease.
|
||||||
|
Note that the default mappings deviate from upstreeam to avoid conflicts
|
||||||
|
with nvim-leap.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
setupOpts = mkPluginSetupOption "nvim-surround" {};
|
||||||
|
|
||||||
useVendoredKeybindings = mkOption {
|
useVendoredKeybindings = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Use alternative set of keybindings that avoids conflicts with other popular plugins, e.g. nvim-leap";
|
description = "Use alternative set of keybindings that avoids conflicts with other popular plugins, e.g. nvim-leap";
|
||||||
};
|
};
|
||||||
mappings = {
|
|
||||||
insert = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "<C-g>z";
|
|
||||||
description = "Add surround character around the cursor";
|
|
||||||
};
|
|
||||||
insertLine = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "<C-g>Z";
|
|
||||||
description = "Add surround character around the cursor on new lines";
|
|
||||||
};
|
|
||||||
normal = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gz";
|
|
||||||
description = "Surround motion with character";
|
|
||||||
};
|
|
||||||
normalCur = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gZ";
|
|
||||||
description = "Surround motion with character on new lines";
|
|
||||||
};
|
|
||||||
normalLine = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gzz";
|
|
||||||
description = "Surround line with character";
|
|
||||||
};
|
|
||||||
normalCurLine = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gZZ";
|
|
||||||
description = "Surround line with character on new lines";
|
|
||||||
};
|
|
||||||
visual = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gz";
|
|
||||||
description = "Surround selection with character";
|
|
||||||
};
|
|
||||||
visualLine = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gZ";
|
|
||||||
description = "Surround selection with character on new lines";
|
|
||||||
};
|
|
||||||
delete = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gzd";
|
|
||||||
description = "Delete surrounding character";
|
|
||||||
};
|
|
||||||
change = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = "gzr";
|
|
||||||
description = "Change surrounding character";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config.vim.utility.surround = let
|
|
||||||
cfg = config.vim.utility.surround;
|
|
||||||
in {
|
|
||||||
mappings = mkIf (! cfg.useVendoredKeybindings) (mkDefault {
|
|
||||||
insert = null;
|
|
||||||
insertLine = null;
|
|
||||||
normal = null;
|
|
||||||
normalCur = null;
|
|
||||||
normalLine = null;
|
|
||||||
normalCurLine = null;
|
|
||||||
visual = null;
|
|
||||||
visualLine = null;
|
|
||||||
delete = null;
|
|
||||||
change = null;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,86 +4,21 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) map mapAttrs filter;
|
inherit (builtins) map mapAttrs filter;
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.attrsets) mapAttrsToList;
|
||||||
inherit (lib.attrsets) mapAttrsToList filterAttrs getAttrs attrValues attrNames;
|
|
||||||
inherit (lib.strings) concatLines concatMapStringsSep;
|
inherit (lib.strings) concatLines concatMapStringsSep;
|
||||||
inherit (lib.trivial) showWarnings;
|
inherit (lib.trivial) showWarnings;
|
||||||
inherit (lib.types) str nullOr;
|
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.dag) entryAfter mkLuarcSection resolveDag entryAnywhere;
|
inherit (lib.nvim.dag) entryAfter mkLuarcSection resolveDag entryAnywhere;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.nvim.config) mkBool;
|
|
||||||
|
|
||||||
cfg = config.vim;
|
cfg = config.vim;
|
||||||
|
|
||||||
# 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 = nullOr 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: {
|
|
||||||
# Extract the values of the config options that have been explicitly set by the user
|
|
||||||
config =
|
|
||||||
filterAttrs (_: v: v != null)
|
|
||||||
(getAttrs (attrNames mapConfigOptions) action);
|
|
||||||
action =
|
|
||||||
if action.lua
|
|
||||||
then mkLuaInline action.action
|
|
||||||
else action.action;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
attrValues (mapAttrs
|
|
||||||
(key: action: let
|
|
||||||
normalizedAction = normalizeAction action;
|
|
||||||
in {
|
|
||||||
inherit (normalizedAction) action config;
|
|
||||||
inherit key;
|
|
||||||
inherit mode;
|
|
||||||
})
|
|
||||||
maps);
|
|
||||||
in {
|
in {
|
||||||
config = let
|
config = let
|
||||||
filterNonNull = attrs: filterAttrs (_: value: value != null) attrs;
|
|
||||||
globalsScript =
|
globalsScript =
|
||||||
mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}")
|
mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}") cfg.globals;
|
||||||
(filterNonNull cfg.globals);
|
|
||||||
|
optionsScript =
|
||||||
|
mapAttrsToList (name: value: "vim.o.${name} = ${toLuaObject value}") cfg.options;
|
||||||
|
|
||||||
extraPluginConfigs = resolveDag {
|
extraPluginConfigs = resolveDag {
|
||||||
name = "extra plugin configs";
|
name = "extra plugin configs";
|
||||||
|
@ -97,46 +32,29 @@ in {
|
||||||
mapResult = result: concatLines (map mkLuarcSection result);
|
mapResult = result: concatLines (map mkLuarcSection result);
|
||||||
};
|
};
|
||||||
|
|
||||||
toLuaBindings = mode: maps:
|
getAction = keymap:
|
||||||
map (value: ''
|
if keymap.lua
|
||||||
vim.keymap.set(${toLuaObject mode}, ${toLuaObject value.key}, ${toLuaObject value.action}, ${toLuaObject value.config})
|
then mkLuaInline keymap.action
|
||||||
'') (genMaps mode maps);
|
else keymap.action;
|
||||||
|
|
||||||
# I'm not sure if every one of these will work.
|
getOpts = keymap: {
|
||||||
allmap = toLuaBindings "" config.vim.maps.normalVisualOp;
|
inherit (keymap) desc silent nowait script expr unique noremap;
|
||||||
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;
|
|
||||||
|
|
||||||
maps = [
|
toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})";
|
||||||
nmap
|
|
||||||
imap
|
keymaps = concatLines (map toLuaKeymap cfg.keymaps);
|
||||||
vmap
|
|
||||||
xmap
|
|
||||||
smap
|
|
||||||
cmap
|
|
||||||
omap
|
|
||||||
tmap
|
|
||||||
lmap
|
|
||||||
icmap
|
|
||||||
allmap
|
|
||||||
];
|
|
||||||
mappings = concatLines (map concatLines maps);
|
|
||||||
in {
|
in {
|
||||||
vim = {
|
vim = {
|
||||||
luaConfigRC = {
|
luaConfigRC = {
|
||||||
|
# `vim.g` and `vim.o`
|
||||||
globalsScript = entryAnywhere (concatLines globalsScript);
|
globalsScript = entryAnywhere (concatLines globalsScript);
|
||||||
# basic
|
optionsScript = entryAfter ["basic"] (concatLines optionsScript);
|
||||||
pluginConfigs = entryAfter ["basic"] pluginConfigs;
|
|
||||||
|
# Basic
|
||||||
|
pluginConfigs = entryAfter ["optionsScript"] pluginConfigs;
|
||||||
extraPluginConfigs = entryAfter ["pluginConfigs"] extraPluginConfigs;
|
extraPluginConfigs = entryAfter ["pluginConfigs"] extraPluginConfigs;
|
||||||
mappings = entryAfter ["extraPluginConfigs"] mappings;
|
mappings = entryAfter ["extraPluginConfigs"] keymaps;
|
||||||
};
|
};
|
||||||
|
|
||||||
builtLuaConfigRC = let
|
builtLuaConfigRC = let
|
||||||
|
|
|
@ -3,27 +3,18 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkRemovedOptionModule;
|
|
||||||
inherit (lib.options) mkOption mkEnableOption literalMD literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalMD literalExpression;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.types) str attrs lines listOf either path bool;
|
inherit (lib.types) str attrs lines listOf either path;
|
||||||
inherit (lib.nvim.types) dagOf;
|
inherit (lib.nvim.types) dagOf;
|
||||||
inherit (lib.nvim.lua) listToLuaTable;
|
inherit (lib.nvim.lua) listToLuaTable;
|
||||||
|
|
||||||
cfg = config.vim;
|
cfg = config.vim;
|
||||||
in {
|
in {
|
||||||
imports = [
|
|
||||||
(mkRemovedOptionModule ["vim" "configRC"] ''
|
|
||||||
Please migrate your configRC sections to Neovim's Lua format, and
|
|
||||||
add them to luaConfigRC.
|
|
||||||
|
|
||||||
See the v0.7 release notes for more information on how to migrate
|
|
||||||
your existing configurations.
|
|
||||||
'')
|
|
||||||
];
|
|
||||||
|
|
||||||
options.vim = {
|
options.vim = {
|
||||||
enableLuaLoader = mkEnableOption ''
|
enableLuaLoader = mkEnableOption ''
|
||||||
|
[{option}`official documentation`]: https://neovim.io/doc/user/lua.html#vim.loader.enable()
|
||||||
|
|
||||||
the experimental Lua module loader to speed up the start up process
|
the experimental Lua module loader to speed up the start up process
|
||||||
|
|
||||||
If `true`, this will enable the experimental Lua module loader which:
|
If `true`, this will enable the experimental Lua module loader which:
|
||||||
|
@ -32,30 +23,12 @@ in {
|
||||||
- adds the libs loader
|
- adds the libs loader
|
||||||
- removes the default Neovim loader
|
- removes the default Neovim loader
|
||||||
|
|
||||||
|
::: {.note}
|
||||||
This is disabled by default. Before setting this option, please
|
This is disabled by default. Before setting this option, please
|
||||||
take a look at the [{option}`official documentation`](https://neovim.io/doc/user/lua.html#vim.loader.enable()).
|
take a look at the [{option}`official documentation`].
|
||||||
|
:::
|
||||||
'';
|
'';
|
||||||
|
|
||||||
disableDefaultRuntimePaths = mkOption {
|
|
||||||
type = bool;
|
|
||||||
default = true;
|
|
||||||
example = false;
|
|
||||||
description = ''
|
|
||||||
Disables the default runtime paths that are set by Neovim
|
|
||||||
when it starts up. This is useful when you want to have
|
|
||||||
full control over the runtime paths that are set by Neovim.
|
|
||||||
|
|
||||||
::: {.note}
|
|
||||||
To avoid leaking imperative user configuration into your
|
|
||||||
configuration, this is enabled by default. If you wish
|
|
||||||
to load configuration from user configuration directories
|
|
||||||
(e.g. {file}`$HOME/.config/nvim`, {file}`$HOME/.config/nvim/after`
|
|
||||||
and {file}`$HOME/.local/share/nvim/site`) you may set this
|
|
||||||
option to true.
|
|
||||||
:::
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
additionalRuntimePaths = mkOption {
|
additionalRuntimePaths = mkOption {
|
||||||
type = listOf (either path str);
|
type = listOf (either path str);
|
||||||
default = [];
|
default = [];
|
||||||
|
@ -129,16 +102,38 @@ in {
|
||||||
globals = mkOption {
|
globals = mkOption {
|
||||||
type = attrs;
|
type = attrs;
|
||||||
default = {};
|
default = {};
|
||||||
|
example = {"some_variable" = 42;};
|
||||||
description = ''
|
description = ''
|
||||||
An attribute set containing global variable values
|
An attribute set containing global variable values
|
||||||
for storing vim variables as early as possible. If
|
for storing vim variables as early as possible. If
|
||||||
populated, this option will set vim variables in the
|
populated, this option will set vim variables in the
|
||||||
built luaConfigRC as the first item.
|
built luaConfigRC as the first item.
|
||||||
|
|
||||||
E.g. {foo = "bar"} will set `vim.g.foo` to "bar" where
|
::: {.note}
|
||||||
the type of `bar` in the resulting vimscript will be
|
`{foo = "bar";}` will set `vim.g.foo` to "bar", where
|
||||||
infered from the type of the value in the `{name = value}`
|
the type of `bar` in the resulting Lua value will be
|
||||||
pair.
|
inferred from the type of the value in the `{name = value;}`
|
||||||
|
pair passed to the option.
|
||||||
|
:::
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
options = mkOption {
|
||||||
|
type = attrs;
|
||||||
|
default = {};
|
||||||
|
example = {visualbell = true;};
|
||||||
|
description = ''
|
||||||
|
An attribute set containing vim options to be set
|
||||||
|
as early as possible. If populated, this option will
|
||||||
|
set vim options in the built luaConfigRC after `basic`
|
||||||
|
and before `pluginConfigs` DAG entries.
|
||||||
|
|
||||||
|
::: {.note}
|
||||||
|
`{foo = "bar";}` will set `vim.o.foo` to "bar", where
|
||||||
|
the type of `bar` in the resulting Lua value will be
|
||||||
|
inferred from the type of the value in the`{name = value;}`
|
||||||
|
pair passed to the option.
|
||||||
|
:::
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -158,21 +153,6 @@ in {
|
||||||
vim.opt.runtimepath:append(${listToLuaTable cfg.additionalRuntimePaths})
|
vim.opt.runtimepath:append(${listToLuaTable cfg.additionalRuntimePaths})
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString cfg.disableDefaultRuntimePaths ''
|
|
||||||
-- Remove default user runtime paths from the
|
|
||||||
-- `runtimepath` option to avoid leaking user configuration
|
|
||||||
-- into the final neovim wrapper
|
|
||||||
local defaultRuntimePaths = {
|
|
||||||
vim.fn.stdpath('config'), -- $HOME/.config/nvim
|
|
||||||
vim.fn.stdpath('config') .. "/after", -- $HOME/.config/nvim/after
|
|
||||||
vim.fn.stdpath('data') .. "/site", -- $HOME/.local/share/nvim/site
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, path in ipairs(defaultRuntimePaths) do
|
|
||||||
vim.opt.runtimepath:remove(path)
|
|
||||||
end
|
|
||||||
''}
|
|
||||||
|
|
||||||
${optionalString cfg.enableLuaLoader "vim.loader.enable()"}
|
${optionalString cfg.enableLuaLoader "vim.loader.enable()"}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue