mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-24 04:18:03 +00:00
Compare commits
19 commits
d45849d049
...
00915913b6
Author | SHA1 | Date | |
---|---|---|---|
00915913b6 | |||
![]() |
6670d752c7 | ||
5826aebdd3 | |||
c727528b6f | |||
38fc01b9c6 | |||
d6bbae1a91 | |||
cef3aefabb | |||
![]() |
69cd77630b | ||
bce45d4eeb | |||
ccea1a6159 | |||
ab9a7c1600 | |||
![]() |
c957b23aaa | ||
a6c879e8a3 | |||
141a272747 | |||
![]() |
941a2a6f2e | ||
![]() |
e40cce5653 | ||
![]() |
2fc7dc798b | ||
3ca7e3b841 | |||
![]() |
b71bf75dcd |
20 changed files with 476 additions and 286 deletions
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
|
@ -16,7 +16,7 @@ If you have any questions regarding those files, feel free to open an issue or [
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
The contribution process is mostly documented in the [pull request template](.github/pull_request_template.md). You will find a checklist of items to complete before submitting a pull request. Please make sure you complete it before submitting a pull request. If you are unsure about any of the items, please ask.
|
The contribution process is mostly documented in the [pull request template](pull_request_template.md). You will find a checklist of items to complete before submitting a pull request. Please make sure you complete it before submitting a pull request. If you are unsure about any of the items, please ask.
|
||||||
|
|
||||||
### Guidelines
|
### Guidelines
|
||||||
|
|
||||||
|
|
194
.github/README.md
vendored
194
.github/README.md
vendored
|
@ -33,10 +33,9 @@
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<a>
|
<a>
|
||||||
A highly modular, configurable, extensible and easy to use Neovim configuration
|
nvf is a highly modular, configurable, extensible and easy to use Neovim configuration
|
||||||
framework in Nix. Designed for flexibility and ease of use, this flake
|
in Nix. Designed for flexibility and ease of use, nvf allows you to easily configure
|
||||||
allows you to easily configure your Neovim instance with a few lines of
|
your fully featured Neovim instance with a few lines of Nix.
|
||||||
Nix code.
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -44,6 +43,7 @@
|
||||||
|
|
||||||
<div align="center"><p>
|
<div align="center"><p>
|
||||||
|
|
||||||
|
[Features]: #features
|
||||||
[Get Started]: #get-started
|
[Get Started]: #get-started
|
||||||
[Documentation]: #documentation
|
[Documentation]: #documentation
|
||||||
[Help]: #help
|
[Help]: #help
|
||||||
|
@ -51,119 +51,150 @@
|
||||||
[FAQ]: #faq
|
[FAQ]: #faq
|
||||||
[Credits]: #credits
|
[Credits]: #credits
|
||||||
|
|
||||||
**[<kbd> <br> Get Started <br> </kbd>][Get Started]**
|
**[<kbd><br> Features <br></kbd>][Features]**
|
||||||
**[<kbd> <br> Documentation <br> </kbd>][Documentation]**
|
**[<kbd><br> Get Started <br></kbd>][Get Started]**
|
||||||
**[<kbd> <br> Help <br> </kbd>][Help]**
|
**[<kbd><br> Documentation <br></kbd>][Documentation]**
|
||||||
**[<kbd> <br> Contribute <br> </kbd>][Contribute]**
|
**[<kbd><br> Help <br></kbd>][Help]**
|
||||||
**[<kbd> <br> FAQ <br> </kbd>][Faq]**
|
**[<kbd><br> Contribute <br></kbd>][Contribute]**
|
||||||
**[<kbd> <br> Credits <br> </kbd>][Credits]**
|
**[<kbd><br> FAQ <br></kbd>][Faq]** **[<kbd><br> Credits <br></kbd>][Credits]**
|
||||||
|
|
||||||
</p></div>
|
</p></div>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- **Reproducible**: Your configuration will behave the same _anywhere_. No
|
||||||
|
surprises, promise!
|
||||||
|
- **Portable**: nvf depends _solely_ on your Nix store, and nothing else. No
|
||||||
|
more global binaries! Works on all platforms, without hassle.
|
||||||
|
- **Customizable**: There are _almost no defaults_ to annoy you. nvf is fully
|
||||||
|
customizable through the Nix module system.
|
||||||
|
- **Well-documented**: Documentation is priority. You will _never_ face
|
||||||
|
undocumented, obscure behaviour.
|
||||||
|
- **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and
|
||||||
|
will, remain maintainable for myself and any contributors.
|
||||||
|
|
||||||
## Get Started
|
## Get Started
|
||||||
|
|
||||||
### Using `nix` CLI
|
[nvf manual]: https://notashelf.github.io/nvf/
|
||||||
|
[issue tracker]: https://github.com/NotAShelf/nvf/issues
|
||||||
|
|
||||||
If you would like to try out the configuration before even thinking about
|
If you are not sold on the concepts of **nvf**, and would like to try out the
|
||||||
installing it, you can run the following command
|
default configuration before even _thinking about_ installing it, you may run
|
||||||
|
the following in order to take **nvf** out for a spin.
|
||||||
|
|
||||||
```console
|
```bash
|
||||||
|
# Run the default package
|
||||||
nix run github:notashelf/nvf
|
nix run github:notashelf/nvf
|
||||||
```
|
```
|
||||||
|
|
||||||
This will get you a feel for the base configuration and UI design.
|
This will get you a feel for the base configuration and UI design. Though, none
|
||||||
The flake exposes `#nix` as the default package, providing minimal
|
of the configuration options are final as **nvf** is designed to be modular and
|
||||||
language support and various utilities.You may also use `#nix`,
|
configurable.
|
||||||
`#tidal` or `#maximal` to get try out different configurations.
|
|
||||||
|
|
||||||
It is as simple as changing the target output to get a different
|
> [!TIP]
|
||||||
configuration. For example, to get a configuration with `tidal` support, run:
|
> The flake exposes `#nix` as the default package, providing minimal language
|
||||||
|
> support and various utilities. You may also use the `#nix` or `#maximal`
|
||||||
|
> packages provided by the this flake to get try out different configurations.
|
||||||
|
|
||||||
```console
|
It is as simple as changing the target output to get a different configuration.
|
||||||
nix run github:notashelf/nvf#tidal
|
For example, to get a configuration with large language coverage, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run the maximal package
|
||||||
|
nix run github:notashelf/nvf#maximal
|
||||||
```
|
```
|
||||||
|
|
||||||
Similar instructions will apply for `nix profile install`. However, you are
|
Similar instructions will apply for `nix profile install`. However, you are
|
||||||
recommended to instead use the module system as described in the manual.
|
recommended to instead use the module system as described in the manual.
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> The `maximal` configuration is _massive_ and will take a while to build.
|
> The `maximal` configuration is quite large, and might take a while to build.
|
||||||
> To get a feel for the configuration, use the default `nix` or `tidal`
|
> To get a feel for the configuration, use the default `nix` configuration.
|
||||||
> configurations. Should you choose to try out the `maximal` configuration,
|
> Should you choose to try out the `maximal` configuration, using the binary
|
||||||
> using the binary cache as described in the manual is _strongly_ recommended.
|
> cache as described in the manual is _strongly_ recommended.
|
||||||
|
|
||||||
|
If you are convinced, proceed to the next section to view the installation
|
||||||
|
instructions.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
See the [**nvf** Manual](https://notashelf.github.io/nvf/) for
|
The _recommended_ way of installing **nvf** is using either the NixOS or the
|
||||||
detailed installation guides, configurations, available options, release notes
|
Home-Manager module, though it is completely possible and no less supported to
|
||||||
and more. Tips for installing userspace plugins is also contained in the
|
install **nvf** as a standalone package, or a flake output.
|
||||||
documentation.
|
|
||||||
|
|
||||||
If you want to dive right into trying **nvf** you can get a fully
|
See the [**nvf** manual] for detailed and up-to-date installation guides,
|
||||||
featured configuration with `nix` language support by running:
|
configurations, available options, release notes and more. Tips for installing
|
||||||
|
userspace plugins is also contained in the documentation.
|
||||||
|
|
||||||
```console
|
Please create an issue on the [issue tracker] if you find the documentation
|
||||||
nix run github:notashelf/nvf#nix
|
lacking or confusing. Any improvements to the documentation through pull
|
||||||
```
|
requests are also welcome, and appreciated.
|
||||||
|
|
||||||
[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.
|
|
||||||
|
|
||||||
## Help
|
## Help
|
||||||
|
|
||||||
You can create an issue on the [issue tracker](issues) to ask questions
|
You can create an issue on the [issue tracker] to ask questions or report bugs.
|
||||||
or report bugs. I am not yet on spaces like matrix or IRC, so please use the issue
|
I am not yet on spaces like matrix or IRC, so please use the issue tracker for
|
||||||
tracker for now.
|
now.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
I am always looking for new ways to help improve this flake. If you would like
|
I am always looking for new ways to help improve this flake. If you would like
|
||||||
to contribute, please read the [contributing guide](CONTRIBUTING.md) before
|
to contribute, please read the [contributing guide](CONTRIBUTING.md) before
|
||||||
submitting a pull request. You can also create an issue on the
|
submitting a pull request. You can also create an issue on the [issue tracker]
|
||||||
[issue tracker](issues) before submitting a pull request if you would
|
before submitting a pull request if you would like to discuss a feature or bug
|
||||||
like to discuss a feature or bug fix.
|
fix.
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
|
[appropriate issue template]: https://github.com/NotAShelf/nvf/issues/new/choose
|
||||||
|
[list of branches]: https://github.com/NotAShelf/nvf/branches
|
||||||
|
[list of open pull requests]: https://github.com/NotAShelf/nvf/pulls
|
||||||
|
|
||||||
|
**Q**: What platforms are supported?
|
||||||
|
<br/> **A**: nvf actively supports Linux and Darwin platforms using standalone
|
||||||
|
Nix, NixOS or Home-Manager. Please take a look at the
|
||||||
|
|
||||||
**Q**: Can you add _X_?
|
**Q**: Can you add _X_?
|
||||||
<br/>
|
<br/> **A**: Maybe! It is not one of our goals to support each and every Neovim
|
||||||
**A**: Maybe! It is not one of our goals to support each and every Neovim
|
plugin, however, I am always open to new modules and plugin setup additions to
|
||||||
plugin, however, I am always open to new modules and plugin setup additions
|
**nvf**. Use the [appropriate issue template] and I will consider a module
|
||||||
to **nvf**. Use the [appropritate issue template](issues/new/choose) and I will
|
addition. As mentioned before, PRs adding new features are also welcome.
|
||||||
consider a module addition.
|
|
||||||
|
|
||||||
**Q**: A plugin I need is not available in **nvf**. What to do?
|
**Q**: A plugin I need is not available in **nvf**. What to do?
|
||||||
<br/>
|
<br/> **A**: **nvf** exposes several APIs for you to be able to add your own
|
||||||
**A**: **nvf** exposes several APIs for you to be able to add your own
|
plugin configurations! Please see the documentation on how you may do this.
|
||||||
plugin configurations! Please see the documentation on how you may do
|
|
||||||
this.
|
|
||||||
|
|
||||||
**Q**: Main branch is awfully silent, is the project dead?
|
**Q**: Main branch is awfully silent, is the project dead?
|
||||||
<br/>
|
<br/> **A**: No! Sometimes we branch out (e.g. `v0.6`) to avoid breaking
|
||||||
**A**: No! Sometimes we branch out (e.g. v0.6) to avoid breaking userspace
|
userspace and work in a separate branch until we make sure the new additions are
|
||||||
and work in a separate branch until we make sure the new additions are
|
implemented in the most comfortable way possible for the end user. If you have
|
||||||
implemented in the most comfortable way available to the end user. If you have
|
not noticed any activity on the main branch, consider taking a look at the
|
||||||
not noticed any activity on the main branch, consider taking a look at the [list
|
[list of branches] or the [list of open pull requests]. You may also consider
|
||||||
of branches](https://github.com/NotAShelf/nvf/branches=) or the [list of open
|
_testing_ those release branches to get access to new features ahead of time and
|
||||||
pull requests](https://github.com/NotAShelf/nvf)
|
better prepare to breaking changes.
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
### Contributors
|
### Contributors
|
||||||
|
|
||||||
Special thanks to
|
Special, heart-felt thanks to
|
||||||
|
|
||||||
- [@fufexan](https://github.com/fufexan) - For the transition to flake-parts
|
- [@fufexan](https://github.com/fufexan) - For the transition to flake-parts
|
||||||
- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to work
|
- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to
|
||||||
- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally possible
|
work
|
||||||
- [@horriblename](https://github.com/horriblename) - For actively implementing planned features and quality of life updates
|
- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally
|
||||||
|
possible
|
||||||
|
- [@horriblename](https://github.com/horriblename) - For actively implementing
|
||||||
|
planned features and quality of life updates
|
||||||
- [@Yavko](https://github.com/Yavko) - For the amazing **nvf** logo
|
- [@Yavko](https://github.com/Yavko) - For the amazing **nvf** logo
|
||||||
- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I could not
|
- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I
|
||||||
|
could not
|
||||||
|
- [@Diniamo](https://github.com/Diniamo) - For actively submitting PRs, pull
|
||||||
|
requests and overall assistence
|
||||||
|
- [@Gerg-l](https://github.com/gerg-l) - For the modern Neovim wrapper, mnw and
|
||||||
|
occasional code improvements
|
||||||
|
|
||||||
and everyone who has submitted issues or pull requests!
|
and everyone who has submitted issues or pull requests!
|
||||||
|
|
||||||
|
@ -172,10 +203,18 @@ and everyone who has submitted issues or pull requests!
|
||||||
This configuration borrows from and is based on a few other configurations,
|
This configuration borrows from and is based on a few other configurations,
|
||||||
including:
|
including:
|
||||||
|
|
||||||
- [@jordanisaacs's](https://github.com/jordanisaacs) [neovim-flake](https://github.com/jordanisaacs/neovim-flake) that this flake is originally based on.
|
- [@jordanisaacs's](https://github.com/jordanisaacs)
|
||||||
- [@sioodmy's](https://github.com/sioodmy) [dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design choices.
|
[neovim-flake](https://github.com/jordanisaacs/neovim-flake) that this flake
|
||||||
- [@wiltaylor's](https://github.com/wiltaylor) [neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and design ideas.
|
is originally based on.
|
||||||
- [@gvolpe's](https://github.com/gvolpe) [neovim-flake](https://github.com/gvolpe/neovim-flake) for plugin, design and nix concepts.
|
- [@sioodmy's](https://github.com/sioodmy)
|
||||||
|
[dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design
|
||||||
|
choices.
|
||||||
|
- [@wiltaylor's](https://github.com/wiltaylor)
|
||||||
|
[neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and
|
||||||
|
design ideas.
|
||||||
|
- [@gvolpe's](https://github.com/gvolpe)
|
||||||
|
[neovim-flake](https://github.com/gvolpe/neovim-flake) for plugin, design and
|
||||||
|
nix concepts.
|
||||||
|
|
||||||
I am grateful for their previous work and inspiration, and I wholeheartedly
|
I am grateful for their previous work and inspiration, and I wholeheartedly
|
||||||
recommend checking their work out.
|
recommend checking their work out.
|
||||||
|
@ -183,11 +222,14 @@ recommend checking their work out.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Following the license of the [original neovim-flake](https://github.com/jordanisaacs/neovim-flake),
|
Following the license of the
|
||||||
**nvf** has been made available under the [**MIT License**](LICENSE). However, all assets
|
[original neovim-flake](https://github.com/jordanisaacs/neovim-flake), **nvf**
|
||||||
and documentation are published under the
|
has been made available under the [**MIT License**](LICENSE). However, all
|
||||||
|
assets and documentation are published under the
|
||||||
[**CC BY License**](https://github.com/NotAShelf/nvf/blob/main/.github/assets/LICENSE).
|
[**CC BY License**](https://github.com/NotAShelf/nvf/blob/main/.github/assets/LICENSE).
|
||||||
|
|
||||||
|
<h6 align="center">Yes, this includes the logo work too. Stop taking artwork that is not yours!</h6>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<div align="right">
|
<div align="right">
|
||||||
|
|
22
.github/workflows/cleanup.yml
vendored
Normal file
22
.github/workflows/cleanup.yml
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
name: Cleanup
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 4 1 * *" # 4AM on 1st of every month
|
||||||
|
- cron: "0 4 15 * *" # 4AM on the 15th of every month
|
||||||
|
jobs:
|
||||||
|
branches:
|
||||||
|
name: Cleanup old branches
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: "Checkout"
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: "Delete old branches"
|
||||||
|
uses: beatlabs/delete-old-branches-action@v0.0.10
|
||||||
|
with:
|
||||||
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
date: "1 months ago"
|
||||||
|
dry_run: false
|
||||||
|
delete_tags: false
|
||||||
|
exclude_open_pr_branches: true
|
|
@ -19,6 +19,7 @@ isMaximal: {
|
||||||
lspsaga.enable = false;
|
lspsaga.enable = false;
|
||||||
trouble.enable = true;
|
trouble.enable = true;
|
||||||
lspSignature.enable = true;
|
lspSignature.enable = true;
|
||||||
|
otter-nvim.enable = isMaximal;
|
||||||
lsplines.enable = isMaximal;
|
lsplines.enable = isMaximal;
|
||||||
nvim-docs-view.enable = isMaximal;
|
nvim-docs-view.enable = isMaximal;
|
||||||
};
|
};
|
||||||
|
@ -155,7 +156,7 @@ isMaximal: {
|
||||||
};
|
};
|
||||||
|
|
||||||
utility = {
|
utility = {
|
||||||
ccc.enable = isMaximal;
|
ccc.enable = false;
|
||||||
vim-wakatime.enable = false;
|
vim-wakatime.enable = false;
|
||||||
icon-picker.enable = isMaximal;
|
icon-picker.enable = isMaximal;
|
||||||
surround.enable = isMaximal;
|
surround.enable = isMaximal;
|
||||||
|
|
|
@ -5,16 +5,19 @@ can add code that relies on other code. However, if you don't know what the
|
||||||
entries are called, it's hard to do that, so here is a list of the internal
|
entries are called, it's hard to do that, so here is a list of the internal
|
||||||
entries in nvf:
|
entries in nvf:
|
||||||
|
|
||||||
`vim.luaConfigRC` (top-level DAG):
|
## `vim.luaConfigRC` (top-level DAG) {#ch-vim-luaconfigrc}
|
||||||
|
|
||||||
1. (`luaConfigPre`) - not a part of the actual DAG, instead, it's simply
|
1. (`luaConfigPre`) - not a part of the actual DAG, instead, it's simply
|
||||||
inserted before the rest of the DAG
|
inserted before the rest of the DAG
|
||||||
2. `globalsScript` - used to set globals defined in `vim.globals`
|
2. `globalsScript` - used to set globals defined in `vim.globals`
|
||||||
3. `basic` - used to set basic configuration options
|
3. `basic` - used to set basic configuration options
|
||||||
4. `theme` (this is simply placed before `pluginConfigs`, meaning that surrounding entries don't depend on it) - used to set up the theme, which has to be done before other plugins
|
4. `optionsScript` - used to set options defined in `vim.o`
|
||||||
5. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option,
|
5. `theme` (this is simply placed before `pluginConfigs`, meaning that
|
||||||
see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your own
|
surrounding entries don't depend on it) - used to set up the theme, which has
|
||||||
plugins) DAG, used to set up internal plugins
|
to be done before other plugins
|
||||||
6. `extraPluginConfigs` - the result of `vim.extraPlugins`, which is not a
|
6. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option,
|
||||||
|
see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your
|
||||||
|
own plugins) DAG, used to set up internal plugins
|
||||||
|
7. `extraPluginConfigs` - the result of `vim.extraPlugins`, which is not a
|
||||||
direct DAG, but is converted to, and resolved as one internally
|
direct DAG, but is converted to, and resolved as one internally
|
||||||
7. `mappings` - the result of `vim.maps`
|
8. `mappings` - the result of `vim.maps`
|
||||||
|
|
|
@ -26,6 +26,28 @@ making good use of its extensive Lua API. Additionally, Vimscript is slow and
|
||||||
brings unnecessary performance overhead while working with different
|
brings unnecessary performance overhead while working with different
|
||||||
configuration formats.
|
configuration formats.
|
||||||
|
|
||||||
|
### `vim.maps` rewrite {#sec-vim-maps-rewrite}
|
||||||
|
|
||||||
|
Instead of specifying map modes using submodules (eg.: `vim.maps.normal`), a new
|
||||||
|
`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}
|
### `vim.lsp.nvimCodeActionMenu` removed in favor of `vim.ui.fastaction` {#sec-nvim-code-action-menu-deprecation}
|
||||||
|
|
||||||
The nvim-code-action-menu plugin has been archived and broken for a long time,
|
The nvim-code-action-menu plugin has been archived and broken for a long time,
|
||||||
|
@ -37,6 +59,7 @@ 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
|
dressing.nvim and actions-preview.nvim, in case fastaction doesn't work for
|
||||||
everyone.
|
everyone.
|
||||||
|
|
||||||
|
|
||||||
## Changelog {#sec-release-0.7-changelog}
|
## Changelog {#sec-release-0.7-changelog}
|
||||||
|
|
||||||
[ItsSorae](https://github.com/ItsSorae):
|
[ItsSorae](https://github.com/ItsSorae):
|
||||||
|
@ -132,6 +155,8 @@ everyone.
|
||||||
has been introduced for setting up internal plugins. See the "DAG entries in
|
has been introduced for setting up internal plugins. See the "DAG entries in
|
||||||
nvf" manual page for more information.
|
nvf" manual page for more information.
|
||||||
|
|
||||||
|
- Rewrite `vim.maps`, see the breaking changes section above.
|
||||||
|
|
||||||
[NotAShelf](https://github.com/notashelf):
|
[NotAShelf](https://github.com/notashelf):
|
||||||
|
|
||||||
[ts-error-translator.nvim]: https://github.com/dmmulroy/ts-error-translator.nvim
|
[ts-error-translator.nvim]: https://github.com/dmmulroy/ts-error-translator.nvim
|
||||||
|
@ -187,6 +212,12 @@ everyone.
|
||||||
- Add [python-lsp-server](https://github.com/python-lsp/python-lsp-server) as an
|
- Add [python-lsp-server](https://github.com/python-lsp/python-lsp-server) as an
|
||||||
additional Python LSP server.
|
additional Python LSP server.
|
||||||
|
|
||||||
|
- Add [](#opt-vim.options) to set `vim.o` values in in your nvf configuration
|
||||||
|
without using additional Lua. See option documentation for more details.
|
||||||
|
|
||||||
|
- Add [](#opt-vim.dashboard.dashboard-nvim.setupOpts) to allow user
|
||||||
|
configuration for [dashboard.nvim](https://github.com/nvimdev/dashboard-nvim)
|
||||||
|
|
||||||
[ppenguin](https://github.com/ppenguin):
|
[ppenguin](https://github.com/ppenguin):
|
||||||
|
|
||||||
- Telescope:
|
- Telescope:
|
||||||
|
@ -196,3 +227,5 @@ everyone.
|
||||||
[Soliprem](https://github.com/Soliprem)
|
[Soliprem](https://github.com/Soliprem)
|
||||||
|
|
||||||
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
||||||
|
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
||||||
|
ccc
|
||||||
|
|
17
flake.lock
generated
17
flake.lock
generated
|
@ -1405,6 +1405,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-otter-nvim": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1724585935,
|
||||||
|
"narHash": "sha256-euHwoK2WHLF/hrjLY2P4yGrIbYyBN38FL3q4CKNZmLY=",
|
||||||
|
"owner": "jmbuhr",
|
||||||
|
"repo": "otter.nvim",
|
||||||
|
"rev": "ca9ce67d0399380b659923381b58d174344c9ee7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "jmbuhr",
|
||||||
|
"repo": "otter.nvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-oxocarbon": {
|
"plugin-oxocarbon": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1895,6 +1911,7 @@
|
||||||
"plugin-obsidian-nvim": "plugin-obsidian-nvim",
|
"plugin-obsidian-nvim": "plugin-obsidian-nvim",
|
||||||
"plugin-onedark": "plugin-onedark",
|
"plugin-onedark": "plugin-onedark",
|
||||||
"plugin-orgmode-nvim": "plugin-orgmode-nvim",
|
"plugin-orgmode-nvim": "plugin-orgmode-nvim",
|
||||||
|
"plugin-otter-nvim": "plugin-otter-nvim",
|
||||||
"plugin-oxocarbon": "plugin-oxocarbon",
|
"plugin-oxocarbon": "plugin-oxocarbon",
|
||||||
"plugin-plenary-nvim": "plugin-plenary-nvim",
|
"plugin-plenary-nvim": "plugin-plenary-nvim",
|
||||||
"plugin-project-nvim": "plugin-project-nvim",
|
"plugin-project-nvim": "plugin-project-nvim",
|
||||||
|
|
25
flake.nix
25
flake.nix
|
@ -13,8 +13,8 @@
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
specialArgs = {inherit lib;};
|
specialArgs = {inherit lib;};
|
||||||
} {
|
} {
|
||||||
# provide overridable systems
|
# Allow users to bring their own systems.
|
||||||
# https://github.com/nix-systems/nix-systems
|
# «https://github.com/nix-systems/nix-systems»
|
||||||
systems = import inputs.systems;
|
systems = import inputs.systems;
|
||||||
imports = [
|
imports = [
|
||||||
./flake/apps.nix
|
./flake/apps.nix
|
||||||
|
@ -62,7 +62,6 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
formatter = pkgs.alejandra;
|
|
||||||
devShells = {
|
devShells = {
|
||||||
default = self'.devShells.lsp;
|
default = self'.devShells.lsp;
|
||||||
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
|
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
|
||||||
|
@ -70,6 +69,21 @@
|
||||||
packages = with pkgs; [nil statix deadnix alejandra];
|
packages = with pkgs; [nil statix deadnix alejandra];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Provide the default formatter. `nix fmt` in project root
|
||||||
|
# will format available files with the correct formatter.
|
||||||
|
# P.S: Please do not format with nixfmt! It messes with many
|
||||||
|
# syntax elements and results in unreadable code.
|
||||||
|
formatter = pkgs.alejandra;
|
||||||
|
|
||||||
|
# Check if codebase is properly formatted.
|
||||||
|
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
|
||||||
|
# or with `nix flake check`
|
||||||
|
checks = {
|
||||||
|
nix-fmt = pkgs.runCommand "nix-fmt-check" {nativeBuildInputs = [pkgs.alejandra];} ''
|
||||||
|
alejandra --check ${self} < /dev/null | tee $out
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -156,6 +170,11 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin-otter-nvim = {
|
||||||
|
url = "github:jmbuhr/otter.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
# Language support
|
# Language support
|
||||||
plugin-sqls-nvim = {
|
plugin-sqls-nvim = {
|
||||||
url = "github:nanotee/sqls.nvim";
|
url = "github:nanotee/sqls.nvim";
|
||||||
|
|
|
@ -8,45 +8,26 @@
|
||||||
cfg = config.vim;
|
cfg = config.vim;
|
||||||
in {
|
in {
|
||||||
config = {
|
config = {
|
||||||
vim.maps = {
|
vim.maps = mkIf cfg.disableArrows {
|
||||||
normal = mkIf cfg.disableArrows {
|
"<up>" = {
|
||||||
"<up>" = {
|
mode = ["n" "i"];
|
||||||
action = "<nop>";
|
action = "<nop>";
|
||||||
|
noremap = false;
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
"<down>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
|
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
"<left>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
"<right>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
"<down>" = {
|
||||||
insert = mkIf cfg.disableArrows {
|
mode = ["n" "i"];
|
||||||
"<up>" = {
|
action = "<nop>";
|
||||||
action = "<nop>";
|
noremap = false;
|
||||||
noremap = false;
|
};
|
||||||
};
|
"<left>" = {
|
||||||
"<down>" = {
|
mode = ["n" "i"];
|
||||||
action = "<nop>";
|
action = "<nop>";
|
||||||
noremap = false;
|
noremap = false;
|
||||||
};
|
};
|
||||||
"<left>" = {
|
"<right>" = {
|
||||||
action = "<nop>";
|
mode = ["n" "i"];
|
||||||
noremap = false;
|
action = "<nop>";
|
||||||
};
|
noremap = false;
|
||||||
"<right>" = {
|
|
||||||
action = "<nop>";
|
|
||||||
noremap = false;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,61 +1,52 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkOption;
|
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;
|
inherit (lib.nvim.config) mkBool;
|
||||||
# Most of the keybindings code is highly inspired by pta2002/nixvim.
|
|
||||||
# Thank you!
|
|
||||||
mapConfigOptions = {
|
mapConfigOptions = {
|
||||||
silent =
|
|
||||||
mkBool false
|
|
||||||
"Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
|
|
||||||
|
|
||||||
nowait =
|
|
||||||
mkBool false
|
|
||||||
"Whether to wait for extra input on ambiguous mappings. Equivalent to adding <nowait> to a map.";
|
|
||||||
|
|
||||||
script =
|
|
||||||
mkBool false
|
|
||||||
"Equivalent to adding <script> to a map.";
|
|
||||||
|
|
||||||
expr =
|
|
||||||
mkBool false
|
|
||||||
"Means that the action is actually an expression. Equivalent to adding <expr> to a map.";
|
|
||||||
|
|
||||||
unique =
|
|
||||||
mkBool false
|
|
||||||
"Whether to fail if the map is already defined. Equivalent to adding <unique> to a map.";
|
|
||||||
|
|
||||||
noremap =
|
|
||||||
mkBool true
|
|
||||||
"Whether to use the 'noremap' variant of the command, ignoring any custom mappings on the defined action. It is highly advised to keep this on, which is the default.";
|
|
||||||
|
|
||||||
desc = mkOption {
|
desc = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
description = "A description of this keybind, to be shown in which-key, if you have it enabled.";
|
description = "A description of this keybind, to be shown in which-key, if you have it enabled.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
action = mkOption {
|
||||||
|
type = str;
|
||||||
|
description = "The command to execute.";
|
||||||
|
};
|
||||||
|
lua = mkBool false ''
|
||||||
|
If true, `action` is considered to be lua code.
|
||||||
|
Thus, it will not be wrapped in `""`.
|
||||||
|
'';
|
||||||
|
|
||||||
|
silent = mkBool true "Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
|
||||||
|
nowait = mkBool false "Whether to wait for extra input on ambiguous mappings. Equivalent to adding <nowait> to a map.";
|
||||||
|
script = mkBool false "Equivalent to adding <script> to a map.";
|
||||||
|
expr = mkBool false "Means that the action is actually an expression. Equivalent to adding <expr> to a map.";
|
||||||
|
unique = mkBool false "Whether to fail if the map is already defined. Equivalent to adding <unique> to a map.";
|
||||||
|
noremap = mkBool true "Whether to use the 'noremap' variant of the command, ignoring any custom mappings on the defined action. It is highly advised to keep this on, which is the default.";
|
||||||
};
|
};
|
||||||
|
|
||||||
mapOption = submodule {
|
mapType = submodule {
|
||||||
options =
|
options =
|
||||||
mapConfigOptions
|
mapConfigOptions
|
||||||
// {
|
// {
|
||||||
action = mkOption {
|
mode = mkOption {
|
||||||
type = str;
|
type = either str (listOf str);
|
||||||
description = "The action to execute.";
|
|
||||||
};
|
|
||||||
|
|
||||||
lua = mkOption {
|
|
||||||
type = bool;
|
|
||||||
description = ''
|
description = ''
|
||||||
If true, `action` is considered to be lua code.
|
The short-name of the mode to set the keymapping for. Passing an empty string is the equivalent of `:map`.
|
||||||
Thus, it will not be wrapped in `""`.
|
|
||||||
|
See `:help map-modes` for a list of modes.
|
||||||
'';
|
'';
|
||||||
default = false;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# legacy stuff
|
||||||
|
mapOption = submodule {
|
||||||
|
options = mapConfigOptions;
|
||||||
|
};
|
||||||
|
|
||||||
mapOptions = mode:
|
mapOptions = mode:
|
||||||
mkOption {
|
mkOption {
|
||||||
description = "Mappings for ${mode} mode";
|
description = "Mappings for ${mode} mode";
|
||||||
|
@ -66,6 +57,7 @@ in {
|
||||||
options.vim = {
|
options.vim = {
|
||||||
maps = mkOption {
|
maps = mkOption {
|
||||||
type = submodule {
|
type = submodule {
|
||||||
|
freeformType = attrsOf mapType;
|
||||||
options = {
|
options = {
|
||||||
normal = mapOptions "normal";
|
normal = mapOptions "normal";
|
||||||
insert = mapOptions "insert";
|
insert = mapOptions "insert";
|
||||||
|
@ -82,15 +74,11 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
default = {};
|
default = {};
|
||||||
description = ''
|
description = "Custom keybindings.";
|
||||||
Custom keybindings for any mode.
|
|
||||||
|
|
||||||
For plain maps (e.g. just 'map' or 'remap') use `maps.normalVisualOp`.
|
|
||||||
'';
|
|
||||||
|
|
||||||
example = ''
|
example = ''
|
||||||
maps = {
|
maps = {
|
||||||
normal."<leader>m" = {
|
"<leader>m" = {
|
||||||
|
mode = "n";
|
||||||
silent = true;
|
silent = true;
|
||||||
action = "<cmd>make<CR>";
|
action = "<cmd>make<CR>";
|
||||||
}; # Same as nnoremap <leader>m <silent> <cmd>make<CR>
|
}; # Same as nnoremap <leader>m <silent> <cmd>make<CR>
|
||||||
|
|
|
@ -5,16 +5,17 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.dashboard.dashboard-nvim;
|
cfg = config.vim.dashboard.dashboard-nvim;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim = {
|
||||||
"dashboard-nvim"
|
startPlugins = ["dashboard-nvim"];
|
||||||
];
|
|
||||||
|
|
||||||
vim.pluginRC.dashboard-nvim = entryAnywhere ''
|
pluginRC.dashboard-nvim = entryAnywhere ''
|
||||||
require("dashboard").setup{}
|
require("dashboard").setup(${toLuaObject cfg.setupOpts})
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.dashboard.dashboard-nvim = {
|
options.vim.dashboard.dashboard-nvim = {
|
||||||
enable = mkEnableOption "Fancy and Blazing Fast start screen plugin of neovim [dashboard.nvim]";
|
enable = mkEnableOption "Fancy and Blazing Fast start screen plugin of neovim [dashboard.nvim]";
|
||||||
|
setupOpts = mkPluginSetupOption "dashboard.nvim" {};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,7 +226,7 @@ in {
|
||||||
{
|
{
|
||||||
assertion = cfg.lsp.enable -> cfg.lsp.server != "tsserver";
|
assertion = cfg.lsp.enable -> cfg.lsp.server != "tsserver";
|
||||||
message = ''
|
message = ''
|
||||||
As of a recent lspconfig update, he `tsserver` configuration has been renamed
|
As of a recent lspconfig update, the `tsserver` configuration has been renamed
|
||||||
to `ts_ls` to match upstream behaviour of `lspconfig`, and the name `tsserver`
|
to `ts_ls` to match upstream behaviour of `lspconfig`, and the name `tsserver`
|
||||||
is no longer considered valid by nvf. Please set `vim.languages.ts.lsp.server`
|
is no longer considered valid by nvf. Please set `vim.languages.ts.lsp.server`
|
||||||
to `"ts_ls"` instead of to `${cfg.lsp.server}`
|
to `"ts_ls"` instead of to `${cfg.lsp.server}`
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
./trouble
|
./trouble
|
||||||
./lsp-signature
|
./lsp-signature
|
||||||
./lightbulb
|
./lightbulb
|
||||||
|
./otter
|
||||||
./lspkind
|
./lspkind
|
||||||
./lsplines
|
./lsplines
|
||||||
./nvim-docs-view
|
./nvim-docs-view
|
||||||
|
|
39
modules/plugins/lsp/otter/config.nix
Normal file
39
modules/plugins/lsp/otter/config.nix
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
||||||
|
|
||||||
|
cfg = config.vim.lsp;
|
||||||
|
|
||||||
|
self = import ./otter.nix {inherit lib;};
|
||||||
|
mappingDefinitions = self.options.vim.lsp.otter-nvim.mappings;
|
||||||
|
mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions;
|
||||||
|
in {
|
||||||
|
config = mkIf (cfg.enable && cfg.otter-nvim.enable) {
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = !config.vim.utility.ccc.enable;
|
||||||
|
message = ''
|
||||||
|
ccc and otter have a breaking conflict. It's been reported upstream. Until it's fixed, disable one of them
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
vim = {
|
||||||
|
startPlugins = ["otter-nvim"];
|
||||||
|
|
||||||
|
maps.normal = mkMerge [
|
||||||
|
(mkSetBinding mappings.toggle "<cmd>lua require'otter'.activate()<CR>")
|
||||||
|
];
|
||||||
|
|
||||||
|
pluginRC.otter-nvim = entryAnywhere ''
|
||||||
|
-- Enable otter diagnostics viewer
|
||||||
|
require("otter").setup({${toLuaObject cfg.otter-nvim.setupOpts}})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
6
modules/plugins/lsp/otter/default.nix
Normal file
6
modules/plugins/lsp/otter/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./otter.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
64
modules/plugins/lsp/otter/otter.nix
Normal file
64
modules/plugins/lsp/otter/otter.nix
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
inherit (lib.types) bool str listOf;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
in {
|
||||||
|
options.vim.lsp = {
|
||||||
|
otter-nvim = {
|
||||||
|
enable = mkEnableOption ''
|
||||||
|
lsp features and a code completion source for code embedded in other documents [otter-nvim]
|
||||||
|
'';
|
||||||
|
mappings = {
|
||||||
|
toggle = mkMappingOption "Activate LSP on Cursor Position [otter-nvim]" "<leader>lo";
|
||||||
|
};
|
||||||
|
setupOpts = mkPluginSetupOption "otter.nvim" {
|
||||||
|
lsp = {
|
||||||
|
diagnostic_update_event = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = ["BufWritePost"];
|
||||||
|
description = ''
|
||||||
|
`:h events` that cause the diagnostic to update.
|
||||||
|
Set to: {"BufWritePost", "InsertLeave", "TextChanged" }
|
||||||
|
for less performant but more instant diagnostic updates
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
buffers = {
|
||||||
|
set_filetype = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
if set to true, the filetype of the otterbuffers will be set. Other wide only
|
||||||
|
the autocommand of lspconfig that attaches the language server will be
|
||||||
|
executed without stting the filetype
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
write_to_disk = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
write <path>.otter.<embedded language extension> files to disk on save of main buffer.
|
||||||
|
Useful for some linters that require actual files.
|
||||||
|
Otter files are deleted on quit or main buffer close
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
strip_wrapping_quote_characters = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = ["'" ''"'' "`"];
|
||||||
|
description = ''
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
handle_leading_whitespace = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
otter may not work the way you expect when entire code blocks are indented
|
||||||
|
(eg. in Org files) When true, otter handles these cases fully.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -3,87 +3,22 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) map mapAttrs filter;
|
inherit (builtins) map mapAttrs filter removeAttrs attrNames;
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.attrsets) mapAttrsToList filterAttrs attrsToList;
|
||||||
inherit (lib.attrsets) mapAttrsToList filterAttrs getAttrs attrValues attrNames;
|
|
||||||
inherit (lib.strings) concatLines concatMapStringsSep;
|
inherit (lib.strings) concatLines concatMapStringsSep;
|
||||||
inherit (lib.trivial) showWarnings;
|
inherit (lib.trivial) showWarnings;
|
||||||
inherit (lib.types) str nullOr;
|
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.dag) entryAfter mkLuarcSection resolveDag entryAnywhere;
|
inherit (lib.nvim.dag) entryAfter mkLuarcSection resolveDag entryAnywhere;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.nvim.config) mkBool;
|
|
||||||
|
|
||||||
cfg = config.vim;
|
cfg = config.vim;
|
||||||
|
|
||||||
# Most of the keybindings code is highly inspired by pta2002/nixvim.
|
|
||||||
# Thank you!
|
|
||||||
mapConfigOptions = {
|
|
||||||
silent =
|
|
||||||
mkBool false
|
|
||||||
"Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
|
|
||||||
|
|
||||||
nowait =
|
|
||||||
mkBool false
|
|
||||||
"Whether to wait for extra input on ambiguous mappings. Equivalent to adding <nowait> to a map.";
|
|
||||||
|
|
||||||
script =
|
|
||||||
mkBool false
|
|
||||||
"Equivalent to adding <script> to a map.";
|
|
||||||
|
|
||||||
expr =
|
|
||||||
mkBool false
|
|
||||||
"Means that the action is actually an expression. Equivalent to adding <expr> to a map.";
|
|
||||||
|
|
||||||
unique =
|
|
||||||
mkBool false
|
|
||||||
"Whether to fail if the map is already defined. Equivalent to adding <unique> to a map.";
|
|
||||||
|
|
||||||
noremap =
|
|
||||||
mkBool true
|
|
||||||
"Whether to use the 'noremap' variant of the command, ignoring any custom mappings on the defined action. It is highly advised to keep this on, which is the default.";
|
|
||||||
|
|
||||||
desc = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = null;
|
|
||||||
description = "A description of this keybind, to be shown in which-key, if you have it enabled.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
genMaps = mode: maps: let
|
|
||||||
/*
|
|
||||||
Take a user-defined action (string or attrs) and return the following attribute set:
|
|
||||||
{
|
|
||||||
action = (string) the actual action to map to this key
|
|
||||||
config = (attrs) the configuration options for this mapping (noremap, silent...)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
normalizeAction = action: {
|
|
||||||
# Extract the values of the config options that have been explicitly set by the user
|
|
||||||
config =
|
|
||||||
filterAttrs (_: v: v != null)
|
|
||||||
(getAttrs (attrNames mapConfigOptions) action);
|
|
||||||
action =
|
|
||||||
if action.lua
|
|
||||||
then mkLuaInline action.action
|
|
||||||
else action.action;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
attrValues (mapAttrs
|
|
||||||
(key: action: let
|
|
||||||
normalizedAction = normalizeAction action;
|
|
||||||
in {
|
|
||||||
inherit (normalizedAction) action config;
|
|
||||||
inherit key;
|
|
||||||
inherit mode;
|
|
||||||
})
|
|
||||||
maps);
|
|
||||||
in {
|
in {
|
||||||
config = let
|
config = let
|
||||||
filterNonNull = attrs: filterAttrs (_: value: value != null) attrs;
|
|
||||||
globalsScript =
|
globalsScript =
|
||||||
mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}")
|
mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}") cfg.globals;
|
||||||
(filterNonNull cfg.globals);
|
|
||||||
|
optionsScript =
|
||||||
|
mapAttrsToList (name: value: "vim.o.${name} = ${toLuaObject value}") cfg.options;
|
||||||
|
|
||||||
extraPluginConfigs = resolveDag {
|
extraPluginConfigs = resolveDag {
|
||||||
name = "extra plugin configs";
|
name = "extra plugin configs";
|
||||||
|
@ -97,46 +32,60 @@ in {
|
||||||
mapResult = result: concatLines (map mkLuarcSection result);
|
mapResult = result: concatLines (map mkLuarcSection result);
|
||||||
};
|
};
|
||||||
|
|
||||||
toLuaBindings = mode: maps:
|
getAction = keymap:
|
||||||
map (value: ''
|
if keymap.lua
|
||||||
vim.keymap.set(${toLuaObject mode}, ${toLuaObject value.key}, ${toLuaObject value.action}, ${toLuaObject value.config})
|
then mkLuaInline keymap.action
|
||||||
'') (genMaps mode maps);
|
else keymap.action;
|
||||||
|
|
||||||
# I'm not sure if every one of these will work.
|
getOpts = keymap: {
|
||||||
allmap = toLuaBindings "" config.vim.maps.normalVisualOp;
|
inherit (keymap) desc silent nowait script expr unique noremap;
|
||||||
nmap = toLuaBindings "n" config.vim.maps.normal;
|
};
|
||||||
vmap = toLuaBindings "v" config.vim.maps.visual;
|
|
||||||
xmap = toLuaBindings "x" config.vim.maps.visualOnly;
|
|
||||||
smap = toLuaBindings "s" config.vim.maps.select;
|
|
||||||
imap = toLuaBindings "i" config.vim.maps.insert;
|
|
||||||
cmap = toLuaBindings "c" config.vim.maps.command;
|
|
||||||
tmap = toLuaBindings "t" config.vim.maps.terminal;
|
|
||||||
lmap = toLuaBindings "l" config.vim.maps.lang;
|
|
||||||
omap = toLuaBindings "o" config.vim.maps.operator;
|
|
||||||
icmap = toLuaBindings "ic" config.vim.maps.insertCommand;
|
|
||||||
|
|
||||||
maps = [
|
toLuaKeymap = {
|
||||||
nmap
|
name,
|
||||||
imap
|
value,
|
||||||
vmap
|
}: "vim.keymap.set(${toLuaObject value.mode}, ${toLuaObject name}, ${toLuaObject (getAction value)}, ${toLuaObject (getOpts value)})";
|
||||||
xmap
|
|
||||||
smap
|
namedModes = {
|
||||||
cmap
|
"normal" = ["n"];
|
||||||
omap
|
"insert" = ["i"];
|
||||||
tmap
|
"select" = ["s"];
|
||||||
lmap
|
"visual" = ["v"];
|
||||||
icmap
|
"terminal" = ["t"];
|
||||||
allmap
|
"normalVisualOp" = ["n" "v" "o"];
|
||||||
];
|
"visualOnly" = ["n" "x"];
|
||||||
mappings = concatLines (map concatLines maps);
|
"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 (filterAttrs (_: value: value != null) maps)));
|
||||||
in {
|
in {
|
||||||
vim = {
|
vim = {
|
||||||
luaConfigRC = {
|
luaConfigRC = {
|
||||||
|
# `vim.g` and `vim.o`
|
||||||
globalsScript = entryAnywhere (concatLines globalsScript);
|
globalsScript = entryAnywhere (concatLines globalsScript);
|
||||||
# basic
|
optionsScript = entryAfter ["basic"] (concatLines optionsScript);
|
||||||
pluginConfigs = entryAfter ["basic"] pluginConfigs;
|
|
||||||
|
# Basic
|
||||||
|
pluginConfigs = entryAfter ["optionsScript"] pluginConfigs;
|
||||||
extraPluginConfigs = entryAfter ["pluginConfigs"] extraPluginConfigs;
|
extraPluginConfigs = entryAfter ["pluginConfigs"] extraPluginConfigs;
|
||||||
mappings = entryAfter ["extraPluginConfigs"] mappings;
|
mappings = entryAfter ["extraPluginConfigs"] keymaps;
|
||||||
};
|
};
|
||||||
|
|
||||||
builtLuaConfigRC = let
|
builtLuaConfigRC = let
|
||||||
|
|
|
@ -129,16 +129,38 @@ in {
|
||||||
globals = mkOption {
|
globals = mkOption {
|
||||||
type = attrs;
|
type = attrs;
|
||||||
default = {};
|
default = {};
|
||||||
|
example = {"some_variable" = 42;};
|
||||||
description = ''
|
description = ''
|
||||||
An attribute set containing global variable values
|
An attribute set containing global variable values
|
||||||
for storing vim variables as early as possible. If
|
for storing vim variables as early as possible. If
|
||||||
populated, this option will set vim variables in the
|
populated, this option will set vim variables in the
|
||||||
built luaConfigRC as the first item.
|
built luaConfigRC as the first item.
|
||||||
|
|
||||||
E.g. {foo = "bar"} will set `vim.g.foo` to "bar" where
|
::: {.note}
|
||||||
the type of `bar` in the resulting vimscript will be
|
`{foo = "bar";}` will set `vim.g.foo` to "bar", where
|
||||||
infered from the type of the value in the `{name = value}`
|
the type of `bar` in the resulting Lua value will be
|
||||||
pair.
|
inferred from the type of the value in the `{name = value;}`
|
||||||
|
pair passed to the option.
|
||||||
|
:::
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
options = mkOption {
|
||||||
|
type = attrs;
|
||||||
|
default = {};
|
||||||
|
example = {visualbell = true;};
|
||||||
|
description = ''
|
||||||
|
An attribute set containing vim options to be set
|
||||||
|
as early as possible. If populated, this option will
|
||||||
|
set vim options in the built luaConfigRC after `basic`
|
||||||
|
and before `pluginConfigs` DAG entries.
|
||||||
|
|
||||||
|
::: {.note}
|
||||||
|
`{foo = "bar";}` will set `vim.o.foo` to "bar", where
|
||||||
|
the type of `bar` in the resulting Lua value will be
|
||||||
|
inferred from the type of the value in the`{name = value;}`
|
||||||
|
pair passed to the option.
|
||||||
|
:::
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue