mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-24 04:18:03 +00:00
Compare commits
81 commits
3d9e8717e0
...
93c1e37625
Author | SHA1 | Date | |
---|---|---|---|
![]() |
93c1e37625 | ||
![]() |
1106b00a3c | ||
![]() |
08d6fc5e0f | ||
![]() |
ecbaa37c52 | ||
![]() |
588431d805 | ||
![]() |
7097991168 | ||
![]() |
b66dab8fb2 | ||
![]() |
e5b351f4d6 | ||
![]() |
603ec2225a | ||
![]() |
2d6670a63a | ||
![]() |
57ccfc9ec6 | ||
![]() |
133e0b45c7 | ||
![]() |
179df6319a | ||
![]() |
385ddde059 | ||
![]() |
136ca81978 | ||
![]() |
d0dc91e7a1 | ||
![]() |
56ebb27608 | ||
![]() |
a0ea4e324f | ||
![]() |
5ff6a29626 | ||
![]() |
db17f5eb5d | ||
![]() |
20aefe7ad4 | ||
![]() |
8bc12ddb6a | ||
![]() |
4e34e5c1d4 | ||
![]() |
f61aabf7e9 | ||
![]() |
8656dfcfa6 | ||
![]() |
c2fae1698d | ||
![]() |
87097d6ab4 | ||
![]() |
56aebf9310 | ||
![]() |
994a7d7ee3 | ||
![]() |
47bc9e9bd8 | ||
![]() |
6685a5aad8 | ||
![]() |
339f478cf1 | ||
![]() |
1cd5b0aa72 | ||
![]() |
e6a8532d43 | ||
![]() |
b4bfa99186 | ||
![]() |
b3b318b770 | ||
![]() |
de42f3bf98 | ||
![]() |
7264125e47 | ||
![]() |
ced83ca997 | ||
![]() |
72f4291546 | ||
![]() |
e06ebffcec | ||
![]() |
ae2b33fbf7 | ||
![]() |
3bd8a2af6f | ||
5826aebdd3 | |||
c727528b6f | |||
38fc01b9c6 | |||
d6bbae1a91 | |||
cef3aefabb | |||
![]() |
69cd77630b | ||
bce45d4eeb | |||
ccea1a6159 | |||
ab9a7c1600 | |||
![]() |
c957b23aaa | ||
a6c879e8a3 | |||
![]() |
b4c06c71dc | ||
a56a83bd46 | |||
![]() |
8e96f0aaa3 | ||
141a272747 | |||
316f25a0f6 | |||
842b45b969 | |||
27b3524508 | |||
a85ac83182 | |||
![]() |
57be605ed4 | ||
![]() |
99ace503ad | ||
e40d7a2a56 | |||
cb7ff874e2 | |||
eb037b7bff | |||
![]() |
b9dcbec29c | ||
![]() |
b499151527 | ||
b347757f8a | |||
99de583e21 | |||
![]() |
9eb6159ca3 | ||
![]() |
67abc51902 | ||
c757d28ff7 | |||
![]() |
e949a51c55 | ||
![]() |
941a2a6f2e | ||
![]() |
473ebea4cf | ||
![]() |
e40cce5653 | ||
![]() |
2fc7dc798b | ||
3ca7e3b841 | |||
![]() |
b71bf75dcd |
64 changed files with 1837 additions and 958 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
|
||||
|
||||
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
|
||||
|
||||
|
|
194
.github/README.md
vendored
194
.github/README.md
vendored
|
@ -33,10 +33,9 @@
|
|||
|
||||
<div align="center">
|
||||
<a>
|
||||
A highly modular, configurable, extensible and easy to use Neovim configuration
|
||||
framework in Nix. Designed for flexibility and ease of use, this flake
|
||||
allows you to easily configure your Neovim instance with a few lines of
|
||||
Nix code.
|
||||
nvf is a highly modular, configurable, extensible and easy to use Neovim configuration
|
||||
in Nix. Designed for flexibility and ease of use, nvf allows you to easily configure
|
||||
your fully featured Neovim instance with a few lines of Nix.
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
@ -44,6 +43,7 @@
|
|||
|
||||
<div align="center"><p>
|
||||
|
||||
[Features]: #features
|
||||
[Get Started]: #get-started
|
||||
[Documentation]: #documentation
|
||||
[Help]: #help
|
||||
|
@ -51,119 +51,150 @@
|
|||
[FAQ]: #faq
|
||||
[Credits]: #credits
|
||||
|
||||
**[<kbd> <br> Get Started <br> </kbd>][Get Started]**
|
||||
**[<kbd> <br> Documentation <br> </kbd>][Documentation]**
|
||||
**[<kbd> <br> Help <br> </kbd>][Help]**
|
||||
**[<kbd> <br> Contribute <br> </kbd>][Contribute]**
|
||||
**[<kbd> <br> FAQ <br> </kbd>][Faq]**
|
||||
**[<kbd> <br> Credits <br> </kbd>][Credits]**
|
||||
**[<kbd><br> Features <br></kbd>][Features]**
|
||||
**[<kbd><br> Get Started <br></kbd>][Get Started]**
|
||||
**[<kbd><br> Documentation <br></kbd>][Documentation]**
|
||||
**[<kbd><br> Help <br></kbd>][Help]**
|
||||
**[<kbd><br> Contribute <br></kbd>][Contribute]**
|
||||
**[<kbd><br> FAQ <br></kbd>][Faq]** **[<kbd><br> Credits <br></kbd>][Credits]**
|
||||
|
||||
</p></div>
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
- **Reproducible**: Your configuration will behave the same _anywhere_. No
|
||||
surprises, promise!
|
||||
- **Portable**: nvf depends _solely_ on your Nix store, and nothing else. No
|
||||
more global binaries! Works on all platforms, without hassle.
|
||||
- **Customizable**: There are _almost no defaults_ to annoy you. nvf is fully
|
||||
customizable through the Nix module system.
|
||||
- **Well-documented**: Documentation is priority. You will _never_ face
|
||||
undocumented, obscure behaviour.
|
||||
- **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and
|
||||
will, remain maintainable for myself and any contributors.
|
||||
|
||||
## Get Started
|
||||
|
||||
### 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
|
||||
installing it, you can run the following command
|
||||
If you are not sold on the concepts of **nvf**, and would like to try out the
|
||||
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
|
||||
```
|
||||
|
||||
This will get you a feel for the base configuration and UI design.
|
||||
The flake exposes `#nix` as the default package, providing minimal
|
||||
language support and various utilities.You may also use `#nix`,
|
||||
`#tidal` or `#maximal` to get try out different configurations.
|
||||
This will get you a feel for the base configuration and UI design. Though, none
|
||||
of the configuration options are final as **nvf** is designed to be modular and
|
||||
configurable.
|
||||
|
||||
It is as simple as changing the target output to get a different
|
||||
configuration. For example, to get a configuration with `tidal` support, run:
|
||||
> [!TIP]
|
||||
> 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
|
||||
nix run github:notashelf/nvf#tidal
|
||||
It is as simple as changing the target output to get a different configuration.
|
||||
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
|
||||
recommended to instead use the module system as described in the manual.
|
||||
|
||||
> [!NOTE]
|
||||
> The `maximal` configuration is _massive_ and will take a while to build.
|
||||
> To get a feel for the configuration, use the default `nix` or `tidal`
|
||||
> configurations. Should you choose to try out the `maximal` configuration,
|
||||
> using the binary cache as described in the manual is _strongly_ recommended.
|
||||
> [!NOTE]
|
||||
> The `maximal` configuration is quite large, and might take a while to build.
|
||||
> To get a feel for the configuration, use the default `nix` configuration.
|
||||
> Should you choose to try out the `maximal` configuration, using the binary
|
||||
> cache as described in the manual is _strongly_ recommended.
|
||||
|
||||
If you are convinced, proceed to the next section to view the installation
|
||||
instructions.
|
||||
|
||||
## Documentation
|
||||
|
||||
See the [**nvf** Manual](https://notashelf.github.io/nvf/) for
|
||||
detailed installation guides, configurations, available options, release notes
|
||||
and more. Tips for installing userspace plugins is also contained in the
|
||||
documentation.
|
||||
The _recommended_ way of installing **nvf** is using either the NixOS or the
|
||||
Home-Manager module, though it is completely possible and no less supported to
|
||||
install **nvf** as a standalone package, or a flake output.
|
||||
|
||||
If you want to dive right into trying **nvf** you can get a fully
|
||||
featured configuration with `nix` language support by running:
|
||||
See the [**nvf** manual] for detailed and up-to-date installation guides,
|
||||
configurations, available options, release notes and more. Tips for installing
|
||||
userspace plugins is also contained in the documentation.
|
||||
|
||||
```console
|
||||
nix run github:notashelf/nvf#nix
|
||||
```
|
||||
|
||||
[Issues]: https://github.com/NotAShelf/nvf/issues
|
||||
|
||||
Please create an issue on the [issue tracker](issues) if you find
|
||||
the documentation lacking or confusing. I also appreciate any contributions
|
||||
to the documentation.
|
||||
Please create an issue on the [issue tracker] if you find the documentation
|
||||
lacking or confusing. Any improvements to the documentation through pull
|
||||
requests are also welcome, and appreciated.
|
||||
|
||||
## Help
|
||||
|
||||
You can create an issue on the [issue tracker](issues) to ask questions
|
||||
or report bugs. I am not yet on spaces like matrix or IRC, so please use the issue
|
||||
tracker for now.
|
||||
You can create an issue on the [issue tracker] to ask questions or report bugs.
|
||||
I am not yet on spaces like matrix or IRC, so please use the issue tracker for
|
||||
now.
|
||||
|
||||
## Contributing
|
||||
|
||||
I am always looking for new ways to help improve this flake. If you would like
|
||||
to contribute, please read the [contributing guide](CONTRIBUTING.md) before
|
||||
submitting a pull request. You can also create an issue on the
|
||||
[issue tracker](issues) before submitting a pull request if you would
|
||||
like to discuss a feature or bug fix.
|
||||
submitting a pull request. You can also create an issue on the [issue tracker]
|
||||
before submitting a pull request if you would like to discuss a feature or bug
|
||||
fix.
|
||||
|
||||
## 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_?
|
||||
<br/>
|
||||
**A**: Maybe! It is not one of our goals to support each and every Neovim
|
||||
plugin, however, I am always open to new modules and plugin setup additions
|
||||
to **nvf**. Use the [appropritate issue template](issues/new/choose) and I will
|
||||
consider a module addition.
|
||||
<br/> **A**: Maybe! It is not one of our goals to support each and every Neovim
|
||||
plugin, however, I am always open to new modules and plugin setup additions to
|
||||
**nvf**. Use the [appropriate issue template] and I will consider a module
|
||||
addition. As mentioned before, PRs adding new features are also welcome.
|
||||
|
||||
**Q**: A plugin I need is not available in **nvf**. What to do?
|
||||
<br/>
|
||||
**A**: **nvf** exposes several APIs for you to be able to add your own
|
||||
plugin configurations! Please see the documentation on how you may do
|
||||
this.
|
||||
<br/> **A**: **nvf** exposes several APIs for you to be able to add your own
|
||||
plugin configurations! Please see the documentation on how you may do this.
|
||||
|
||||
**Q**: Main branch is awfully silent, is the project dead?
|
||||
<br/>
|
||||
**A**: No! Sometimes we branch out (e.g. v0.6) to avoid breaking userspace
|
||||
and work in a separate branch until we make sure the new additions are
|
||||
implemented in the most comfortable way available to the end user. If you have
|
||||
not noticed any activity on the main branch, consider taking a look at the [list
|
||||
of branches](https://github.com/NotAShelf/nvf/branches=) or the [list of open
|
||||
pull requests](https://github.com/NotAShelf/nvf)
|
||||
<br/> **A**: No! Sometimes we branch out (e.g. `v0.6`) to avoid breaking
|
||||
userspace and work in a separate branch until we make sure the new additions are
|
||||
implemented in the most comfortable way possible for the end user. If you have
|
||||
not noticed any activity on the main branch, consider taking a look at the
|
||||
[list of branches] or the [list of open pull requests]. You may also consider
|
||||
_testing_ those release branches to get access to new features ahead of time and
|
||||
better prepare to breaking changes.
|
||||
|
||||
## Credits
|
||||
|
||||
### Contributors
|
||||
|
||||
Special thanks to
|
||||
Special, heart-felt thanks to
|
||||
|
||||
- [@fufexan](https://github.com/fufexan) - For the transition to flake-parts
|
||||
- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to work
|
||||
- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally possible
|
||||
- [@horriblename](https://github.com/horriblename) - For actively implementing planned features and quality of life updates
|
||||
- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to
|
||||
work
|
||||
- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally
|
||||
possible
|
||||
- [@horriblename](https://github.com/horriblename) - For actively implementing
|
||||
planned features and quality of life updates
|
||||
- [@Yavko](https://github.com/Yavko) - For the amazing **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!
|
||||
|
||||
|
@ -172,10 +203,18 @@ and everyone who has submitted issues or pull requests!
|
|||
This configuration borrows from and is based on a few other configurations,
|
||||
including:
|
||||
|
||||
- [@jordanisaacs's](https://github.com/jordanisaacs) [neovim-flake](https://github.com/jordanisaacs/neovim-flake) that this flake is originally based on.
|
||||
- [@sioodmy's](https://github.com/sioodmy) [dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design choices.
|
||||
- [@wiltaylor's](https://github.com/wiltaylor) [neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and design ideas.
|
||||
- [@gvolpe's](https://github.com/gvolpe) [neovim-flake](https://github.com/gvolpe/neovim-flake) for plugin, design and nix concepts.
|
||||
- [@jordanisaacs's](https://github.com/jordanisaacs)
|
||||
[neovim-flake](https://github.com/jordanisaacs/neovim-flake) that this flake
|
||||
is originally based on.
|
||||
- [@sioodmy's](https://github.com/sioodmy)
|
||||
[dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design
|
||||
choices.
|
||||
- [@wiltaylor's](https://github.com/wiltaylor)
|
||||
[neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and
|
||||
design ideas.
|
||||
- [@gvolpe's](https://github.com/gvolpe)
|
||||
[neovim-flake](https://github.com/gvolpe/neovim-flake) for plugin, design and
|
||||
nix concepts.
|
||||
|
||||
I am grateful for their previous work and inspiration, and I wholeheartedly
|
||||
recommend checking their work out.
|
||||
|
@ -183,11 +222,14 @@ recommend checking their work out.
|
|||
|
||||
## License
|
||||
|
||||
Following the license of the [original neovim-flake](https://github.com/jordanisaacs/neovim-flake),
|
||||
**nvf** has been made available under the [**MIT License**](LICENSE). However, all assets
|
||||
and documentation are published under the
|
||||
Following the license of the
|
||||
[original neovim-flake](https://github.com/jordanisaacs/neovim-flake), **nvf**
|
||||
has been made available under the [**MIT License**](LICENSE). However, all
|
||||
assets and documentation are published under the
|
||||
[**CC BY License**](https://github.com/NotAShelf/nvf/blob/main/.github/assets/LICENSE).
|
||||
|
||||
<h6 align="center">Yes, this includes the logo work too. Stop taking artwork that is not yours!</h6>
|
||||
|
||||
---
|
||||
|
||||
<div align="right">
|
||||
|
|
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
|
37
.github/workflows/manual.yml
vendored
37
.github/workflows/manual.yml
vendored
|
@ -1,4 +1,5 @@
|
|||
name: "Build and deploy documentation"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
|
@ -7,6 +8,7 @@ on:
|
|||
paths:
|
||||
# build the manuals only when docs directory is updated
|
||||
- docs/**
|
||||
- modules/**
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
|
@ -20,23 +22,34 @@ concurrency:
|
|||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
check_date:
|
||||
runs-on: ubuntu-latest
|
||||
name: Check latest commit
|
||||
outputs:
|
||||
should_run: ${{ steps.should_run.outputs.should_run }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4.1.7
|
||||
- name: print latest_commit
|
||||
run: echo ${{ github.sha }}
|
||||
|
||||
- id: should_run
|
||||
continue-on-error: true
|
||||
name: check latest commit is less than a day
|
||||
if: ${{ github.event_name == 'schedule' }}
|
||||
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
|
||||
|
||||
publish:
|
||||
needs: check_date
|
||||
if: ${{ needs.check_date.outputs.should_run != 'false' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: actions/checkout@v4.1.7
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
nix build '.#docs'
|
||||
- run: |
|
||||
nix build .#docs
|
||||
cp -r result/share/doc/nvf public
|
||||
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v4
|
||||
- uses: peaceiris/actions-gh-pages@v4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./public
|
||||
|
|
|
@ -17,9 +17,9 @@ isMaximal: {
|
|||
lspkind.enable = false;
|
||||
lightbulb.enable = true;
|
||||
lspsaga.enable = false;
|
||||
nvimCodeActionMenu.enable = isMaximal;
|
||||
trouble.enable = true;
|
||||
lspSignature.enable = true;
|
||||
otter-nvim.enable = isMaximal;
|
||||
lsplines.enable = isMaximal;
|
||||
nvim-docs-view.enable = isMaximal;
|
||||
};
|
||||
|
@ -60,6 +60,7 @@ isMaximal: {
|
|||
python.enable = isMaximal;
|
||||
dart.enable = isMaximal;
|
||||
bash.enable = isMaximal;
|
||||
r.enable = isMaximal;
|
||||
tailwind.enable = isMaximal;
|
||||
typst.enable = isMaximal;
|
||||
clang = {
|
||||
|
@ -155,7 +156,7 @@ isMaximal: {
|
|||
};
|
||||
|
||||
utility = {
|
||||
ccc.enable = isMaximal;
|
||||
ccc.enable = false;
|
||||
vim-wakatime.enable = false;
|
||||
icon-picker.enable = isMaximal;
|
||||
surround.enable = isMaximal;
|
||||
|
@ -204,6 +205,7 @@ isMaximal: {
|
|||
go = ["90" "130"];
|
||||
};
|
||||
};
|
||||
fastaction.enable = true;
|
||||
};
|
||||
|
||||
assistant = {
|
||||
|
|
260
docs/default.nix
260
docs/default.nix
|
@ -2,131 +2,131 @@
|
|||
inputs,
|
||||
pkgs,
|
||||
lib,
|
||||
manpageUrls ? pkgs.path + "/doc/manpage-urls.json",
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkForce evalModules;
|
||||
inherit (lib.strings) hasPrefix removePrefix;
|
||||
inherit (lib.attrsets) isAttrs mapAttrs optionalAttrs recursiveUpdate isDerivation;
|
||||
inherit (builtins) fromJSON readFile;
|
||||
inherit ((lib.importJSON ../release.json)) release;
|
||||
|
||||
# release data
|
||||
release-config = fromJSON (readFile ../release.json);
|
||||
revision = release-config.release;
|
||||
|
||||
# From home-manager:
|
||||
#
|
||||
# Recursively replace each derivation in the given attribute set
|
||||
# with the same derivation but with the `outPath` attribute set to
|
||||
# the string `"\${pkgs.attribute.path}"`. This allows the
|
||||
# documentation to refer to derivations through their values without
|
||||
# establishing an actual dependency on the derivation output.
|
||||
#
|
||||
# This is not perfect, but it seems to cover a vast majority of use
|
||||
# cases.
|
||||
#
|
||||
# Caveat: even if the package is reached by a different means, the
|
||||
# path above will be shown and not e.g.
|
||||
# `${config.services.foo.package}`.
|
||||
scrubDerivations = prefixPath: attrs: let
|
||||
scrubDerivation = name: value: let
|
||||
pkgAttrName = prefixPath + "." + name;
|
||||
in
|
||||
if isAttrs value
|
||||
then
|
||||
scrubDerivations pkgAttrName value
|
||||
// optionalAttrs (isDerivation value) {
|
||||
outPath = "\${${pkgAttrName}}";
|
||||
}
|
||||
else value;
|
||||
in
|
||||
mapAttrs scrubDerivation attrs;
|
||||
|
||||
# Make sure the used package is scrubbed to avoid actually
|
||||
# instantiating derivations.
|
||||
scrubbedPkgsModule = {
|
||||
imports = [
|
||||
{
|
||||
_module.args = {
|
||||
pkgs = mkForce (scrubDerivations "pkgs" pkgs);
|
||||
pkgs_i686 = mkForce {};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Specify the path to the module entrypoint
|
||||
nvimPath = toString ./..;
|
||||
buildOptionsDocs = args @ {
|
||||
modules,
|
||||
includeModuleSystemOptions ? true,
|
||||
warningsAreErrors ? true,
|
||||
...
|
||||
}: let
|
||||
inherit ((evalModules {inherit modules;})) options;
|
||||
|
||||
# Declaration of the Github site URL.
|
||||
# Takes a user, repo, and subpath, and returns a declaration site
|
||||
# as a string.
|
||||
githubDeclaration = user: repo: subpath: let
|
||||
urlRef = "github.com";
|
||||
branch = "main";
|
||||
in {
|
||||
url = "https://${urlRef}/${user}/${repo}/blob/${branch}/${subpath}";
|
||||
name = "<${repo}/${subpath}>";
|
||||
};
|
||||
in
|
||||
pkgs.buildPackages.nixosOptionsDoc ({
|
||||
inherit warningsAreErrors;
|
||||
|
||||
options =
|
||||
if includeModuleSystemOptions
|
||||
then options
|
||||
else builtins.removeAttrs options ["_module"];
|
||||
|
||||
transformOptions = opt:
|
||||
recursiveUpdate opt {
|
||||
# Clean up declaration sites to not refer to the nvf
|
||||
# source tree.
|
||||
declarations = map (decl:
|
||||
if hasPrefix nvimPath (toString decl)
|
||||
then
|
||||
githubDeclaration "notashelf" "nvf"
|
||||
(removePrefix "/" (removePrefix nvimPath (toString decl)))
|
||||
else if decl == "lib/modules.nix"
|
||||
then
|
||||
# TODO: handle this in a better way (may require upstream
|
||||
# changes to nixpkgs)
|
||||
githubDeclaration "NixOS" "nixpkgs" decl
|
||||
else decl)
|
||||
opt.declarations;
|
||||
};
|
||||
}
|
||||
// builtins.removeAttrs args ["modules" "includeModuleSystemOptions"]);
|
||||
|
||||
nvimModuleDocs = buildOptionsDocs {
|
||||
nvimModuleDocs = pkgs.nixosOptionsDoc {
|
||||
variablelistId = "nvf-options";
|
||||
warningsAreErrors = true;
|
||||
|
||||
modules =
|
||||
import ../modules/modules.nix {
|
||||
inherit lib pkgs;
|
||||
check = false;
|
||||
}
|
||||
++ [scrubbedPkgsModule];
|
||||
inherit
|
||||
(
|
||||
(lib.evalModules {
|
||||
modules =
|
||||
import ../modules/modules.nix {
|
||||
inherit lib pkgs;
|
||||
}
|
||||
++ [
|
||||
(
|
||||
let
|
||||
# From nixpkgs:
|
||||
#
|
||||
# Recursively replace each derivation in the given attribute set
|
||||
# with the same derivation but with the `outPath` attribute set to
|
||||
# the string `"\${pkgs.attribute.path}"`. This allows the
|
||||
# documentation to refer to derivations through their values without
|
||||
# establishing an actual dependency on the derivation output.
|
||||
#
|
||||
# This is not perfect, but it seems to cover a vast majority of use
|
||||
# cases.
|
||||
#
|
||||
# Caveat: even if the package is reached by a different means, the
|
||||
# path above will be shown and not e.g.
|
||||
# `${config.services.foo.package}`.
|
||||
scrubDerivations = namePrefix: pkgSet:
|
||||
builtins.mapAttrs (
|
||||
name: value: let
|
||||
wholeName = "${namePrefix}.${name}";
|
||||
in
|
||||
if builtins.isAttrs value
|
||||
then
|
||||
scrubDerivations wholeName value
|
||||
// lib.optionalAttrs (lib.isDerivation value) {
|
||||
inherit (value) drvPath;
|
||||
outPath = "\${${wholeName}}";
|
||||
}
|
||||
else value
|
||||
)
|
||||
pkgSet;
|
||||
in {
|
||||
_module = {
|
||||
check = false;
|
||||
args.pkgs = lib.mkForce (scrubDerivations "pkgs" pkgs);
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
})
|
||||
)
|
||||
options
|
||||
;
|
||||
|
||||
transformOptions = opt:
|
||||
opt
|
||||
// {
|
||||
declarations =
|
||||
map (
|
||||
decl:
|
||||
if lib.hasPrefix (toString ../.) (toString decl)
|
||||
then
|
||||
lib.pipe decl [
|
||||
toString
|
||||
(lib.removePrefix (toString ../.))
|
||||
(lib.removePrefix "/")
|
||||
(x: {
|
||||
url = "https://github.com/NotAShelf/nvf/blob/main/${x}";
|
||||
name = "<nvf/${x}>";
|
||||
})
|
||||
]
|
||||
else if decl == "lib/modules.nix"
|
||||
then {
|
||||
url = "https://github.com/NixOS/nixpkgs/blob/master/${decl}";
|
||||
name = "<nixpkgs/lib/modules.nix>";
|
||||
}
|
||||
else decl
|
||||
)
|
||||
opt.declarations;
|
||||
};
|
||||
};
|
||||
|
||||
# Generate the HTML manual pages
|
||||
html = pkgs.callPackage ./manual.nix {
|
||||
inherit release;
|
||||
inherit (nvimModuleDocs) optionsJSON;
|
||||
};
|
||||
in {
|
||||
inherit (inputs) nmd;
|
||||
|
||||
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
|
||||
# `nixosOptionsDoc` is more customizable.
|
||||
options.json =
|
||||
pkgs.runCommand "options.json" {
|
||||
meta.description = "List of nvf options in JSON format";
|
||||
} ''
|
||||
mkdir -p $out/{share/doc,nix-support}
|
||||
cp -a ${nvimModuleDocs.optionsJSON}/share/doc/nixos $out/share/doc/nvf
|
||||
substitute \
|
||||
${nvimModuleDocs.optionsJSON}/nix-support/hydra-build-products \
|
||||
$out/nix-support/hydra-build-products \
|
||||
--replace \
|
||||
'${nvimModuleDocs.optionsJSON}/share/doc/nixos' \
|
||||
"$out/share/doc/nvf"
|
||||
'';
|
||||
|
||||
# Generate the `man home-configuration.nix` package
|
||||
nvf-configuration-manual =
|
||||
manPages =
|
||||
pkgs.runCommand "nvf-reference-manpage" {
|
||||
nativeBuildInputs = [pkgs.buildPackages.installShellFiles pkgs.nixos-render-docs];
|
||||
nativeBuildInputs = [
|
||||
pkgs.buildPackages.installShellFiles
|
||||
pkgs.nixos-render-docs
|
||||
];
|
||||
allowedReferences = ["out"];
|
||||
} ''
|
||||
# Generate manpages.
|
||||
mkdir -p $out/share/man/man5
|
||||
mkdir -p $out/share/man/man1
|
||||
mkdir -p $out/share/man/{man5,man1}
|
||||
|
||||
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
|
||||
--revision ${revision} \
|
||||
--revision ${release} \
|
||||
--header ${./man/header.5} \
|
||||
--footer ${./man/footer.5} \
|
||||
${nvimModuleDocs.optionsJSON}/share/doc/nixos/options.json \
|
||||
|
@ -135,38 +135,8 @@
|
|||
cp ${./man/nvf.1} $out/share/man/man1/nvf.1
|
||||
'';
|
||||
|
||||
# Generate the HTML manual pages
|
||||
nvf-manual = pkgs.callPackage ./manual.nix {
|
||||
inherit revision manpageUrls;
|
||||
outputPath = "share/doc/nvf";
|
||||
options = {
|
||||
nvf = nvimModuleDocs.optionsJSON;
|
||||
};
|
||||
manual = {
|
||||
inherit html;
|
||||
htmlOpenTool = pkgs.callPackage ./html-open-tool.nix {inherit html;};
|
||||
};
|
||||
|
||||
html = nvf-manual;
|
||||
htmlOpenTool = pkgs.callPackage ./html-open-tool.nix {} {inherit html;};
|
||||
in {
|
||||
inherit (inputs) nmd;
|
||||
|
||||
options = {
|
||||
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
|
||||
# `nixosOptionsDoc` is more customizable.
|
||||
json =
|
||||
pkgs.runCommand "options.json" {
|
||||
meta.description = "List of nvf options in JSON format";
|
||||
} ''
|
||||
mkdir -p $out/{share/doc,nix-support}
|
||||
cp -a ${nvimModuleDocs.optionsJSON}/share/doc/nixos $out/share/doc/nvf
|
||||
substitute \
|
||||
${nvimModuleDocs.optionsJSON}/nix-support/hydra-build-products \
|
||||
$out/nix-support/hydra-build-products \
|
||||
--replace \
|
||||
'${nvimModuleDocs.optionsJSON}/share/doc/nixos' \
|
||||
"$out/share/doc/nvf"
|
||||
'';
|
||||
};
|
||||
|
||||
manPages = nvf-configuration-manual;
|
||||
manual = {inherit html htmlOpenTool;};
|
||||
}
|
||||
|
|
|
@ -2,13 +2,9 @@
|
|||
writeShellScriptBin,
|
||||
makeDesktopItem,
|
||||
symlinkJoin,
|
||||
}: {
|
||||
html,
|
||||
pathName ? "nvf",
|
||||
projectName ? pathName,
|
||||
name ? "${pathName}-help",
|
||||
}: let
|
||||
helpScript = writeShellScriptBin name ''
|
||||
helpScript = writeShellScriptBin "nvf-help" ''
|
||||
set -euo pipefail
|
||||
|
||||
if [[ ! -v BROWSER || -z $BROWSER ]]; then
|
||||
|
@ -24,20 +20,23 @@
|
|||
echo "$0: unable to start a web browser; please set \$BROWSER"
|
||||
exit 1
|
||||
else
|
||||
exec "$BROWSER" "${html}/share/doc/${pathName}/index.xhtml"
|
||||
exec "$BROWSER" "${html}/share/doc/nvf/index.xhtml"
|
||||
fi
|
||||
'';
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
name = "${pathName}-manual";
|
||||
desktopName = "${projectName} Manual";
|
||||
genericName = "View ${projectName} documentation in a web browser";
|
||||
name = "nvf-manual";
|
||||
desktopName = "nvf Manual";
|
||||
genericName = "View nvf documentation in a web browser";
|
||||
icon = "nix-snowflake";
|
||||
exec = "${helpScript}/bin/${name}";
|
||||
exec = "${helpScript}/bin/nvf-help";
|
||||
categories = ["System"];
|
||||
};
|
||||
in
|
||||
symlinkJoin {
|
||||
inherit name;
|
||||
paths = [helpScript desktopItem];
|
||||
name = "nvf-help";
|
||||
paths = [
|
||||
helpScript
|
||||
desktopItem
|
||||
];
|
||||
}
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
# build inputs
|
||||
nixos-render-docs,
|
||||
documentation-highlighter,
|
||||
path,
|
||||
# nrd configuration
|
||||
manpageUrls,
|
||||
revision,
|
||||
options,
|
||||
outputPath ? "share/doc/nvf",
|
||||
release,
|
||||
optionsJSON,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "nvf-manual";
|
||||
|
@ -20,9 +19,11 @@ stdenvNoCC.mkDerivation {
|
|||
nativeBuildInputs = [nixos-render-docs];
|
||||
|
||||
buildPhase = ''
|
||||
mkdir -p out/{highlightjs,media}
|
||||
dest="$out/share/doc/nvf"
|
||||
mkdir -p "$(dirname "$dest")"
|
||||
mkdir -p $dest/{highlightjs,media}
|
||||
|
||||
cp -vt out/highlightjs \
|
||||
cp -vt $dest/highlightjs \
|
||||
${documentation-highlighter}/highlight.pack.js \
|
||||
${documentation-highlighter}/LICENSE \
|
||||
${documentation-highlighter}/mono-blue.css \
|
||||
|
@ -31,38 +32,32 @@ stdenvNoCC.mkDerivation {
|
|||
substituteInPlace ./options.md \
|
||||
--subst-var-by \
|
||||
OPTIONS_JSON \
|
||||
${options.nvf}/share/doc/nixos/options.json
|
||||
${optionsJSON}/share/doc/nixos/options.json
|
||||
|
||||
substituteInPlace ./manual.md \
|
||||
--subst-var-by \
|
||||
NVF_VERSION \
|
||||
${revision}
|
||||
${release}
|
||||
|
||||
# copy stylesheet
|
||||
cp ${./static/style.css} out/style.css
|
||||
cp ${./static/style.css} "$dest/style.css"
|
||||
|
||||
# copy release notes
|
||||
cp -vr ${./release-notes} release-notes
|
||||
|
||||
# generate manual from
|
||||
nixos-render-docs manual html \
|
||||
--manpage-urls ${manpageUrls} \
|
||||
--revision ${lib.trivial.revisionWithDefault revision} \
|
||||
--manpage-urls ${path + "/doc/manpage-urls.json"} \
|
||||
--revision ${lib.trivial.revisionWithDefault release} \
|
||||
--stylesheet style.css \
|
||||
--script highlightjs/highlight.pack.js \
|
||||
--script highlightjs/loader.js \
|
||||
--toc-depth 2 \
|
||||
--section-toc-depth 1 \
|
||||
manual.md \
|
||||
out/index.xhtml
|
||||
'';
|
||||
"$dest/index.xhtml"
|
||||
|
||||
installPhase = ''
|
||||
dest="$out/${outputPath}"
|
||||
mkdir -p "$(dirname "$dest")"
|
||||
mv out "$dest"
|
||||
|
||||
mkdir -p $out/nix-support/
|
||||
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
|
||||
mkdir -p $out/nix-support/
|
||||
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Custom Plugins {#ch-custom-plugins}
|
||||
|
||||
**nvf**, by default, exposes a wide variety of plugins as module options
|
||||
for your convience and bundles necessary dependencies into **nvf**'s runtime.
|
||||
for your convenience and bundles necessary dependencies into **nvf**'s runtime.
|
||||
In case a plugin is not available in **nvf**, you may consider making a pull
|
||||
request to **nvf** to include it as a module or you may add it to your
|
||||
configuration locally.
|
||||
|
|
|
@ -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 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
|
||||
inserted before the rest of the DAG
|
||||
2. `globalsScript` - used to set globals defined in `vim.globals`
|
||||
3. `basic` - used to set basic configuration options
|
||||
4. `theme` - used to set up the theme, which has to be done before other plugins
|
||||
5. `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
|
||||
6. `extraPluginConfigs` - the result of `vim.extraPlugins`, which is not a
|
||||
4. `optionsScript` - used to set options defined in `vim.o`
|
||||
5. `theme` (this is simply placed before `pluginConfigs`, meaning that
|
||||
surrounding entries don't depend on it) - used to set up the theme, which has
|
||||
to be done before other plugins
|
||||
6. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option,
|
||||
see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your
|
||||
own plugins) DAG, used to set up internal plugins
|
||||
7. `extraPluginConfigs` - the result of `vim.extraPlugins`, which is not a
|
||||
direct DAG, but is converted to, and resolved as one internally
|
||||
7. `mappings` - the result of `vim.maps`
|
||||
8. `mappings` - the result of `vim.maps`
|
||||
|
|
|
@ -4,6 +4,8 @@ Release notes for release 0.7
|
|||
|
||||
## Breaking Changes and Migration Guide {#sec-breaking-changes-and-migration-guide-0-7}
|
||||
|
||||
### `vim.configRC` removed {#sec-vim-configrc-removed}
|
||||
|
||||
In v0.7 we are removing `vim.configRC` in favor of making `vim.luaConfigRC` the
|
||||
top-level DAG, and thereby making the entire configuration Lua based. This
|
||||
change introduces a few breaking changes:
|
||||
|
@ -24,6 +26,40 @@ making good use of its extensive Lua API. Additionally, Vimscript is slow and
|
|||
brings unnecessary performance overhead while working with different
|
||||
configuration formats.
|
||||
|
||||
### `vim.maps` rewrite {#sec-vim-maps-rewrite}
|
||||
|
||||
Instead of specifying map modes using submodules (eg.: `vim.maps.normal`), a new
|
||||
`mode` option has mode 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.maps."<leader>m" = {
|
||||
mode = "n";
|
||||
...
|
||||
};
|
||||
```
|
||||
|
||||
### `vim.lsp.nvimCodeActionMenu` removed in favor of `vim.ui.fastaction` {#sec-nvim-code-action-menu-deprecation}
|
||||
|
||||
The nvim-code-action-menu plugin has been archived and broken for a long time,
|
||||
so it's being replaced with a young, but better alternative called
|
||||
fastaction.nvim. Simply remove everything set under
|
||||
`vim.lsp.nvimCodeActionMenu`, and set `vim.ui.fastaction.enable` to `true`.
|
||||
|
||||
Note that we are looking to add more alternatives in the future like
|
||||
dressing.nvim and actions-preview.nvim, in case fastaction doesn't work for
|
||||
everyone.
|
||||
|
||||
|
||||
## Changelog {#sec-release-0.7-changelog}
|
||||
|
||||
[ItsSorae](https://github.com/ItsSorae):
|
||||
|
@ -53,6 +89,7 @@ configuration formats.
|
|||
longer filtered and thus should be used instead.
|
||||
- Add dap-go for better dap configurations
|
||||
- Make noice.nvim customizable
|
||||
- Standardize border style options and add custom borders
|
||||
|
||||
[rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim
|
||||
[rustaceanvim]: https://github.com/mrcjkb/rustaceanvim
|
||||
|
@ -71,7 +108,8 @@ configuration formats.
|
|||
|
||||
- Fix "Emac" typo
|
||||
|
||||
- Add [new-file-template.nvim] to automatically fill new file contents using templates.
|
||||
- Add [new-file-template.nvim] to automatically fill new file contents using
|
||||
templates.
|
||||
|
||||
[diniamo](https://github.com/diniamo):
|
||||
|
||||
|
@ -102,6 +140,9 @@ configuration formats.
|
|||
yourself by adding `vim.opt.listchars:append({ eol = '<char>' })` to your
|
||||
lua configuration
|
||||
|
||||
- Replace `vim.lsp.nvimCodeActionMenu` with `vim.ui.fastaction`, see the
|
||||
breaking changes section above for more details
|
||||
|
||||
[Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd()
|
||||
|
||||
- Make Neovim's configuration file entirely Lua based. This comes with a few
|
||||
|
@ -114,6 +155,8 @@ configuration formats.
|
|||
has been introduced for setting up internal plugins. See the "DAG entries in
|
||||
nvf" manual page for more information.
|
||||
|
||||
- Rewrite `vim.maps`, see the breaking changes section above.
|
||||
|
||||
[NotAShelf](https://github.com/notashelf):
|
||||
|
||||
[ts-error-translator.nvim]: https://github.com/dmmulroy/ts-error-translator.nvim
|
||||
|
@ -146,7 +189,43 @@ configuration formats.
|
|||
- Add `nvf-print-config` & `nvf-print-config-path` helper scripts to Neovim
|
||||
closure. Both of those scripts have been automatically added to your PATH upon
|
||||
using neovimConfig or `programs.nvf.enable`.
|
||||
|
||||
- `nvf-print-config` will display your `init.lua`, in full.
|
||||
- `nvf-print-config-path` will display the path to _a clone_ of your
|
||||
`init.lua`. This is not the path used by the Neovim wrapper, but an
|
||||
identical clone.
|
||||
|
||||
- Add `vim.ui.breadcrumbs.lualine` to allow fine-tuning breadcrumbs behaviour on
|
||||
Lualine. Only `vim.ui.breadcrumbs.lualine.winbar` is supported for the time
|
||||
being.
|
||||
|
||||
- [](#opt-vim.ui.breadcrumbs.lualine.winbar.enable) has been added to allow
|
||||
controlling the default behaviour of the `nvim-navic` component on Lualine,
|
||||
which used to occupy `winbar.lualine_c` as long as breadcrumbs are enabled.
|
||||
- `vim.ui.breadcrumbs.alwaysRender` has been renamed to
|
||||
[](#opt-vim.ui.breadcrumbs.lualine.winbar.alwaysRender) to be conform to the
|
||||
new format.
|
||||
|
||||
- Add [basedpyright](https://github.com/detachhead/basedpyright) as a Python LSP
|
||||
server and make it default.
|
||||
|
||||
- Add [python-lsp-server](https://github.com/python-lsp/python-lsp-server) as an
|
||||
additional Python LSP server.
|
||||
|
||||
- Add [](#opt-vim.options) to set `vim.o` values in in your nvf configuration
|
||||
without using additional Lua. See option documentation for more details.
|
||||
|
||||
- Add [](#opt-vim.dashboard.dashboard-nvim.setupOpts) to allow user
|
||||
configuration for [dashboard.nvim](https://github.com/nvimdev/dashboard-nvim)
|
||||
|
||||
[ppenguin](https://github.com/ppenguin):
|
||||
|
||||
- Telescope:
|
||||
- Fixed `project-nvim` command and keybinding
|
||||
- Added default ikeybind/command for `Telescope resume` (`<leader>fr`)
|
||||
|
||||
[Soliprem](https://github.com/Soliprem)
|
||||
|
||||
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
||||
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
||||
ccc
|
||||
|
|
185
flake.lock
generated
185
flake.lock
generated
|
@ -1,21 +1,5 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
|
@ -52,28 +36,13 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mnw": {
|
||||
"locked": {
|
||||
"lastModified": 1724456641,
|
||||
"narHash": "sha256-SMgnviF6ofBPbyV3+rljPGcX0Hn9HBOhgXE10Cyjaic=",
|
||||
"lastModified": 1726188505,
|
||||
"narHash": "sha256-3dkxJo6y/aKfwkAg6YnpdiQAoZKgHhWHz7ilGJHCoVU=",
|
||||
"owner": "Gerg-L",
|
||||
"repo": "mnw",
|
||||
"rev": "c261925dbbf02f523af0e8add844df64fddf0359",
|
||||
"rev": "ea00b3d2162d85dd085a6ba6d49aa2a186e588e7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -129,11 +98,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1722141560,
|
||||
"narHash": "sha256-Ul3rIdesWaiW56PS/Ak3UlJdkwBrD4UcagCmXZR9Z7Y=",
|
||||
"lastModified": 1726871744,
|
||||
"narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "038fb464fcfa79b4f08131b07f2d8c9a6bcc4160",
|
||||
"rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -171,22 +140,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1702350026,
|
||||
"narHash": "sha256-A+GNZFZdfl4JdDphYKBJ5Ef1HOiFsP18vQe9mqjmUis=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9463103069725474698139ab10f17a9d125da859",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nmd": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -571,6 +524,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-fastaction-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1721396662,
|
||||
"narHash": "sha256-L7na78FsE+QHlEwxMpiwQcoOPhtmrknvdTZfzUoDANI=",
|
||||
"owner": "Chaitanyabsprip",
|
||||
"repo": "fastaction.nvim",
|
||||
"rev": "2384dea7ba81d2709d0bee0e4bc7a8831ff13a9d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Chaitanyabsprip",
|
||||
"repo": "fastaction.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-fidget-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -843,6 +812,38 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-lz-n": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1727574854,
|
||||
"narHash": "sha256-qDWNleR2NHFkiEKE/+LNVOBRwEeskMC4dWTl5BTyZuE=",
|
||||
"owner": "nvim-neorocks",
|
||||
"repo": "lz.n",
|
||||
"rev": "470173e3cbef763c6d1b918f3f129b67db75e1f8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nvim-neorocks",
|
||||
"repo": "lz.n",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-lzn-auto-require": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1724239920,
|
||||
"narHash": "sha256-wNtja4vbfzgVwVh8fw6cfTHxcxPOqr6z4nl5Fjj2d0I=",
|
||||
"owner": "horriblename",
|
||||
"repo": "lzn-auto-require",
|
||||
"rev": "c74fa9be2203438aab7fd132310abdb181426c66",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "horriblename",
|
||||
"repo": "lzn-auto-require",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-mind-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -894,11 +895,11 @@
|
|||
"plugin-neo-tree-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1713050882,
|
||||
"narHash": "sha256-cZwOVpdMT0NCtp6Ha592QA2RzKVS6LhXXcjfDBCQ+0k=",
|
||||
"lastModified": 1726542367,
|
||||
"narHash": "sha256-Lqt0KJNT9HmpJwZoWChYeVBrDWhscRe8COqVCwgcTwk=",
|
||||
"owner": "nvim-neo-tree",
|
||||
"repo": "neo-tree.nvim",
|
||||
"rev": "22e566aeb075c94f670f34077e05ba95190dfb4a",
|
||||
"rev": "a77af2e764c5ed4038d27d1c463fa49cd4794e07",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1052,22 +1053,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-nvim-code-action-menu": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1702287297,
|
||||
"narHash": "sha256-pY+aP9iBuJhvDZzVEsOHZmnfaq3vUP7TfKEEQrj+Mo8=",
|
||||
"owner": "weilbith",
|
||||
"repo": "nvim-code-action-menu",
|
||||
"rev": "8c7672a4b04d3cc4edd2c484d05b660a9cb34a1b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "weilbith",
|
||||
"repo": "nvim-code-action-menu",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-nvim-colorizer-lua": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -1183,11 +1168,11 @@
|
|||
"plugin-nvim-lspconfig": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1716498901,
|
||||
"narHash": "sha256-PMMqPDnq4Q8gWeKQ2WPE+pOf1R1G61wJ+bAWkHpQlzE=",
|
||||
"lastModified": 1727085470,
|
||||
"narHash": "sha256-IPpUZEMIL7+4mmqQLy9JeT0cW15/SH3Hx8kyksVcqC0=",
|
||||
"owner": "neovim",
|
||||
"repo": "nvim-lspconfig",
|
||||
"rev": "b972e7154bc94ab4ecdbb38c8edbccac36f83996",
|
||||
"rev": "dd329912c8d446240584a2dbcd3802af3a19105a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1327,11 +1312,11 @@
|
|||
"plugin-nvim-treesitter-context": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1716388265,
|
||||
"narHash": "sha256-EY5Si6t7LXcxOP3ubGAAMd3lgbeaCOCIybSKi1Ucx98=",
|
||||
"lastModified": 1726947805,
|
||||
"narHash": "sha256-5oN/vyhSqDqjLEzECj01A7A+Yq7U1H1HXLbzkC1Ljqw=",
|
||||
"owner": "nvim-treesitter",
|
||||
"repo": "nvim-treesitter-context",
|
||||
"rev": "f62bfe19e0fbc13ae95649dfb3cf22f4ff85b683",
|
||||
"rev": "3d5390c49e3f8fe457b376df2a49aa39d75b7911",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1420,6 +1405,22 @@
|
|||
"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": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -1855,6 +1856,7 @@
|
|||
"plugin-dracula": "plugin-dracula",
|
||||
"plugin-dressing-nvim": "plugin-dressing-nvim",
|
||||
"plugin-elixir-tools": "plugin-elixir-tools",
|
||||
"plugin-fastaction-nvim": "plugin-fastaction-nvim",
|
||||
"plugin-fidget-nvim": "plugin-fidget-nvim",
|
||||
"plugin-flutter-tools": "plugin-flutter-tools",
|
||||
"plugin-gesture-nvim": "plugin-gesture-nvim",
|
||||
|
@ -1872,6 +1874,8 @@
|
|||
"plugin-lspkind": "plugin-lspkind",
|
||||
"plugin-lspsaga": "plugin-lspsaga",
|
||||
"plugin-lualine": "plugin-lualine",
|
||||
"plugin-lz-n": "plugin-lz-n",
|
||||
"plugin-lzn-auto-require": "plugin-lzn-auto-require",
|
||||
"plugin-mind-nvim": "plugin-mind-nvim",
|
||||
"plugin-minimap-vim": "plugin-minimap-vim",
|
||||
"plugin-modes-nvim": "plugin-modes-nvim",
|
||||
|
@ -1885,7 +1889,6 @@
|
|||
"plugin-nvim-autopairs": "plugin-nvim-autopairs",
|
||||
"plugin-nvim-bufferline-lua": "plugin-nvim-bufferline-lua",
|
||||
"plugin-nvim-cmp": "plugin-nvim-cmp",
|
||||
"plugin-nvim-code-action-menu": "plugin-nvim-code-action-menu",
|
||||
"plugin-nvim-colorizer-lua": "plugin-nvim-colorizer-lua",
|
||||
"plugin-nvim-cursorline": "plugin-nvim-cursorline",
|
||||
"plugin-nvim-dap": "plugin-nvim-dap",
|
||||
|
@ -1908,6 +1911,7 @@
|
|||
"plugin-obsidian-nvim": "plugin-obsidian-nvim",
|
||||
"plugin-onedark": "plugin-onedark",
|
||||
"plugin-orgmode-nvim": "plugin-orgmode-nvim",
|
||||
"plugin-otter-nvim": "plugin-otter-nvim",
|
||||
"plugin-oxocarbon": "plugin-oxocarbon",
|
||||
"plugin-plenary-nvim": "plugin-plenary-nvim",
|
||||
"plugin-project-nvim": "plugin-project-nvim",
|
||||
|
@ -1933,8 +1937,7 @@
|
|||
"plugin-vim-vsnip": "plugin-vim-vsnip",
|
||||
"plugin-which-key": "plugin-which-key",
|
||||
"rnix-lsp": "rnix-lsp",
|
||||
"systems": "systems_2",
|
||||
"zig": "zig"
|
||||
"systems": "systems_2"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
|
@ -2006,26 +2009,6 @@
|
|||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"zig": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1716725305,
|
||||
"narHash": "sha256-LIz08gALt2wlutGXAEhNroEoIuPV5ePQB8LI4WzXcy8=",
|
||||
"owner": "mitchellh",
|
||||
"repo": "zig-overlay",
|
||||
"rev": "93b02a697561ecd438cfa5779727b5a1c300cb4c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "mitchellh",
|
||||
"repo": "zig-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
47
flake.nix
47
flake.nix
|
@ -13,8 +13,8 @@
|
|||
inherit inputs;
|
||||
specialArgs = {inherit lib;};
|
||||
} {
|
||||
# provide overridable systems
|
||||
# https://github.com/nix-systems/nix-systems
|
||||
# Allow users to bring their own systems.
|
||||
# «https://github.com/nix-systems/nix-systems»
|
||||
systems = import inputs.systems;
|
||||
imports = [
|
||||
./flake/apps.nix
|
||||
|
@ -62,7 +62,6 @@
|
|||
pkgs,
|
||||
...
|
||||
}: {
|
||||
formatter = pkgs.alejandra;
|
||||
devShells = {
|
||||
default = self'.devShells.lsp;
|
||||
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
|
||||
|
@ -70,6 +69,21 @@
|
|||
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
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -90,10 +104,7 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
# TODO: get zig from the zig overlay instead of nixpkgs
|
||||
zig.url = "github:mitchellh/zig-overlay";
|
||||
|
||||
# Langauge server (use master instead of nixpkgs)
|
||||
# Language servers (use master instead of nixpkgs)
|
||||
rnix-lsp.url = "github:nix-community/rnix-lsp";
|
||||
nil = {
|
||||
url = "github:oxalica/nil";
|
||||
|
@ -102,6 +113,17 @@
|
|||
};
|
||||
|
||||
## Plugins
|
||||
# Lazy loading
|
||||
plugin-lz-n = {
|
||||
url = "github:nvim-neorocks/lz.n";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-lzn-auto-require = {
|
||||
url = "github:horriblename/lzn-auto-require";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# LSP plugins
|
||||
plugin-nvim-lspconfig = {
|
||||
url = "github:neovim/nvim-lspconfig";
|
||||
|
@ -133,8 +155,8 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
plugin-nvim-code-action-menu = {
|
||||
url = "github:weilbith/nvim-code-action-menu";
|
||||
plugin-fastaction-nvim = {
|
||||
url = "github:Chaitanyabsprip/fastaction.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
|
@ -159,7 +181,12 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
# language support
|
||||
plugin-otter-nvim = {
|
||||
url = "github:jmbuhr/otter.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Language support
|
||||
plugin-sqls-nvim = {
|
||||
url = "github:nanotee/sqls.nvim";
|
||||
flake = false;
|
||||
|
|
|
@ -67,7 +67,6 @@ in {
|
|||
formatOnSave = true;
|
||||
lightbulb.enable = true;
|
||||
lspsaga.enable = false;
|
||||
nvimCodeActionMenu.enable = true;
|
||||
trouble.enable = true;
|
||||
lspSignature.enable = true;
|
||||
rust.enable = false;
|
||||
|
|
|
@ -67,7 +67,6 @@ in {
|
|||
formatOnSave = true;
|
||||
lightbulb.enable = true;
|
||||
lspsaga.enable = false;
|
||||
nvimCodeActionMenu.enable = true;
|
||||
trouble.enable = true;
|
||||
lspSignature.enable = true;
|
||||
rust.enable = false;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
docs = import ../docs {inherit pkgs inputs lib;};
|
||||
in {
|
||||
packages = {
|
||||
inherit (docs.manual) htmlOpenTool;
|
||||
# Documentation
|
||||
docs = docs.manual.html;
|
||||
docs-html = docs.manual.html;
|
||||
|
|
|
@ -67,6 +67,23 @@
|
|||
mkLuaBinding binding.value action binding.description;
|
||||
|
||||
pushDownDefault = attr: mapAttrs (_: mkDefault) attr;
|
||||
|
||||
mkLznBinding = mode: key: action: desc: {
|
||||
inherit mode desc key action;
|
||||
};
|
||||
|
||||
mkSetLznBinding = binding: action: {
|
||||
inherit action;
|
||||
key = binding.value;
|
||||
desc = binding.description;
|
||||
};
|
||||
|
||||
mkSetLuaLznBinding = binding: action: {
|
||||
inherit action;
|
||||
key = binding.value;
|
||||
lua = true;
|
||||
desc = binding.description;
|
||||
};
|
||||
};
|
||||
in
|
||||
binds
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
lib,
|
||||
}: let
|
||||
modulesWithInputs = import ../modules inputs;
|
||||
in
|
||||
{
|
||||
modules ? [],
|
||||
pkgs,
|
||||
check ? true,
|
||||
extraSpecialArgs ? {},
|
||||
extraModules ? [],
|
||||
...
|
||||
}:
|
||||
modulesWithInputs {
|
||||
inherit pkgs lib check extraSpecialArgs extraModules;
|
||||
configuration.imports = modules;
|
||||
}
|
|
@ -11,5 +11,5 @@
|
|||
languages = import ./languages.nix {inherit lib;};
|
||||
lists = import ./lists.nix {inherit lib;};
|
||||
lua = import ./lua.nix {inherit lib;};
|
||||
neovimConfiguration = import ./configuration.nix {inherit inputs lib;};
|
||||
neovimConfiguration = import ../modules {inherit inputs lib;};
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
typesCustom = import ./custom.nix {inherit lib;};
|
||||
in {
|
||||
inherit (typesDag) dagOf;
|
||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType;
|
||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
||||
inherit (typesLanguage) diagnostics mkGrammarOption;
|
||||
inherit (typesCustom) anythingConcatLists char;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
inherit (lib.options) mkOption;
|
||||
inherit (lib.attrsets) attrNames mapAttrs' filterAttrs nameValuePair;
|
||||
inherit (lib.strings) hasPrefix removePrefix;
|
||||
inherit (lib.types) submodule either package enum str lines attrsOf anything listOf nullOr;
|
||||
inherit (lib.types) submodule either package enum str lines attrsOf anything listOf nullOr oneOf bool int;
|
||||
|
||||
# Get the names of all flake inputs that start with the given prefix.
|
||||
fromInputs = {
|
||||
|
@ -51,9 +51,197 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
borderPresets = ["none" "single" "double" "rounded" "solid" "shadow"];
|
||||
luaInline = lib.mkOptionType {
|
||||
name = "luaInline";
|
||||
check = x: lib.nvim.lua.isLuaInline x;
|
||||
};
|
||||
|
||||
lznKeysSpec = submodule {
|
||||
options = {
|
||||
desc = mkOption {
|
||||
description = "Description of the key map";
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
};
|
||||
|
||||
noremap = mkOption {
|
||||
description = "TBD";
|
||||
type = bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
expr = mkOption {
|
||||
description = "TBD";
|
||||
type = bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
nowait = mkOption {
|
||||
description = "TBD";
|
||||
type = bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
ft = mkOption {
|
||||
description = "TBD";
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
};
|
||||
|
||||
key = mkOption {
|
||||
type = str;
|
||||
description = "Key to bind to";
|
||||
};
|
||||
|
||||
action = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Action to trigger.";
|
||||
};
|
||||
|
||||
lua = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "If true the action is treated as a lua function instead of a vim command.";
|
||||
};
|
||||
|
||||
mode = mkOption {
|
||||
description = "Modes to bind in";
|
||||
type = listOf str;
|
||||
default = ["n" "x" "s" "o"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
lznPluginTableType = attrsOf lznPluginType;
|
||||
lznPluginType = submodule {
|
||||
options = {
|
||||
## Should probably infer from the actual plugin somehow
|
||||
## In general this is the name passed to packadd, so the dir name of the plugin
|
||||
# name = mkOption {
|
||||
# type= str;
|
||||
# }
|
||||
|
||||
# Non-lz.n options
|
||||
|
||||
package = mkOption {
|
||||
type = pluginType;
|
||||
description = "Plugin package";
|
||||
};
|
||||
|
||||
setupModule = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Lua module to run setup function on.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
setupOpts = mkOption {
|
||||
type = submodule {freeformType = attrsOf anything;};
|
||||
description = "Options to pass to the setup function";
|
||||
default = {};
|
||||
};
|
||||
|
||||
# lz.n options
|
||||
|
||||
enabled = mkOption {
|
||||
type = nullOr (either bool str);
|
||||
description = "When false, or if the lua function returns false, this plugin will not be included in the spec";
|
||||
default = null;
|
||||
};
|
||||
|
||||
beforeAll = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Lua code to run before any plugins are loaded. This will be wrapped in a function.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
before = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Lua code to run before plugin is loaded. This will be wrapped in a function.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
after = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Lua code to run after plugin is loaded. This will be wrapped in a function.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
event = mkOption {
|
||||
description = "Lazy-load on event";
|
||||
default = null;
|
||||
type = let
|
||||
event = submodule {
|
||||
options = {
|
||||
event = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
description = "Exact event name";
|
||||
example = "BufEnter";
|
||||
};
|
||||
pattern = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
description = "Event pattern";
|
||||
example = "BufEnter *.lua";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
nullOr (oneOf [str (listOf str) event]);
|
||||
};
|
||||
|
||||
cmd = mkOption {
|
||||
description = "Lazy-load on command";
|
||||
default = null;
|
||||
type = nullOr (either str (listOf str));
|
||||
};
|
||||
|
||||
ft = mkOption {
|
||||
description = "Lazy-load on filetype";
|
||||
default = null;
|
||||
type = nullOr (either str (listOf str));
|
||||
};
|
||||
|
||||
keys = mkOption {
|
||||
description = "Lazy-load on key mapping";
|
||||
default = null;
|
||||
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]);
|
||||
example = ''
|
||||
keys = [
|
||||
{lhs = "<leader>s"; rhs = ":NvimTreeToggle<cr>"; desc = "Toggle NvimTree"}
|
||||
]
|
||||
'';
|
||||
};
|
||||
|
||||
colorscheme = mkOption {
|
||||
description = "Lazy-load on colorscheme.";
|
||||
type = nullOr (either str (listOf str));
|
||||
default = null;
|
||||
};
|
||||
|
||||
priority = mkOption {
|
||||
type = nullOr int;
|
||||
description = "Only useful for stat plugins (not lazy-loaded) to force loading certain plugins first.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
load = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Lua code to override the `vim.g.lz_n.load()` function for a single plugin.
|
||||
|
||||
This will be wrapped in a function
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
inherit extraPluginType fromInputs pluginType;
|
||||
|
||||
borderType = either (enum borderPresets) (listOf (either str (listOf str)));
|
||||
|
||||
pluginsOpt = {
|
||||
description,
|
||||
example,
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
inputs: {
|
||||
configuration,
|
||||
pkgs,
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
check ? true,
|
||||
}: {
|
||||
pkgs,
|
||||
extraSpecialArgs ? {},
|
||||
modules ? [],
|
||||
# deprecated
|
||||
extraModules ? [],
|
||||
configuration ? {},
|
||||
}: let
|
||||
inherit (pkgs) vimPlugins;
|
||||
inherit (lib.strings) isString toString;
|
||||
|
@ -13,13 +16,25 @@ inputs: {
|
|||
# import modules.nix with `check`, `pkgs` and `lib` as arguments
|
||||
# check can be disabled while calling this file is called
|
||||
# to avoid checking in all modules
|
||||
nvimModules = import ./modules.nix {inherit pkgs check lib;};
|
||||
nvimModules = import ./modules.nix {inherit pkgs lib;};
|
||||
|
||||
# evaluate the extended library with the modules
|
||||
# optionally with any additional modules passed by the user
|
||||
module = lib.evalModules {
|
||||
specialArgs = extraSpecialArgs // {modulesPath = toString ./.;};
|
||||
modules = concatLists [[configuration] nvimModules extraModules];
|
||||
modules = concatLists [
|
||||
nvimModules
|
||||
modules
|
||||
(lib.optional (configuration != {}) (lib.warn ''
|
||||
nvf: passing 'configuration' to lib.neovimConfiguration is deprecated.
|
||||
''
|
||||
configuration))
|
||||
|
||||
(lib.optionals (extraModules != []) (lib.warn ''
|
||||
nvf: passing 'extraModules' to lib.neovimConfiguration is deprecated, use 'modules' instead.
|
||||
''
|
||||
extraModules))
|
||||
];
|
||||
};
|
||||
|
||||
# alias to the internal configuration
|
||||
|
@ -69,10 +84,7 @@ inputs: {
|
|||
|
||||
# built (or "normalized") plugins that are modified
|
||||
builtStartPlugins = buildConfigPlugins vimOptions.startPlugins;
|
||||
builtOptPlugins = map (package: {
|
||||
plugin = package;
|
||||
optional = true;
|
||||
}) (buildConfigPlugins vimOptions.optPlugins);
|
||||
builtOptPlugins = map (package: package // {optional = true;}) (buildConfigPlugins vimOptions.optPlugins);
|
||||
|
||||
# additional Lua and Python3 packages, mapped to their respective functions
|
||||
# to conform to the format mnw expects. end user should
|
||||
|
|
|
@ -7,5 +7,12 @@ in {
|
|||
Tidalcycles language support has been removed as of 2024-06-06 as it was long unmaintained. If
|
||||
you depended on this functionality, please open an issue.
|
||||
'')
|
||||
|
||||
# 2024-07-20
|
||||
(mkRemovedOptionModule ["vim" "lsp" "nvimCodeActionMenu"] ''
|
||||
nvimCodeActionMenu has been deprecated and removed upstream. As of 0.7, fastaction will be
|
||||
available under `vim.ui.fastaction` as a replacement. Simply remove everything under
|
||||
`vim.lsp.nvimCodeActionMenu`, and set `vim.ui.fastaction.enable` to `true`.
|
||||
'')
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,77 +1,73 @@
|
|||
{
|
||||
check ? true,
|
||||
pkgs,
|
||||
lib,
|
||||
}: let
|
||||
inherit (lib.modules) mkDefault;
|
||||
inherit (lib.lists) concatLists;
|
||||
allModules = let
|
||||
# The core neovim modules.
|
||||
# Contains configuration for core neovim features
|
||||
# such as spellchecking, mappings, and the init script (init.vim).
|
||||
neovim = map (p: ./neovim + "/${p}") [
|
||||
"init"
|
||||
"mappings"
|
||||
];
|
||||
|
||||
# The core neovim modules.
|
||||
# Contains configuration for core neovim features
|
||||
# such as spellchecking, mappings, and the init script (init.vim).
|
||||
neovim = map (p: ./neovim + "/${p}") [
|
||||
"init"
|
||||
"mappings"
|
||||
];
|
||||
# Individual plugin modules, separated by the type of plugin.
|
||||
# While adding a new type, you must make sure your type is
|
||||
# included in the list below.
|
||||
plugins = map (p: ./plugins + "/${p}") [
|
||||
"assistant"
|
||||
"autopairs"
|
||||
"comments"
|
||||
"completion"
|
||||
"dashboard"
|
||||
"debugger"
|
||||
"filetree"
|
||||
"git"
|
||||
"languages"
|
||||
"lsp"
|
||||
"minimap"
|
||||
"notes"
|
||||
"projects"
|
||||
"rich-presence"
|
||||
"session"
|
||||
"snippets"
|
||||
# "spellcheck" # FIXME: see neovim/init/spellcheck.nix
|
||||
"statusline"
|
||||
"tabline"
|
||||
"terminal"
|
||||
"theme"
|
||||
"treesitter"
|
||||
"ui"
|
||||
"utility"
|
||||
"visuals"
|
||||
];
|
||||
|
||||
# Individual plugin modules, separated by the type of plugin.
|
||||
# While adding a new type, you must make sure your type is
|
||||
# included in the list below.
|
||||
plugins = map (p: ./plugins + "/${p}") [
|
||||
"assistant"
|
||||
"autopairs"
|
||||
"comments"
|
||||
"completion"
|
||||
"dashboard"
|
||||
"debugger"
|
||||
"filetree"
|
||||
"git"
|
||||
"languages"
|
||||
"lsp"
|
||||
"minimap"
|
||||
"notes"
|
||||
"projects"
|
||||
"rich-presence"
|
||||
"session"
|
||||
"snippets"
|
||||
# "spellcheck" # FIXME: see neovim/init/spellcheck.nix
|
||||
"statusline"
|
||||
"tabline"
|
||||
"terminal"
|
||||
"theme"
|
||||
"treesitter"
|
||||
"ui"
|
||||
"utility"
|
||||
"visuals"
|
||||
];
|
||||
# The neovim wrapper, used to build a wrapped neovim package
|
||||
# using the configuration passed in `neovim` and `plugins` modules.
|
||||
wrapper = map (p: ./wrapper + "/${p}") [
|
||||
"build"
|
||||
"rc"
|
||||
"warnings"
|
||||
"lazy"
|
||||
];
|
||||
|
||||
# The neovim wrapper, used to build a wrapped neovim package
|
||||
# using the configuration passed in `neovim` and `plugins` modules.
|
||||
wrapper = map (p: ./wrapper + "/${p}") [
|
||||
"build"
|
||||
"rc"
|
||||
"warnings"
|
||||
];
|
||||
|
||||
# Extra modules, such as deprecation warnings
|
||||
# or renames in one place.
|
||||
extra = map (p: ./extra + "/${p}") [
|
||||
"deprecations.nix"
|
||||
];
|
||||
|
||||
allModules = concatLists [neovim plugins wrapper extra];
|
||||
|
||||
pkgsModule = {config, ...}: {
|
||||
config = {
|
||||
_module = {
|
||||
inherit check;
|
||||
args = {
|
||||
baseModules = allModules;
|
||||
pkgsPath = mkDefault pkgs.path;
|
||||
pkgs = mkDefault pkgs;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
# Extra modules, such as deprecation warnings
|
||||
# or renames in one place.
|
||||
extra = map (p: ./extra + "/${p}") [
|
||||
"deprecations.nix"
|
||||
];
|
||||
in
|
||||
concatLists [neovim plugins wrapper extra];
|
||||
in
|
||||
allModules ++ [pkgsModule]
|
||||
allModules
|
||||
++ [
|
||||
{
|
||||
_module.args = {
|
||||
baseModules = allModules;
|
||||
pkgsPath = mkDefault pkgs.path;
|
||||
pkgs = mkDefault pkgs;
|
||||
};
|
||||
}
|
||||
]
|
||||
|
|
|
@ -3,11 +3,13 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption literalExpression;
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression literalMD;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.types) enum bool str int;
|
||||
inherit (lib.types) enum bool str int either;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.types) luaInline;
|
||||
|
||||
cfg = config.vim;
|
||||
in {
|
||||
|
@ -158,112 +160,138 @@ in {
|
|||
default = "sensitive";
|
||||
description = "Set the case sensitivity of search";
|
||||
};
|
||||
|
||||
undoFile = {
|
||||
enable = mkEnableOption "undofile for persistent undo behaviour";
|
||||
path = mkOption {
|
||||
type = either str luaInline;
|
||||
default = mkLuaInline "vim.fn.stdpath('state') .. '/undo'";
|
||||
defaultText = literalMD ''
|
||||
```nix
|
||||
mkLuaInline "vim.fn.stdpath('state') .. '/undo'"
|
||||
```
|
||||
'';
|
||||
example = literalMD ''
|
||||
```nix
|
||||
mkLuaInline "os.getenv('XDG_DATA_HOME') .. '/nvf/undo'"
|
||||
```
|
||||
'';
|
||||
description = "Path to the directory in which undo history will be stored";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config.vim.luaConfigRC.basic = entryAfter ["globalsScript"] ''
|
||||
-- Settings that are set for everything
|
||||
vim.o.encoding = "utf-8"
|
||||
vim.o.hidden = true
|
||||
vim.opt.shortmess:append("c")
|
||||
vim.o.expandtab = true
|
||||
vim.o.mouse = ${toLuaObject cfg.mouseSupport}
|
||||
vim.o.tabstop = ${toLuaObject cfg.tabWidth}
|
||||
vim.o.shiftwidth = ${toLuaObject cfg.tabWidth}
|
||||
vim.o.softtabstop = ${toLuaObject cfg.tabWidth}
|
||||
vim.o.cmdheight = ${toLuaObject cfg.cmdHeight}
|
||||
vim.o.updatetime = ${toLuaObject cfg.updateTime}
|
||||
vim.o.tm = ${toLuaObject cfg.mapTimeout}
|
||||
vim.o.cursorlineopt = ${toLuaObject cfg.cursorlineOpt}
|
||||
vim.o.scrolloff = ${toLuaObject cfg.scrollOffset}
|
||||
vim.g.mapleader = ${toLuaObject cfg.leaderKey}
|
||||
vim.g.maplocalleader = ${toLuaObject cfg.leaderKey}
|
||||
config = {
|
||||
vim.luaConfigRC.basic = entryAfter ["globalsScript"] ''
|
||||
-- Settings that are set for everything
|
||||
vim.o.encoding = "utf-8"
|
||||
vim.o.hidden = true
|
||||
vim.opt.shortmess:append("c")
|
||||
vim.o.expandtab = true
|
||||
vim.o.mouse = ${toLuaObject cfg.mouseSupport}
|
||||
vim.o.tabstop = ${toLuaObject cfg.tabWidth}
|
||||
vim.o.shiftwidth = ${toLuaObject cfg.tabWidth}
|
||||
vim.o.softtabstop = ${toLuaObject cfg.tabWidth}
|
||||
vim.o.cmdheight = ${toLuaObject cfg.cmdHeight}
|
||||
vim.o.updatetime = ${toLuaObject cfg.updateTime}
|
||||
vim.o.tm = ${toLuaObject cfg.mapTimeout}
|
||||
vim.o.cursorlineopt = ${toLuaObject cfg.cursorlineOpt}
|
||||
vim.o.scrolloff = ${toLuaObject cfg.scrollOffset}
|
||||
vim.g.mapleader = ${toLuaObject cfg.leaderKey}
|
||||
vim.g.maplocalleader = ${toLuaObject cfg.leaderKey}
|
||||
|
||||
${optionalString cfg.splitBelow ''
|
||||
vim.o.splitbelow = true
|
||||
''}
|
||||
${optionalString cfg.undoFile.enable ''
|
||||
vim.o.undofile = true
|
||||
vim.o.undodir = ${toLuaObject cfg.undoFile.path}
|
||||
''}
|
||||
|
||||
${optionalString cfg.splitRight ''
|
||||
vim.o.splitright = true
|
||||
''}
|
||||
${optionalString cfg.splitBelow ''
|
||||
vim.o.splitbelow = true
|
||||
''}
|
||||
|
||||
${optionalString cfg.showSignColumn ''
|
||||
vim.o.signcolumn = "yes"
|
||||
''}
|
||||
${optionalString cfg.splitRight ''
|
||||
vim.o.splitright = true
|
||||
''}
|
||||
|
||||
${optionalString cfg.autoIndent ''
|
||||
vim.o.autoindent = true
|
||||
''}
|
||||
${optionalString cfg.showSignColumn ''
|
||||
vim.o.signcolumn = "yes"
|
||||
''}
|
||||
|
||||
${optionalString cfg.preventJunkFiles ''
|
||||
vim.o.swapfile = false
|
||||
vim.o.backup = false
|
||||
vim.o.writebackup = false
|
||||
''}
|
||||
${optionalString cfg.autoIndent ''
|
||||
vim.o.autoindent = true
|
||||
''}
|
||||
|
||||
${optionalString (cfg.bell == "none") ''
|
||||
vim.o.errorbells = false
|
||||
vim.o.visualbell = false
|
||||
''}
|
||||
${optionalString cfg.preventJunkFiles ''
|
||||
vim.o.swapfile = false
|
||||
vim.o.backup = false
|
||||
vim.o.writebackup = false
|
||||
''}
|
||||
|
||||
${optionalString (cfg.bell == "on") ''
|
||||
vim.o.visualbell = false
|
||||
''}
|
||||
${optionalString (cfg.bell == "none") ''
|
||||
vim.o.errorbells = false
|
||||
vim.o.visualbell = false
|
||||
''}
|
||||
|
||||
${optionalString (cfg.bell == "visual") ''
|
||||
vim.o.errorbells = false
|
||||
''}
|
||||
${optionalString (cfg.bell == "on") ''
|
||||
vim.o.visualbell = false
|
||||
''}
|
||||
|
||||
${optionalString (cfg.lineNumberMode == "relative") ''
|
||||
vim.o.relativenumber = true
|
||||
''}
|
||||
${optionalString (cfg.bell == "visual") ''
|
||||
vim.o.errorbells = false
|
||||
''}
|
||||
|
||||
${optionalString (cfg.lineNumberMode == "number") ''
|
||||
vim.o.number = true
|
||||
''}
|
||||
${optionalString (cfg.lineNumberMode == "relative") ''
|
||||
vim.o.relativenumber = true
|
||||
''}
|
||||
|
||||
${optionalString (cfg.lineNumberMode == "relNumber") ''
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
''}
|
||||
${optionalString (cfg.lineNumberMode == "number") ''
|
||||
vim.o.number = true
|
||||
''}
|
||||
|
||||
${optionalString cfg.useSystemClipboard ''
|
||||
vim.opt.clipboard:append("unnamedplus")
|
||||
''}
|
||||
${optionalString (cfg.lineNumberMode == "relNumber") ''
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
''}
|
||||
|
||||
${optionalString cfg.syntaxHighlighting ''
|
||||
vim.cmd("syntax on")
|
||||
''}
|
||||
${optionalString cfg.useSystemClipboard ''
|
||||
vim.opt.clipboard:append("unnamedplus")
|
||||
''}
|
||||
|
||||
${optionalString (!cfg.wordWrap) ''
|
||||
vim.o.wrap = false
|
||||
''}
|
||||
${optionalString cfg.syntaxHighlighting ''
|
||||
vim.cmd("syntax on")
|
||||
''}
|
||||
|
||||
${optionalString cfg.hideSearchHighlight ''
|
||||
vim.o.hlsearch = false
|
||||
vim.o.incsearch = true
|
||||
''}
|
||||
${optionalString (!cfg.wordWrap) ''
|
||||
vim.o.wrap = false
|
||||
''}
|
||||
|
||||
${optionalString cfg.colourTerm ''
|
||||
vim.o.termguicolors = true
|
||||
''}
|
||||
${optionalString cfg.hideSearchHighlight ''
|
||||
vim.o.hlsearch = false
|
||||
vim.o.incsearch = true
|
||||
''}
|
||||
|
||||
${optionalString (!cfg.enableEditorconfig) ''
|
||||
vim.g.editorconfig = false
|
||||
''}
|
||||
${optionalString cfg.colourTerm ''
|
||||
vim.o.termguicolors = true
|
||||
''}
|
||||
|
||||
${optionalString (cfg.searchCase == "ignore") ''
|
||||
vim.o.smartcase = false
|
||||
vim.o.ignorecase = true
|
||||
''}
|
||||
${optionalString (!cfg.enableEditorconfig) ''
|
||||
vim.g.editorconfig = false
|
||||
''}
|
||||
|
||||
${optionalString (cfg.searchCase == "smart") ''
|
||||
vim.o.smartcase = true
|
||||
vim.o.ignorecase = true
|
||||
''}
|
||||
${optionalString (cfg.searchCase == "ignore") ''
|
||||
vim.o.smartcase = false
|
||||
vim.o.ignorecase = true
|
||||
''}
|
||||
|
||||
${optionalString (cfg.searchCase == "sensitive") ''
|
||||
vim.o.smartcase = false
|
||||
vim.o.ignorecase = false
|
||||
''}
|
||||
'';
|
||||
${optionalString (cfg.searchCase == "smart") ''
|
||||
vim.o.smartcase = true
|
||||
vim.o.ignorecase = true
|
||||
''}
|
||||
|
||||
${optionalString (cfg.searchCase == "sensitive") ''
|
||||
vim.o.smartcase = false
|
||||
vim.o.ignorecase = false
|
||||
''}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,45 +8,26 @@
|
|||
cfg = config.vim;
|
||||
in {
|
||||
config = {
|
||||
vim.maps = {
|
||||
normal = mkIf cfg.disableArrows {
|
||||
"<up>" = {
|
||||
action = "<nop>";
|
||||
|
||||
noremap = false;
|
||||
};
|
||||
"<down>" = {
|
||||
action = "<nop>";
|
||||
|
||||
noremap = false;
|
||||
};
|
||||
"<left>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
"<right>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
vim.maps = mkIf cfg.disableArrows {
|
||||
"<up>" = {
|
||||
mode = ["n" "i"];
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
|
||||
insert = mkIf cfg.disableArrows {
|
||||
"<up>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
"<down>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
"<left>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
"<right>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
"<down>" = {
|
||||
mode = ["n" "i"];
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
"<left>" = {
|
||||
mode = ["n" "i"];
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
"<right>" = {
|
||||
mode = ["n" "i"];
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,61 +1,52 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) bool str attrsOf nullOr submodule;
|
||||
inherit (lib.types) either str listOf attrsOf nullOr submodule bool;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
# 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.";
|
||||
};
|
||||
|
||||
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 =
|
||||
mapConfigOptions
|
||||
// {
|
||||
action = mkOption {
|
||||
type = str;
|
||||
description = "The action to execute.";
|
||||
};
|
||||
|
||||
lua = mkOption {
|
||||
type = bool;
|
||||
mode = mkOption {
|
||||
type = either str (listOf str);
|
||||
description = ''
|
||||
If true, `action` is considered to be lua code.
|
||||
Thus, it will not be wrapped in `""`.
|
||||
The short-name of the mode to set the keymapping for. Passing an empty string is the equivalent of `:map`.
|
||||
|
||||
See `:help map-modes` for a list of modes.
|
||||
'';
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# legacy stuff
|
||||
mapOption = submodule {
|
||||
options = mapConfigOptions;
|
||||
};
|
||||
|
||||
mapOptions = mode:
|
||||
mkOption {
|
||||
description = "Mappings for ${mode} mode";
|
||||
|
@ -66,6 +57,7 @@ in {
|
|||
options.vim = {
|
||||
maps = mkOption {
|
||||
type = submodule {
|
||||
freeformType = attrsOf mapType;
|
||||
options = {
|
||||
normal = mapOptions "normal";
|
||||
insert = mapOptions "insert";
|
||||
|
@ -82,15 +74,11 @@ in {
|
|||
};
|
||||
};
|
||||
default = {};
|
||||
description = ''
|
||||
Custom keybindings for any mode.
|
||||
|
||||
For plain maps (e.g. just 'map' or 'remap') use `maps.normalVisualOp`.
|
||||
'';
|
||||
|
||||
description = "Custom keybindings.";
|
||||
example = ''
|
||||
maps = {
|
||||
normal."<leader>m" = {
|
||||
"<leader>m" = {
|
||||
mode = "n";
|
||||
silent = true;
|
||||
action = "<cmd>make<CR>";
|
||||
}; # Same as nnoremap <leader>m <silent> <cmd>make<CR>
|
||||
|
|
|
@ -5,16 +5,17 @@
|
|||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.dashboard.dashboard-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
"dashboard-nvim"
|
||||
];
|
||||
vim = {
|
||||
startPlugins = ["dashboard-nvim"];
|
||||
|
||||
vim.pluginRC.dashboard-nvim = entryAnywhere ''
|
||||
require("dashboard").setup{}
|
||||
'';
|
||||
pluginRC.dashboard-nvim = entryAnywhere ''
|
||||
require("dashboard").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.dashboard.dashboard-nvim = {
|
||||
enable = mkEnableOption "Fancy and Blazing Fast start screen plugin of neovim [dashboard.nvim]";
|
||||
setupOpts = mkPluginSetupOption "dashboard.nvim" {};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) filter;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.binds) mkBinding;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) mkLznBinding;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.binds) pushDownDefault;
|
||||
|
||||
cfg = config.vim.filetree.nvimTree;
|
||||
|
@ -16,19 +16,28 @@
|
|||
inherit (self.options.vim.filetree.nvimTree) mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["nvim-tree-lua"];
|
||||
|
||||
vim.maps.normal = mkMerge [
|
||||
(mkBinding cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description)
|
||||
(mkBinding cfg.mappings.refresh ":NvimTreeRefresh<cr>" mappings.refresh.description)
|
||||
(mkBinding cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description)
|
||||
(mkBinding cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description)
|
||||
];
|
||||
|
||||
vim.binds.whichKey.register = pushDownDefault {
|
||||
"<leader>t" = "+NvimTree";
|
||||
};
|
||||
|
||||
vim.lazy = {
|
||||
plugins = [
|
||||
{
|
||||
package = "nvim-tree-lua";
|
||||
setupModule = "nvim-tree";
|
||||
inherit (cfg) setupOpts;
|
||||
cmd = ["NvimTreeClipboard" "NvimTreeClose" "NvimTreeCollapse" "NvimTreeCollapseKeepBuffers" "NvimTreeFindFile" "NvimTreeFindFileToggle" "NvimTreeFocus" "NvimTreeHiTest" "NvimTreeOpen" "NvimTreeRefresh" "NvimTreeResize" "NvimTreeToggle"];
|
||||
|
||||
keys = filter ({key, ...}: key != null) [
|
||||
(mkLznBinding ["n"] cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description)
|
||||
(mkLznBinding ["n"] cfg.mappings.refresh ":NvimTreeRefresh<cr>" mappings.refresh.description)
|
||||
(mkLznBinding ["n"] cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description)
|
||||
(mkLznBinding ["n"] cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description)
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
vim.pluginRC.nvimtreelua = entryAnywhere ''
|
||||
${
|
||||
optionalString cfg.setupOpts.disable_netrw ''
|
||||
|
@ -38,10 +47,9 @@ in {
|
|||
''
|
||||
}
|
||||
|
||||
require'nvim-tree'.setup(${toLuaObject cfg.setupOpts})
|
||||
|
||||
${
|
||||
optionalString cfg.openOnSetup ''
|
||||
require('lz.n').trigger_load("nvim-tree-lua")
|
||||
-- autostart behaviour
|
||||
-- Open on startup has been deprecated
|
||||
-- see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
dapConfig = ''
|
||||
dap.adapters.lldb = {
|
||||
type = 'executable',
|
||||
command = '${cfg.dap.package}/bin/lldb-vscode',
|
||||
command = '${cfg.dap.package}/bin/lldb-dap',
|
||||
name = 'lldb'
|
||||
}
|
||||
dap.configurations.cpp = {
|
||||
|
|
|
@ -17,6 +17,7 @@ in {
|
|||
./ocaml.nix
|
||||
./php.nix
|
||||
./python.nix
|
||||
./r.nix
|
||||
./rust.nix
|
||||
./sql.nix
|
||||
./svelte.nix
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
cfg = config.vim.languages.python;
|
||||
|
||||
defaultServer = "pyright";
|
||||
defaultServer = "basedpyright";
|
||||
servers = {
|
||||
pyright = {
|
||||
package = pkgs.pyright;
|
||||
|
@ -30,6 +30,36 @@
|
|||
}
|
||||
'';
|
||||
};
|
||||
|
||||
basedpyright = {
|
||||
package = pkgs.basedpyright;
|
||||
lspConfig = ''
|
||||
lspconfig.basedpyright.setup{
|
||||
capabilities = capabilities;
|
||||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/basedpyright-langserver", "--stdio"}''
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
python-lsp-server = {
|
||||
package = pkgs.python-lsp-server;
|
||||
lspConfig = ''
|
||||
lspconfig.pylsp.setup{
|
||||
capabilities = capabilities;
|
||||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/pylsp"}''
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
defaultFormat = "black";
|
||||
|
@ -61,11 +91,12 @@
|
|||
black-and-isort = {
|
||||
package = pkgs.writeShellApplication {
|
||||
name = "black";
|
||||
runtimeInputs = [pkgs.black pkgs.isort];
|
||||
text = ''
|
||||
black --quiet - "$@" | isort --profile black -
|
||||
'';
|
||||
runtimeInputs = [pkgs.black pkgs.isort];
|
||||
};
|
||||
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
|
|
78
modules/plugins/languages/r.nix
Normal file
78
modules/plugins/languages/r.nix
Normal file
|
@ -0,0 +1,78 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.r;
|
||||
|
||||
r-with-languageserver = pkgs.rWrapper.override {
|
||||
packages = with pkgs.rPackages; [languageserver];
|
||||
};
|
||||
|
||||
defaultServer = "r_language_server";
|
||||
servers = {
|
||||
r_language_server = {
|
||||
package = pkgs.writeShellScriptBin "r_lsp" ''
|
||||
${r-with-languageserver}/bin/R --slave -e "languageserver::run()"
|
||||
'';
|
||||
lspConfig = ''
|
||||
lspconfig.r_language_server.setup{
|
||||
capabilities = capabilities;
|
||||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${lib.getExe cfg.lsp.package}"}''
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.r = {
|
||||
enable = mkEnableOption "R language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "R treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "r";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "R LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
server = mkOption {
|
||||
description = "R LSP server to use";
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "R LSP server package, or the command to run as a list of strings";
|
||||
example = literalExpression "[ (lib.getExe pkgs.jdt-language-server) \"-data\" \"~/.cache/jdtls/workspace\" ]";
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.r-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
]);
|
||||
}
|
|
@ -173,7 +173,7 @@ in {
|
|||
dap = {
|
||||
adapter = {
|
||||
type = "executable",
|
||||
command = "${cfg.dap.package}/bin/lldb-vscode",
|
||||
command = "${cfg.dap.package}/bin/lldb-dap",
|
||||
name = "rustacean_lldb",
|
||||
},
|
||||
},
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
cfg = config.vim.languages.ts;
|
||||
|
||||
defaultServer = "tsserver";
|
||||
defaultServer = "ts_ls";
|
||||
servers = {
|
||||
tsserver = {
|
||||
ts_ls = {
|
||||
package = pkgs.typescript-language-server;
|
||||
lspConfig = ''
|
||||
lspconfig.tsserver.setup {
|
||||
lspconfig.ts_ls.setup {
|
||||
capabilities = capabilities;
|
||||
on_attach = attach_keymaps,
|
||||
cmd = ${
|
||||
|
@ -49,6 +49,24 @@
|
|||
}
|
||||
'';
|
||||
};
|
||||
|
||||
# Here for backwards compatibility. Still consider tsserver a valid
|
||||
# configuration in the enum, but assert if it's set to *properly*
|
||||
# redirect the user to the correct server.
|
||||
tsserver = {
|
||||
package = pkgs.typescript-language-server;
|
||||
lspConfig = ''
|
||||
lspconfig.ts_ls.setup {
|
||||
capabilities = capabilities;
|
||||
on_attach = attach_keymaps,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/typescript-language-server", "--stdio"}''
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: specify packages
|
||||
|
@ -65,6 +83,7 @@
|
|||
)
|
||||
'';
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
package = pkgs.prettierd;
|
||||
nullConfig = ''
|
||||
|
@ -94,6 +113,7 @@
|
|||
};
|
||||
};
|
||||
in {
|
||||
_file = ./ts.nix;
|
||||
options.vim.languages.ts = {
|
||||
enable = mkEnableOption "Typescript/Javascript language support";
|
||||
|
||||
|
@ -190,11 +210,32 @@ in {
|
|||
};
|
||||
})
|
||||
|
||||
# Extensions
|
||||
(mkIf cfg.extensions."ts-error-translator".enable {
|
||||
vim.startPlugins = ["ts-error-translator"];
|
||||
vim.pluginRC.ts-error-translator = entryAnywhere ''
|
||||
require("ts-error-translator").setup(${toLuaObject cfg.extensions.ts-error-translator.setupOpts})
|
||||
'';
|
||||
})
|
||||
|
||||
# Warn the user if they have set the default server name to tsserver to match upstream (us)
|
||||
# The name "tsserver" has been deprecated in lspconfig, and now should be called ts_ls. This
|
||||
# is a purely cosmetic change, but emits a warning if not accounted for.
|
||||
{
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.lsp.enable -> cfg.lsp.server != "tsserver";
|
||||
message = ''
|
||||
As of a recent lspconfig update, the `tsserver` configuration has been renamed
|
||||
to `ts_ls` to match upstream behaviour of `lspconfig`, and the name `tsserver`
|
||||
is no longer considered valid by nvf. Please set `vim.languages.ts.lsp.server`
|
||||
to `"ts_ls"` instead of to `${cfg.lsp.server}`
|
||||
|
||||
Please see <https://github.com/neovim/nvim-lspconfig/pull/3232> for more details
|
||||
about this change.
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
# lsp plugins
|
||||
./lspsaga
|
||||
./nvim-code-action-menu
|
||||
./trouble
|
||||
./lsp-signature
|
||||
./lightbulb
|
||||
./otter
|
||||
./lspkind
|
||||
./lsplines
|
||||
./nvim-docs-view
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.attrsets) mapAttrs;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
in {
|
||||
|
@ -22,7 +23,7 @@ in {
|
|||
|
||||
${
|
||||
optionalString config.vim.ui.borders.enable ''
|
||||
require('lspconfig.ui.windows').default_options.border = '${config.vim.ui.borders.globalStyle}'
|
||||
require('lspconfig.ui.windows').default_options.border = ${toLuaObject config.vim.ui.borders.globalStyle}
|
||||
''
|
||||
}
|
||||
'';
|
||||
|
|
|
@ -36,7 +36,7 @@ in {
|
|||
(mkSetLuaBinding mappings.nextDiagnostic "require('lspsaga.diagnostic').navigate('next')")
|
||||
(mkSetLuaBinding mappings.previousDiagnostic "require('lspsaga.diagnostic').navigate('prev')")
|
||||
|
||||
(mkIf (!cfg.nvimCodeActionMenu.enable) (mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action"))
|
||||
(mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action")
|
||||
(mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help"))
|
||||
];
|
||||
};
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings pushDownDefault;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
|
||||
self = import ./nvim-code-action-menu.nix {inherit lib;};
|
||||
mappingDefinitions = self.options.vim.lsp.nvimCodeActionMenu.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.nvimCodeActionMenu.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf (cfg.enable && cfg.nvimCodeActionMenu.enable) {
|
||||
vim = {
|
||||
startPlugins = ["nvim-code-action-menu"];
|
||||
|
||||
maps.normal = mkSetBinding mappings.open ":CodeActionMenu<CR>";
|
||||
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>c" = "+CodeAction";
|
||||
};
|
||||
|
||||
pluginRC.code-action-menu = entryAnywhere ''
|
||||
-- border configuration
|
||||
vim.g.code_action_menu_window_border = '${config.vim.ui.borders.plugins.code-action-menu.style}'
|
||||
|
||||
-- show individual sections of the code action menu
|
||||
${lib.optionalString cfg.nvimCodeActionMenu.show.details "vim.g.code_action_menu_show_details = true"}
|
||||
${lib.optionalString cfg.nvimCodeActionMenu.show.diff "vim.g.code_action_menu_show_diff = true"}
|
||||
${lib.optionalString cfg.nvimCodeActionMenu.show.actionKind "vim.g.code_action_menu_show_action_kind = true"}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options.vim.lsp = {
|
||||
nvimCodeActionMenu = {
|
||||
enable = mkEnableOption "nvim code action menu";
|
||||
|
||||
show = {
|
||||
details = mkEnableOption "Show details" // {default = true;};
|
||||
diff = mkEnableOption "Show diff" // {default = true;};
|
||||
actionKind = mkEnableOption "Show action kind" // {default = true;};
|
||||
};
|
||||
|
||||
mappings = {
|
||||
open = mkMappingOption "Open code action menu [nvim-code-action-menu]" "<leader>ca";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
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}})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./nvim-code-action-menu.nix
|
||||
./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.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -11,7 +11,7 @@
|
|||
inherit (lib.generators) mkLuaInline;
|
||||
|
||||
cfg = config.vim.statusline.lualine;
|
||||
breadcrumbsCfg = config.vim.ui.breadcrumbs;
|
||||
bCfg = config.vim.ui.breadcrumbs;
|
||||
in {
|
||||
config = mkMerge [
|
||||
# TODO: move into nvim-tree file
|
||||
|
@ -20,13 +20,14 @@ in {
|
|||
extensions = ["nvim-tree"];
|
||||
};
|
||||
})
|
||||
(mkIf (breadcrumbsCfg.enable && breadcrumbsCfg.source == "nvim-navic") {
|
||||
|
||||
(mkIf (bCfg.enable && bCfg.lualine.winbar.enable && bCfg.source == "nvim-navic") {
|
||||
vim.statusline.lualine.setupOpts = {
|
||||
# TODO: rewrite in new syntax
|
||||
winbar.lualine_c = mkDefault [
|
||||
[
|
||||
"navic"
|
||||
(mkLuaInline "draw_empty = ${boolToString config.vim.ui.breadcrumbs.alwaysRender}")
|
||||
(mkLuaInline "draw_empty = ${boolToString bCfg.lualine.winbar.alwaysRender}")
|
||||
]
|
||||
];
|
||||
};
|
||||
|
@ -34,7 +35,6 @@ in {
|
|||
(mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["lualine"];
|
||||
|
||||
pluginRC.lualine = entryAnywhere ''
|
||||
local lualine = require('lualine')
|
||||
lualine.setup ${toLuaObject cfg.setupOpts}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
inherit (lib.trivial) boolToString warnIf;
|
||||
in {
|
||||
onedark = {
|
||||
setup = {style ? "dark"}: ''
|
||||
setup = {style ? "dark", ...}: ''
|
||||
-- OneDark theme
|
||||
require('onedark').setup {
|
||||
style = "${style}"
|
||||
|
@ -30,7 +30,7 @@ in {
|
|||
};
|
||||
|
||||
dracula = {
|
||||
setup = {transparent}: ''
|
||||
setup = {transparent, ...}: ''
|
||||
require('dracula').setup({
|
||||
transparent_bg = ${boolToString transparent},
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
inherit (lib.attrsets) attrNames;
|
||||
inherit (lib.types) bool lines enum;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
inherit (lib.nvim.dag) entryBefore;
|
||||
|
||||
cfg = config.vim.theme;
|
||||
supportedThemes = import ./supported-themes.nix {
|
||||
|
@ -45,7 +45,7 @@ in {
|
|||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [cfg.name];
|
||||
luaConfigRC.theme = entryAfter ["basic"] ''
|
||||
luaConfigRC.theme = entryBefore ["pluginConfigs"] ''
|
||||
${cfg.extraConfig}
|
||||
${supportedThemes.${cfg.name}.setup {inherit (cfg) style transparent;}}
|
||||
'';
|
||||
|
|
|
@ -4,31 +4,34 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.lists) optionals;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.nvim.types) borderType;
|
||||
|
||||
cfg = config.vim.ui.borders;
|
||||
|
||||
defaultStyles = ["none" "single" "double" "rounded"];
|
||||
in {
|
||||
options.vim.ui.borders = {
|
||||
enable = mkEnableOption "visible borders for most windows";
|
||||
|
||||
globalStyle = mkOption {
|
||||
type = enum defaultStyles;
|
||||
type = borderType;
|
||||
default = "rounded";
|
||||
description = ''
|
||||
The global border style to use.
|
||||
|
||||
If a list is given, it should have a length of eight or any divisor of
|
||||
eight. The array will specify the eight chars building up the border in
|
||||
a clockwise fashion starting with the top-left corner. You can specify
|
||||
a different highlight group for each character by passing a
|
||||
[char, "YourHighlightGroup"] instead
|
||||
'';
|
||||
example = ["╔" "═" "╗" "║" "╝" "═" "╚" "║"];
|
||||
};
|
||||
|
||||
# TODO: make per-plugin borders configurable
|
||||
plugins = let
|
||||
mkPluginStyleOption = name: {
|
||||
enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;};
|
||||
|
||||
style = mkOption {
|
||||
type = enum (defaultStyles ++ optionals (name != "which-key") ["shadow"]);
|
||||
type = borderType;
|
||||
default = cfg.globalStyle;
|
||||
description = "The border style to use for the ${name} plugin";
|
||||
};
|
||||
|
@ -40,7 +43,7 @@ in {
|
|||
lspsaga = mkPluginStyleOption "lspsaga";
|
||||
nvim-cmp = mkPluginStyleOption "nvim-cmp";
|
||||
lsp-signature = mkPluginStyleOption "lsp-signature";
|
||||
code-action-menu = mkPluginStyleOption "code-actions-menu";
|
||||
fastaction = mkPluginStyleOption "fastaction";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) nullOr listOf enum bool str int;
|
||||
inherit (lib.types) nullOr listOf enum bool str int either;
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption borderType;
|
||||
mkSimpleIconOption = default:
|
||||
mkOption {
|
||||
inherit default;
|
||||
|
@ -31,6 +31,8 @@ in {
|
|||
(renameSetupOpt ["sourceBuffer" "scrolloff"] ["source_buffer" "scrolloff"])
|
||||
# TODO: every option under icon is renamed to first letter capitalized
|
||||
(renameSetupOpt ["icon"] ["icon"])
|
||||
|
||||
(mkRenamedOptionModule ["vim" "ui" "breadcrumbs" "alwaysRender"] ["vim" "ui" "breadcrumbs" "lualine" "winbar" "alwaysRender"])
|
||||
];
|
||||
|
||||
options.vim.ui.breadcrumbs = {
|
||||
|
@ -43,17 +45,43 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
# maybe this should be an option to *disable* alwaysRender optionally but oh well
|
||||
# too late
|
||||
alwaysRender = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether to always display the breadcrumbs component on winbar (always renders winbar)";
|
||||
# Options for configuring Lualine integration of nvim-navic
|
||||
lualine.winbar = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = true; # for retaining previous behaviour
|
||||
example = false;
|
||||
description = ''
|
||||
Whether to automatically configure a winbar component for
|
||||
Lualine on the Winbar section.
|
||||
|
||||
::: {.note}
|
||||
This is **set to `true` by default**, which means nvim-navic
|
||||
will occupy `winbar.lualine_c` for the breadcrumbs feature
|
||||
unless this option is set to `false`.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
alwaysRender = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
example = false;
|
||||
description = ''
|
||||
Whether to always display the breadcrumbs component
|
||||
on winbar.
|
||||
|
||||
::: {.note}
|
||||
This will pass `draw_empty` to the `nvim_navic` winbar
|
||||
component, which causes the component to be drawn even
|
||||
if it's empty
|
||||
:::
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
navbuddy = {
|
||||
enable = mkEnableOption "navbuddy LSP helper UI. Enabling this option automatically loads and enables nvim-navic";
|
||||
|
||||
mappings = {
|
||||
close = mkOption {
|
||||
type = str;
|
||||
|
@ -212,8 +240,7 @@ in {
|
|||
# position = {}
|
||||
|
||||
border = mkOption {
|
||||
# TODO: let this type accept a custom string
|
||||
type = enum ["single" "rounded" "double" "solid" "none"];
|
||||
type = borderType;
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
description = "border style to use";
|
||||
};
|
||||
|
@ -236,8 +263,7 @@ in {
|
|||
*/
|
||||
|
||||
border = mkOption {
|
||||
# TODO: let this type accept a custom string
|
||||
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
|
||||
type = borderType;
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
description = "border style to use for the left section of Navbuddy UI";
|
||||
};
|
||||
|
@ -254,8 +280,7 @@ in {
|
|||
*/
|
||||
|
||||
border = mkOption {
|
||||
# TODO: let this type accept a custom string
|
||||
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
|
||||
type = borderType;
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
description = "border style to use for the middle section of Navbuddy UI";
|
||||
};
|
||||
|
@ -265,8 +290,7 @@ in {
|
|||
# there is no size option for the right section, it fills the remaining space
|
||||
right = {
|
||||
border = mkOption {
|
||||
# TODO: let this type accept a custom string
|
||||
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
|
||||
type = borderType;
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
description = "border style to use for the right section of Navbuddy UI";
|
||||
};
|
||||
|
|
|
@ -8,5 +8,6 @@
|
|||
./illuminate
|
||||
./breadcrumbs
|
||||
./borders
|
||||
./fastaction
|
||||
];
|
||||
}
|
||||
|
|
24
modules/plugins/ui/fastaction/config.nix
Normal file
24
modules/plugins/ui/fastaction/config.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkDefault;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.ui.fastaction;
|
||||
borderCfg = config.vim.ui.borders.plugins.fastaction;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
ui.fastaction.setupOpts = {
|
||||
register_ui_select = mkDefault true;
|
||||
popup.border = mkIf borderCfg.enable borderCfg.style;
|
||||
};
|
||||
|
||||
startPlugins = ["fastaction-nvim"];
|
||||
pluginRC.fastaction = entryAnywhere "require('fastaction').setup(${toLuaObject cfg.setupOpts})";
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/ui/fastaction/default.nix
Normal file
6
modules/plugins/ui/fastaction/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./fastaction-nvim.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
9
modules/plugins/ui/fastaction/fastaction-nvim.nix
Normal file
9
modules/plugins/ui/fastaction/fastaction-nvim.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.ui.fastaction = {
|
||||
enable = mkEnableOption "overriding vim.ui.select with fastaction.nvim";
|
||||
setupOpts = mkPluginSetupOption "fastaction" {};
|
||||
};
|
||||
}
|
|
@ -25,7 +25,7 @@ in {
|
|||
|
||||
${optionalString config.vim.ui.borders.plugins.which-key.enable ''
|
||||
window = {
|
||||
border = "${config.vim.ui.borders.plugins.which-key.style}",
|
||||
border = ${toLuaObject config.vim.ui.borders.plugins.which-key.style},
|
||||
},
|
||||
''}
|
||||
})
|
||||
|
|
|
@ -17,75 +17,78 @@
|
|||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
"telescope"
|
||||
"plenary-nvim"
|
||||
];
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"telescope"
|
||||
"plenary-nvim"
|
||||
];
|
||||
|
||||
vim.maps.normal = mkMerge [
|
||||
(mkSetBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
|
||||
(mkSetBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
|
||||
(mkSetBinding mappings.buffers "<cmd> Telescope buffers<CR>")
|
||||
(mkSetBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
|
||||
(mkSetBinding mappings.open "<cmd> Telescope<CR>")
|
||||
maps.normal = mkMerge [
|
||||
(mkSetBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
|
||||
(mkSetBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
|
||||
(mkSetBinding mappings.buffers "<cmd> Telescope buffers<CR>")
|
||||
(mkSetBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
|
||||
(mkSetBinding mappings.open "<cmd> Telescope<CR>")
|
||||
(mkSetBinding mappings.resume "<cmd> Telescope resume<CR>")
|
||||
|
||||
(mkSetBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
|
||||
(mkSetBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
|
||||
(mkSetBinding mappings.gitBranches "<cmd> Telescope git_branches<CR>")
|
||||
(mkSetBinding mappings.gitStatus "<cmd> Telescope git_status<CR>")
|
||||
(mkSetBinding mappings.gitStash "<cmd> Telescope git_stash<CR>")
|
||||
(mkSetBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
|
||||
(mkSetBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
|
||||
(mkSetBinding mappings.gitBranches "<cmd> Telescope git_branches<CR>")
|
||||
(mkSetBinding mappings.gitStatus "<cmd> Telescope git_status<CR>")
|
||||
(mkSetBinding mappings.gitStash "<cmd> Telescope git_stash<CR>")
|
||||
|
||||
(mkIf config.vim.lsp.enable (mkMerge [
|
||||
(mkSetBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
|
||||
(mkSetBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
|
||||
(mkIf config.vim.lsp.enable (mkMerge [
|
||||
(mkSetBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
|
||||
(mkSetBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
|
||||
|
||||
(mkSetBinding mappings.lspReferences "<cmd> Telescope lsp_references<CR>")
|
||||
(mkSetBinding mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>")
|
||||
(mkSetBinding mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>")
|
||||
(mkSetBinding mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>")
|
||||
(mkSetBinding mappings.diagnostics "<cmd> Telescope diagnostics<CR>")
|
||||
]))
|
||||
(mkSetBinding mappings.lspReferences "<cmd> Telescope lsp_references<CR>")
|
||||
(mkSetBinding mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>")
|
||||
(mkSetBinding mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>")
|
||||
(mkSetBinding mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>")
|
||||
(mkSetBinding mappings.diagnostics "<cmd> Telescope diagnostics<CR>")
|
||||
]))
|
||||
|
||||
(
|
||||
mkIf config.vim.treesitter.enable
|
||||
(mkSetBinding mappings.treesitter "<cmd> Telescope treesitter<CR>")
|
||||
)
|
||||
(
|
||||
mkIf config.vim.treesitter.enable
|
||||
(mkSetBinding mappings.treesitter "<cmd> Telescope treesitter<CR>")
|
||||
)
|
||||
|
||||
(
|
||||
mkIf config.vim.projects.project-nvim.enable
|
||||
(mkSetBinding mappings.findProjects "<cmd Telescope projects<CR>")
|
||||
)
|
||||
];
|
||||
(
|
||||
mkIf config.vim.projects.project-nvim.enable
|
||||
(mkSetBinding mappings.findProjects "<cmd> Telescope projects<CR>")
|
||||
)
|
||||
];
|
||||
|
||||
vim.binds.whichKey.register = pushDownDefault {
|
||||
"<leader>f" = "+Telescope";
|
||||
"<leader>fl" = "Telescope LSP";
|
||||
"<leader>fm" = "Cellular Automaton";
|
||||
"<leader>fv" = "Telescope Git";
|
||||
"<leader>fvc" = "Commits";
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>f" = "+Telescope";
|
||||
"<leader>fl" = "Telescope LSP";
|
||||
"<leader>fm" = "Cellular Automaton";
|
||||
"<leader>fv" = "Telescope Git";
|
||||
"<leader>fvc" = "Commits";
|
||||
};
|
||||
|
||||
pluginRC.telescope = entryAnywhere ''
|
||||
local telescope = require('telescope')
|
||||
telescope.setup(${toLuaObject cfg.setupOpts})
|
||||
|
||||
${
|
||||
if config.vim.ui.noice.enable
|
||||
then "telescope.load_extension('noice')"
|
||||
else ""
|
||||
}
|
||||
|
||||
${
|
||||
if config.vim.notify.nvim-notify.enable
|
||||
then "telescope.load_extension('notify')"
|
||||
else ""
|
||||
}
|
||||
|
||||
${
|
||||
if config.vim.projects.project-nvim.enable
|
||||
then "telescope.load_extension('projects')"
|
||||
else ""
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
vim.pluginRC.telescope = entryAnywhere ''
|
||||
local telescope = require('telescope')
|
||||
telescope.setup(${toLuaObject cfg.setupOpts})
|
||||
|
||||
${
|
||||
if config.vim.ui.noice.enable
|
||||
then "telescope.load_extension('noice')"
|
||||
else ""
|
||||
}
|
||||
|
||||
${
|
||||
if config.vim.notify.nvim-notify.enable
|
||||
then "telescope.load_extension('notify')"
|
||||
else ""
|
||||
}
|
||||
|
||||
${
|
||||
if config.vim.projects.project-nvim.enable
|
||||
then "telescope.load_extension('projects')"
|
||||
else ""
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -150,13 +150,13 @@
|
|||
in {
|
||||
options.vim.telescope = {
|
||||
mappings = {
|
||||
findProjects = mkMappingOption "Find files [Telescope]" "<leader>fp";
|
||||
|
||||
findProjects = mkMappingOption "Find projects [Telescope]" "<leader>fp";
|
||||
findFiles = mkMappingOption "Find files [Telescope]" "<leader>ff";
|
||||
liveGrep = mkMappingOption "Live grep [Telescope]" "<leader>fg";
|
||||
buffers = mkMappingOption "Buffers [Telescope]" "<leader>fb";
|
||||
helpTags = mkMappingOption "Help tags [Telescope]" "<leader>fh";
|
||||
open = mkMappingOption "Open [Telescope]" "<leader>ft";
|
||||
resume = mkMappingOption "Resume (previous search) [Telescope]" "<leader>fr";
|
||||
|
||||
gitCommits = mkMappingOption "Git commits [Telescope]" "<leader>fvcw";
|
||||
gitBufferCommits = mkMappingOption "Git buffer commits [Telescope]" "<leader>fvcb";
|
||||
|
|
|
@ -45,8 +45,6 @@ in {
|
|||
'noice',
|
||||
'NvimTree',
|
||||
'alpha',
|
||||
'code-action-menu-menu',
|
||||
'code-action-menu-warning-message',
|
||||
'notify',
|
||||
'Navbuddy'
|
||||
},
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||
inherit (lib.strings) toUpper;
|
||||
inherit (lib.types) int float bool str enum listOf attrsOf oneOf nullOr submodule;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline borderType;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
in {
|
||||
imports = [
|
||||
|
@ -453,7 +453,7 @@ in {
|
|||
};
|
||||
border = mkOption {
|
||||
description = "Border style of the notification window";
|
||||
type = enum ["none" "single" "double" "rounded" "solid" "shadow"];
|
||||
type = borderType;
|
||||
default =
|
||||
if config.vim.ui.borders.enable
|
||||
then config.vim.ui.borders.globalStyle
|
||||
|
|
85
modules/wrapper/lazy/config.nix
Normal file
85
modules/wrapper/lazy/config.nix
Normal file
|
@ -0,0 +1,85 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) toJSON typeOf head length tryEval;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.attrsets) mapAttrsToList;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryBefore;
|
||||
cfg = config.vim.lazy;
|
||||
|
||||
toLuzLznKeySpec = {
|
||||
desc,
|
||||
noremap,
|
||||
expr,
|
||||
nowait,
|
||||
ft,
|
||||
key,
|
||||
action,
|
||||
lua,
|
||||
mode,
|
||||
}: {
|
||||
"@1" = key;
|
||||
"@2" =
|
||||
if lua
|
||||
then mkLuaInline action
|
||||
else action;
|
||||
inherit desc noremap expr nowait ft mode;
|
||||
};
|
||||
|
||||
toLuaLznSpec = spec: let
|
||||
name =
|
||||
if typeOf spec.package == "string"
|
||||
then spec.package
|
||||
else if (spec.package ? pname && (tryEval spec.package.pname).success)
|
||||
then spec.package.pname
|
||||
else spec.package.name;
|
||||
in
|
||||
(removeAttrs spec ["package" "setupModule" "setupOpts" "keys"])
|
||||
// {
|
||||
"@1" = name;
|
||||
before =
|
||||
if spec.before != null
|
||||
then
|
||||
mkLuaInline ''
|
||||
function()
|
||||
${spec.before}
|
||||
end
|
||||
''
|
||||
else null;
|
||||
|
||||
after =
|
||||
if spec.setupModule == null && spec.after == null
|
||||
then null
|
||||
else
|
||||
mkLuaInline ''
|
||||
function()
|
||||
${
|
||||
optionalString (spec.setupModule != null)
|
||||
"require(${toJSON spec.setupModule}).setup(${toLuaObject spec.setupOpts})"
|
||||
}
|
||||
${optionalString (spec.after != null) spec.after}
|
||||
end
|
||||
'';
|
||||
|
||||
keys =
|
||||
if typeOf spec.keys == "list" && length spec.keys > 0 && typeOf (head spec.keys) == "set"
|
||||
then map toLuzLznKeySpec spec.keys
|
||||
else spec.keys;
|
||||
};
|
||||
lznSpecs = map toLuaLznSpec cfg.plugins;
|
||||
in {
|
||||
config.vim = mkIf cfg.enable {
|
||||
startPlugins = ["lz-n" "lzn-auto-require"];
|
||||
|
||||
optPlugins = map (plugin: plugin.package) cfg.plugins;
|
||||
|
||||
luaConfigRC.lzn-load = entryBefore ["pluginConfigs"] ''
|
||||
require('lz.n').load(${toLuaObject lznSpecs})
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/wrapper/lazy/default.nix
Normal file
6
modules/wrapper/lazy/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
./lazy.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
205
modules/wrapper/lazy/lazy.nix
Normal file
205
modules/wrapper/lazy/lazy.nix
Normal file
|
@ -0,0 +1,205 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) enum listOf submodule nullOr str bool int attrsOf anything either oneOf;
|
||||
inherit (lib.nvim.types) pluginType;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
|
||||
lznKeysSpec = submodule {
|
||||
options = {
|
||||
key = mkOption {
|
||||
type = str;
|
||||
description = "Key to bind to";
|
||||
};
|
||||
|
||||
action = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Action to trigger.";
|
||||
};
|
||||
lua = mkBool false ''
|
||||
If true, `action` is considered to be lua code.
|
||||
Thus, it will not be wrapped in `""`.
|
||||
'';
|
||||
|
||||
desc = mkOption {
|
||||
description = "Description of the key map";
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
};
|
||||
|
||||
ft = mkOption {
|
||||
description = "TBD";
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
};
|
||||
|
||||
mode = mkOption {
|
||||
description = "Modes to bind in";
|
||||
type = listOf str;
|
||||
default = ["n" "x" "s" "o"];
|
||||
};
|
||||
|
||||
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.";
|
||||
expr = mkBool false "Means that the action is actually an expression. Equivalent to adding <expr> to a map.";
|
||||
nowait = mkBool false "Whether to wait for extra input on ambiguous mappings. Equivalent to adding <nowait> to a map.";
|
||||
};
|
||||
};
|
||||
|
||||
lznPluginType = submodule {
|
||||
options = {
|
||||
## Should probably infer from the actual plugin somehow
|
||||
## In general this is the name passed to packadd, so the dir name of the plugin
|
||||
# name = mkOption {
|
||||
# type= str;
|
||||
# }
|
||||
|
||||
# Non-lz.n options
|
||||
|
||||
package = mkOption {
|
||||
type = pluginType;
|
||||
description = "Plugin package";
|
||||
};
|
||||
|
||||
setupModule = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Lua module to run setup function on.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
setupOpts = mkOption {
|
||||
type = submodule {freeformType = attrsOf anything;};
|
||||
description = "Options to pass to the setup function";
|
||||
default = {};
|
||||
};
|
||||
|
||||
# lz.n options
|
||||
|
||||
enabled = mkOption {
|
||||
type = nullOr (either bool str);
|
||||
description = "When false, or if the lua function returns false, this plugin will not be included in the spec";
|
||||
default = null;
|
||||
};
|
||||
|
||||
beforeAll = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Lua code to run before any plugins are loaded. This will be wrapped in a function.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
before = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Lua code to run before plugin is loaded. This will be wrapped in a function.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
after = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Lua code to run after plugin is loaded. This will be wrapped in a function.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
event = mkOption {
|
||||
description = "Lazy-load on event";
|
||||
default = null;
|
||||
type = let
|
||||
event = submodule {
|
||||
options = {
|
||||
event = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
description = "Exact event name";
|
||||
example = "BufEnter";
|
||||
};
|
||||
pattern = mkOption {
|
||||
type = nullOr (either str (listOf str));
|
||||
description = "Event pattern";
|
||||
example = "BufEnter *.lua";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
nullOr (oneOf [str (listOf str) event]);
|
||||
};
|
||||
|
||||
cmd = mkOption {
|
||||
description = "Lazy-load on command";
|
||||
default = null;
|
||||
type = nullOr (either str (listOf str));
|
||||
};
|
||||
|
||||
ft = mkOption {
|
||||
description = "Lazy-load on filetype";
|
||||
default = null;
|
||||
type = nullOr (either str (listOf str));
|
||||
};
|
||||
|
||||
keys = mkOption {
|
||||
description = "Lazy-load on key mapping";
|
||||
default = null;
|
||||
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]);
|
||||
example = ''
|
||||
keys = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>s";
|
||||
action = ":DapStepOver<cr>";
|
||||
desc = "DAP Step Over";
|
||||
}
|
||||
{
|
||||
mode = ["n", "x"];
|
||||
key = "<leader>dc";
|
||||
action = "function() require('dap').continue() end";
|
||||
lua = true;
|
||||
desc = "DAP Continue";
|
||||
}
|
||||
]
|
||||
'';
|
||||
};
|
||||
|
||||
colorscheme = mkOption {
|
||||
description = "Lazy-load on colorscheme.";
|
||||
type = nullOr (either str (listOf str));
|
||||
default = null;
|
||||
};
|
||||
|
||||
priority = mkOption {
|
||||
type = nullOr int;
|
||||
description = "Only useful for stat plugins (not lazy-loaded) to force loading certain plugins first.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
load = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Lua code to override the `vim.g.lz_n.load()` function for a single plugin.
|
||||
|
||||
This will be wrapped in a function
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.lazy = {
|
||||
enable = mkEnableOption "plugin lazy-loading" // {default = true;};
|
||||
loader = mkOption {
|
||||
description = "Lazy loader to use";
|
||||
type = enum ["lz.n"];
|
||||
default = "lz.n";
|
||||
};
|
||||
|
||||
plugins = mkOption {
|
||||
default = [];
|
||||
type = listOf lznPluginType;
|
||||
description = "list of plugins to lazy load";
|
||||
example = ''
|
||||
[
|
||||
{
|
||||
package = "toggleterm-nvim";
|
||||
after = lib.generators.mkLuaInline "function() require('toggleterm').setup{} end";
|
||||
cmd = ["ToggleTerm"];
|
||||
}
|
||||
]
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -3,87 +3,22 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) map mapAttrs filter;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.attrsets) mapAttrsToList filterAttrs getAttrs attrValues attrNames;
|
||||
inherit (lib.strings) concatLines concatMapStringsSep;
|
||||
inherit (builtins) map mapAttrs filter removeAttrs attrNames;
|
||||
inherit (lib.attrsets) mapAttrsToList filterAttrs attrsToList;
|
||||
inherit (lib.strings) concatLines concatMapStringsSep optionalString;
|
||||
inherit (lib.trivial) showWarnings;
|
||||
inherit (lib.types) str nullOr;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.dag) entryAfter mkLuarcSection resolveDag entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
|
||||
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 {
|
||||
config = let
|
||||
filterNonNull = attrs: filterAttrs (_: value: value != null) attrs;
|
||||
globalsScript =
|
||||
mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}")
|
||||
(filterNonNull cfg.globals);
|
||||
mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}") cfg.globals;
|
||||
|
||||
optionsScript =
|
||||
mapAttrsToList (name: value: "vim.o.${name} = ${toLuaObject value}") cfg.options;
|
||||
|
||||
extraPluginConfigs = resolveDag {
|
||||
name = "extra plugin configs";
|
||||
|
@ -97,46 +32,62 @@ in {
|
|||
mapResult = result: concatLines (map mkLuarcSection result);
|
||||
};
|
||||
|
||||
toLuaBindings = mode: maps:
|
||||
map (value: ''
|
||||
vim.keymap.set(${toLuaObject mode}, ${toLuaObject value.key}, ${toLuaObject value.action}, ${toLuaObject value.config})
|
||||
'') (genMaps mode maps);
|
||||
getAction = keymap:
|
||||
if keymap.lua
|
||||
then mkLuaInline keymap.action
|
||||
else keymap.action;
|
||||
|
||||
# I'm not sure if every one of these will work.
|
||||
allmap = toLuaBindings "" config.vim.maps.normalVisualOp;
|
||||
nmap = toLuaBindings "n" config.vim.maps.normal;
|
||||
vmap = toLuaBindings "v" config.vim.maps.visual;
|
||||
xmap = toLuaBindings "x" config.vim.maps.visualOnly;
|
||||
smap = toLuaBindings "s" config.vim.maps.select;
|
||||
imap = toLuaBindings "i" config.vim.maps.insert;
|
||||
cmap = toLuaBindings "c" config.vim.maps.command;
|
||||
tmap = toLuaBindings "t" config.vim.maps.terminal;
|
||||
lmap = toLuaBindings "l" config.vim.maps.lang;
|
||||
omap = toLuaBindings "o" config.vim.maps.operator;
|
||||
icmap = toLuaBindings "ic" config.vim.maps.insertCommand;
|
||||
getOpts = keymap: {
|
||||
inherit (keymap) desc silent nowait script expr unique noremap;
|
||||
};
|
||||
|
||||
maps = [
|
||||
nmap
|
||||
imap
|
||||
vmap
|
||||
xmap
|
||||
smap
|
||||
cmap
|
||||
omap
|
||||
tmap
|
||||
lmap
|
||||
icmap
|
||||
allmap
|
||||
];
|
||||
mappings = concatLines (map concatLines maps);
|
||||
toLuaKeymap = {
|
||||
name,
|
||||
value,
|
||||
}: "vim.keymap.set(${toLuaObject value.mode}, ${toLuaObject name}, ${toLuaObject (getAction value)}, ${toLuaObject (getOpts value)})";
|
||||
|
||||
namedModes = {
|
||||
"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"];
|
||||
};
|
||||
|
||||
maps =
|
||||
removeAttrs cfg.maps (attrNames namedModes)
|
||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.normal;}) cfg.maps.normal
|
||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.insert;}) cfg.maps.insert
|
||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.select;}) cfg.maps.select
|
||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.visual;}) cfg.maps.visual
|
||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.terminal;}) cfg.maps.terminal
|
||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.normalVisualOp;}) cfg.maps.normalVisualOp
|
||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.visualOnly;}) cfg.maps.visualOnly
|
||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.operator;}) cfg.maps.operator
|
||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.insertCommand;}) cfg.maps.insertCommand
|
||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.lang;}) cfg.maps.lang
|
||||
// mapAttrs (_: legacyMap: legacyMap // {mode = namedModes.command;}) cfg.maps.command;
|
||||
|
||||
keymaps = concatLines (map toLuaKeymap (attrsToList (filterNonNull maps)));
|
||||
in {
|
||||
vim = {
|
||||
luaConfigRC = {
|
||||
# `vim.g` and `vim.o`
|
||||
globalsScript = entryAnywhere (concatLines globalsScript);
|
||||
# basic, theme
|
||||
pluginConfigs = entryAfter ["theme"] pluginConfigs;
|
||||
optionsScript = entryAfter ["basic"] (concatLines optionsScript);
|
||||
|
||||
# Basic
|
||||
pluginConfigs = entryAfter ["optionsScript"] pluginConfigs;
|
||||
extraPluginConfigs = entryAfter ["pluginConfigs"] extraPluginConfigs;
|
||||
mappings = entryAfter ["extraPluginConfigs"] mappings;
|
||||
mappings = entryAfter ["extraPluginConfigs"] keymaps;
|
||||
# FIXME: put this somewhere less stupid
|
||||
footer = entryAfter ["mappings"] (optionalString config.vim.lazy.enable "require('lzn-auto-require.loader').register_loader()");
|
||||
};
|
||||
|
||||
builtLuaConfigRC = let
|
||||
|
|
|
@ -129,16 +129,38 @@ in {
|
|||
globals = mkOption {
|
||||
type = attrs;
|
||||
default = {};
|
||||
example = {"some_variable" = 42;};
|
||||
description = ''
|
||||
An attribute set containing global variable values
|
||||
for storing vim variables as early as possible. If
|
||||
populated, this option will set vim variables in the
|
||||
built luaConfigRC as the first item.
|
||||
|
||||
E.g. {foo = "bar"} will set `vim.g.foo` to "bar" where
|
||||
the type of `bar` in the resulting vimscript will be
|
||||
infered from the type of the value in the `{name = value}`
|
||||
pair.
|
||||
::: {.note}
|
||||
`{foo = "bar";}` will set `vim.g.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.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
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.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue