Merge branch 'main' into telescope-ext

This commit is contained in:
raf 2025-02-17 00:20:31 +00:00 committed by GitHub
commit f2531e456c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
105 changed files with 3657 additions and 4148 deletions

View file

@ -14,7 +14,7 @@ indent_style = space
indent_size = 2 indent_size = 2
trim_trailing_whitespace = false trim_trailing_whitespace = false
[*.{js,nix,yml,yaml}] [*.{js,json,nix,yml,yaml}]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
tab_width = 2 tab_width = 2
@ -26,3 +26,6 @@ trim_trailing_whitespace = unset
[*.lock] [*.lock]
indent_size = unset indent_size = unset
[npins/sources.json]
insert_final_newline = unset

View file

@ -7,14 +7,17 @@ or dependency in this section.
If your pull request aims to fix an open issue or a please bug, please also link the relevant issue If your pull request aims to fix an open issue or a please bug, please also link the relevant issue
below this line. You may attach an issue to your pull request with `Fixes #<issue number>` outside below this line. You may attach an issue to your pull request with `Fixes #<issue number>` outside
this comment, and it will be closed when your pull request is merged. this comment, and it will be closed when your pull request is merged.
A developer package template is provided in flake/develop.nix. If working on a module, you may use
it to test your changes with minimal dependency changes.
--> -->
## Sanity Checking ## Sanity Checking
<!-- <!--
Please check all that apply. As before, this section is not a hard requirement but checklists with more checked Please check all that apply. As before, this section is not a hard requirement but checklists with more checked
items are likely to be merged faster. You may save some time in maintainer review by performing self-reviews here items are likely to be merged faster. You may save some time in maintainer reviews by performing self-reviews
before submitting your pull request. here before submitting your pull request.
If your pull request includes any change or unexpected behaviour not covered below, please do make sure to include If your pull request includes any change or unexpected behaviour not covered below, please do make sure to include
it above in your description. it above in your description.
@ -22,9 +25,11 @@ it above in your description.
[editorconfig]: https://editorconfig.org [editorconfig]: https://editorconfig.org
[changelog]: https://github.com/NotAShelf/nvf/tree/main/docs/release-notes [changelog]: https://github.com/NotAShelf/nvf/tree/main/docs/release-notes
[hacking nvf]: https://notashelf.github.io/nvf/index.xhtml#sec-guidelines
- [ ] I have updated the [changelog] as per my changes - [ ] I have updated the [changelog] as per my changes
- [ ] I have tested, and self-reviewed my code - [ ] I have tested, and self-reviewed my code
- [ ] My changes fit guidelines found in [hacking nvf]
- Style and consistency - Style and consistency
- [ ] I ran **Alejandra** to format my code (`nix fmt`) - [ ] I ran **Alejandra** to format my code (`nix fmt`)
- [ ] My code conforms to the [editorconfig] configuration of the project - [ ] My code conforms to the [editorconfig] configuration of the project
@ -34,9 +39,10 @@ it above in your description.
- [ ] I have added a section in the manual - [ ] I have added a section in the manual
- [ ] _(For breaking changes)_ I have included a migration guide - [ ] _(For breaking changes)_ I have included a migration guide
- Package(s) built: - Package(s) built:
- [ ] `.#nix` (default package) - [ ] `.#nix` _(default package)_
- [ ] `.#maximal` - [ ] `.#maximal`
- [ ] `.#docs-html` (manual, must build) - [ ] `.#docs-html` _(manual, must build)_
- [ ] `.#docs-linkcheck` _(optional, please build if adding links)_
- Tested on platform(s) - Tested on platform(s)
- [ ] `x86_64-linux` - [ ] `x86_64-linux`
- [ ] `aarch64-linux` - [ ] `aarch64-linux`
@ -46,7 +52,8 @@ it above in your description.
<!-- <!--
If your changes touch upon a portion of the codebase that you do not understand well, please make sure to consult If your changes touch upon a portion of the codebase that you do not understand well, please make sure to consult
the maintainers on your changes. In most cases, making an issue before creating your PR will help you avoid duplicate the maintainers on your changes. In most cases, making an issue before creating your PR will help you avoid duplicate
efforts in the long run. efforts in the long run. `git blame` might help you find out who is the "author" or the "maintainer" of a current
module by showing who worked on it the most.
--> -->
--- ---

72
.github/README.md vendored
View file

@ -50,6 +50,7 @@
[Contribute]: #contributing [Contribute]: #contributing
[FAQ]: #frequently-asked-questions [FAQ]: #frequently-asked-questions
[Credits]: #credits [Credits]: #credits
[License]: #license
**[<kbd><br>Features <br></kbd>][Features]** **[<kbd><br>Features <br></kbd>][Features]**
**[<kbd><br>Get Started<br></kbd>][Get Started]** **[<kbd><br>Get Started<br></kbd>][Get Started]**
@ -67,6 +68,10 @@
[standalone]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-installation [standalone]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-installation
[NixOS module]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-nixos [NixOS module]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-nixos
[Home-Manager module]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-hm [Home-Manager module]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-hm
[release notes]: https://notashelf.github.io/nvf/release-notes.html
[discussions tab]: https://github.com/notashelf/nvf/discussions
[FAQ section]: #frequently-asked-questions
[DAG]: https://en.wikipedia.org/wiki/Directed_acyclic_graph
- **Simple**: One language to rule them all! Use Nix to configure everything, - **Simple**: One language to rule them all! Use Nix to configure everything,
with optional Lua support for robust configurability! with optional Lua support for robust configurability!
@ -79,11 +84,31 @@
customizable through the Nix module system. customizable through the Nix module system.
- Not comfortable with a full-nix config or want to bring your Lua config? You - Not comfortable with a full-nix config or want to bring your Lua config? You
can do just that, no unnecessary restrictions. can do just that, no unnecessary restrictions.
- Lazyloading? We got it! Lazyload both internal and external plugins at will. - Lazyloading 💤? We got it! Lazyload both internal and external plugins at
will.
- nvf allows _ordering configuration bits_ using [DAG] (_Directed acyclic
graph_)s. It has never been easier to construct an editor configuration
deterministically!
- nvf exposes everything you need to avoid a vendor lock-in. Which means you
can add new modules, plugins and so on without relying on us adding a module
for them! Though, of course, feel free to request them.
- Use plugins from anywhere. Inputs, npins, nixpkgs... You name it.
- Add your own modules, with ease. It's all built-in!
- **Well-documented**: Documentation is priority. You will _never_ face - **Well-documented**: Documentation is priority. You will _never_ face
undocumented, obscure behaviour. undocumented, obscure behaviour.
- Changes, breaking or otherwise, will be communicated in the [release notes]
- Refer to the [FAQ section] for answers to common questions.
- Your question not there? Head to the to the [discussions tab]!
- **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and - **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and
will, remain maintainable for myself and any contributors. will, remain maintainable for myself and any contributors.
- **Community-Led**: we would like nvf to be fully capable of accomplishing what
you really want it to do. If you have a use case that is not made possible by
nvf, please open an issue (or a pull request!)
- Your feedback is more than welcome! Feedback is what _drives_ nvf forward.
If you have anything to say, or ask, please let us know.
- Pull requests are _always_ welcome. If you think the project can benefit
from something you did locally, but are not quite sure how to upstream,
please feel free to contact us! We'll help you get it done.
## Get Started ## Get Started
@ -173,36 +198,49 @@ fix.
[list of open pull requests]: https://github.com/NotAShelf/nvf/pulls [list of open pull requests]: https://github.com/NotAShelf/nvf/pulls
**Q**: What platforms are supported? **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 [nvf manual] **A**: nvf actively supports **Linux and Darwin** platforms using standalone
for available installation instructions. Nix, NixOS or Home-Manager. Please take a look at the [nvf manual] for available
installation instructions.
**Q**: Can you add _X_? **Q**: Can you add _X_?
<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 to
**nvf**. Use the appropriate [issue template] and I will consider a module **nvf**. Use the appropriate [issue template] and I will consider a module
addition. As mentioned before, pull requests to add new features are also addition. As mentioned before, pull requests to add new features are also
welcome. welcome.
**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/> **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. **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? **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 **A**: No! Sometimes we branch out (e.g. `v0.6`) to avoid breaking userspace and
implemented in the most comfortable way possible for the end user. If you have work in a separate branch until we make sure the new additions are implemented
not noticed any activity on the main branch, consider taking a look at the 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 [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 _testing_ those release branches to get access to new features ahead of time and
better prepare to breaking changes. better prepare to breaking changes.
**Q**: Will you support non-flake installations? **Q**: Will you support non-flake installations?
<br/> **A**: Quite possibly. **nvf** started as "neovim-flake", which does mean
it is and will remain flakes-first but we might consider non-flakes **A**: Quite possibly. **nvf** started as "neovim-flake", which does mean it is
compatibility. Though keep in mind that **nvf** under non-flake environments and will remain flakes-first but we might consider non-flakes compatibility.
would lose customizability of plugin inputs, which is one of our primary Though keep in mind that **nvf** under non-flake environments would lose
features. customizability of plugin inputs, which is one of our primary features.
**Q**: I prefer working with Lua, can I use nvf as a plugin manager while I use
an imperative path (e.g., `~/.config/nvim`) for my Neovim configuration instead
of a configuration generated from Nix?
**A**: Yes! Add `"~/.config.nvim"` to `vim.additionalRuntimePaths = [ ... ]` and
any plugins you want to load to `vim.startPlugins`. This will load your
configuration from `~/.config/nvim`. You may still use `vim.*` to modify
Neovim's behaviour with Nix.
## Credits ## Credits
@ -245,7 +283,7 @@ and everyone who has submitted issues or pull requests!
### Inspiration ### Inspiration
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) - [@jordanisaacs's](https://github.com/jordanisaacs)

3
.github/typos.toml vendored
View file

@ -1,2 +1,5 @@
default.extend-ignore-words-re = ["(?i)(noice)", "befores", "annote", "viw"] default.extend-ignore-words-re = ["(?i)(noice)", "befores", "annote", "viw"]
files.extend-exclude = [
"npins/sources.json"
]

View file

@ -35,7 +35,6 @@ jobs:
- name: Install Nix - name: Install Nix
uses: DeterminateSystems/nix-installer-action@main uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: cachix/cachix-action@v15 - uses: cachix/cachix-action@v15
with: with:

View file

@ -21,7 +21,6 @@ jobs:
steps: steps:
- name: Install Nix - name: Install Nix
uses: DeterminateSystems/nix-installer-action@main uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -42,13 +41,13 @@ jobs:
with: with:
name: "${{ matrix.package }}" name: "${{ matrix.package }}"
path: result/share/doc/nvf path: result/share/doc/nvf
flake-docs-linkcheck: flake-docs-linkcheck:
name: Validate hyperlinks in documentation sources name: Validate hyperlinks in documentation sources
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Install Nix - name: Install Nix
uses: DeterminateSystems/nix-installer-action@main uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4

View file

@ -19,7 +19,6 @@ jobs:
- name: Install Nix - name: Install Nix
uses: DeterminateSystems/nix-installer-action@main uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Check Flake - name: Check Flake
run: nix flake check run: nix flake check
@ -33,6 +32,5 @@ jobs:
- name: Install Nix - name: Install Nix
uses: DeterminateSystems/nix-installer-action@main uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- run: nix run nixpkgs#alejandra -- -c . - run: nix run nixpkgs#alejandra -- -c .

View file

@ -26,7 +26,6 @@ jobs:
steps: steps:
- name: Install Nix - name: Install Nix
uses: DeterminateSystems/nix-installer-action@main uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4

View file

@ -30,7 +30,6 @@ jobs:
- name: Install Nix - name: Install Nix
uses: DeterminateSystems/nix-installer-action@main uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Checking EditorConfig - name: Checking EditorConfig
shell: bash shell: bash

View file

@ -45,7 +45,6 @@ jobs:
steps: steps:
- uses: actions/checkout@v4.1.7 - uses: actions/checkout@v4.1.7
- uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- run: | - run: |
nix build .#docs -Lv nix build .#docs -Lv
cp -r result/share/doc/nvf public cp -r result/share/doc/nvf public

View file

@ -1,6 +1,7 @@
# This is the sample configuration for nvf, aiming to give you a feel of the default options # This is the sample configuration for nvf, aiming to give you a feel of the default options
# while certain plugins are enabled. While it may act as one, this is not an overview of nvf's # while certain plugins are enabled. While it may partially act as one, this is *not* quite
# module options. To find a complete overview of nvf's options and examples, visit the manual. # an overview of nvf's module options. To find a complete and curated list of nvf module
# options, examples, instruction tutorials and more; please visit the online manual.
# https://notashelf.github.io/nvf/options.html # https://notashelf.github.io/nvf/options.html
isMaximal: { isMaximal: {
config.vim = { config.vim = {
@ -175,6 +176,8 @@ isMaximal: {
icon-picker.enable = isMaximal; icon-picker.enable = isMaximal;
surround.enable = isMaximal; surround.enable = isMaximal;
diffview-nvim.enable = true; diffview-nvim.enable = true;
yanky-nvim.enable = false;
leetcode-nvim.enable = isMaximal;
motion = { motion = {
hop.enable = true; hop.enable = true;
leap.enable = true; leap.enable = true;

View file

@ -102,7 +102,7 @@ in
--script script/anchor-use.js \ --script script/anchor-use.js \
--script script/anchor-min.js \ --script script/anchor-min.js \
--script script/search.js \ --script script/search.js \
--toc-depth 2 \ --toc-depth 1 \
--section-toc-depth 1 \ --section-toc-depth 1 \
manual.md \ manual.md \
"$dest/index.xhtml" "$dest/index.xhtml"

View file

@ -3,7 +3,7 @@
```{=include=} chapters ```{=include=} chapters
configuring/custom-package.md configuring/custom-package.md
configuring/custom-plugins.md configuring/custom-plugins.md
configuring/custom-inputs.md configuring/overriding-plugins.md
configuring/languages.md configuring/languages.md
configuring/dags.md configuring/dags.md
configuring/dag-entries.md configuring/dag-entries.md

View file

@ -1,53 +0,0 @@
# Custom Inputs {#ch-custom-inputs}
One of the greatest strengths of **nvf** is its ability to get plugins from
flake inputs and build them locally from any given source. For plugins that do
not require any kind of additional building step, this is a powerful method of
adding plugins to your configuration that are not packaged in nixpkgs, or those
you want to track from source without relying on nixpkgs.
The [additional plugins section](#sec-additional-plugins) details the addition
of new plugins to nvf under regular circumstances, i.e. while making a pull
request to the project. You may _override_ those plugin inputs in your own
`flake.nix` to change source versions, e.g., to use newer versions of plugins
that are not yet updated in **nvf**.
```nix
{
inputs = {
# ...
# The name here is arbitrary, you can name it whatever.
# This will add a plugin input called "your-neodev-input"
# that you can reference in a `follows` line.
your-neodev-input = {
url = "github:folke/neodev.nvim";
flake = false;
};
nvf = {
url = "github:notashelf/nvf";
# The name of the input must match for the follows line
# plugin-neodev-nvim is what the input is called inside nvf
# so you must match the exact name here.
inputs.plugin-neodev-nvim.follows = "your-neodev-input";
};
# ...
};
}
```
This will override the source for the `neodev.nvim` plugin that is used in nvf
with your own input. You can update your new input via `nix flake update` or
more specifically `nix flake update <name of your input>` to keep it up to date.
::: {.warning}
While updating plugin inputs, make sure that any configuration that has been
deprecated in newer versions is changed in the plugin's `setupOpts`. If you
depend on a new version, requesting a version bump in the issues section is a
more reliable option.
:::

View file

@ -0,0 +1,35 @@
# Overriding plugins {#ch-overriding-plugins}
The [additional plugins section](#sec-additional-plugins) details the addition
of new plugins to nvf under regular circumstances, i.e. while making a pull
request to the project. You may _override_ those plugins in your config
to change source versions, e.g., to use newer versions of plugins
that are not yet updated in **nvf**.
```nix
vim.pluginOverrides = {
lazydev-nvim = pkgs.fetchFromGitHub {
owner = "folke";
repo = "lazydev.nvim";
rev = "";
hash = "";
};
# It's also possible to use a flake input
lazydev-nvim = inputs.lazydev-nvim;
# Or a local path
lazydev-nvim = ./lazydev;
# Or a npins pin... etc
};
```
This will override the source for the `neodev.nvim` plugin that is used in nvf
with your own plugin.
::: {.warning}
While updating plugin inputs, make sure that any configuration that has been
deprecated in newer versions is changed in the plugin's `setupOpts`. If you
depend on a new version, requesting a version bump in the issues section is a
more reliable option.
:::

View file

@ -1,36 +1,25 @@
# Adding Plugins {#sec-additional-plugins} # Adding Plugins {#sec-additional-plugins}
To add a new Neovim plugin, first add the source url in the inputs section of To add a new Neovim plugin, use `npins`
`flake.nix` with the prefix `plugin-`
Use:
`nix-shell -p npins` or `nix shell nixpkgs#npins`
Then run:
`npins add --name <plugin name> github <owner> <repo> -b <branch>`
Be sure to replace any non-alphanumeric characters with `-` for `--name`
For example
`npins add --name lazydev-nvim github folke lazydev.nvim -b main`
You can now reference this plugin as a **string**.
```nix ```nix
{ config.vim.startPlugins = ["lazydev-nvim"];
inputs = {
# ...
plugin-neodev-nvim = {
url = "github:folke/neodev.nvim";
flake = false;
};
# ...
};
}
```
Prepending `plugin-` to the name of the input will allow nvf to automatically
discover inputs that are marked as plugins, and make them available in
`vim.startPlugins` or other areas that require a very specific plugin type as it
is defined in `@NVF_REPO@/lib/types/plugins.nix`
The addition of the `plugin-` prefix will allow **nvf** to autodiscover the
input from the flake inputs automatically, allowing you to refer to it in areas
that require a very specific plugin type as defined in `lib/types/plugins.nix`
You can now reference this plugin using its string name, the plugin will be
built with the name and source URL from the flake input, allowing you to refer
to it as a **string**.
```nix
config.vim.startPlugins = ["neodev-nvim"];
``` ```
## Modular setup options {#sec-modular-setup-options} ## Modular setup options {#sec-modular-setup-options}

View file

@ -23,15 +23,17 @@ An example flake that exposes your custom Neovim configuration might look like
nvf.url = "github:notashelf/nvf"; nvf.url = "github:notashelf/nvf";
}; };
outputs = { outputs = {nixpkgs, ...} @ inputs: {
self, packages.x86_64-linux = {
nixpkgs, # Set the default package to the wrapped instance of Neovim.
... # This will allow running your Neovim configuration with
} @ inputs: { # `nix run` and in addition, sharing your configuration with
packages."x86_64-linux" = let # other users in case your repository is public.
neovimConfigured = (inputs.nvf.lib.neovimConfiguration { default =
inherit (nixpkgs.legacyPackages."x86_64-linux") pkgs; (inputs.nvf.lib.neovimConfiguration {
modules = [{ pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [
{
config.vim = { config.vim = {
# Enable custom theming options # Enable custom theming options
theme.enable = true; theme.enable = true;
@ -43,14 +45,10 @@ An example flake that exposes your custom Neovim configuration might look like
# reference in Appendix B of the nvf manual. # reference in Appendix B of the nvf manual.
# ... # ...
}; };
}]; }
}); ];
in { })
# Set the default package to the wrapped instance of Neovim. .neovim;
# This will allow running your Neovim configuration with
# `nix run` and in addition, sharing your configuration with
# other users in case your repository is public.
default = neovimConfigured.neovim;
}; };
}; };
} }

View file

@ -49,13 +49,10 @@ Followed by importing the home-manager module somewhere in your configuration.
nvf.url = "github:notashelf/nvf"; nvf.url = "github:notashelf/nvf";
}; };
outputs = { nixpkgs, home-manager, nvf, ... }: let outputs = { nixpkgs, home-manager, nvf, ... }: {
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
# ↓ this is your home output in the flake schema, expected by home-manager # ↓ this is your home output in the flake schema, expected by home-manager
"your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration {
inherit pkgs; pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [ modules = [
nvf.homeManagerModules.default # <- this imports the home-manager module that provides the options nvf.homeManagerModules.default # <- this imports the home-manager module that provides the options
./home.nix # <- your home entrypoint, `programs.nvf.*` may be defined here ./home.nix # <- your home entrypoint, `programs.nvf.*` may be defined here

View file

@ -16,26 +16,32 @@ the default theme enabled. You may use other options inside `config.vim` in
nvf.url = "github:notashelf/nvf"; nvf.url = "github:notashelf/nvf";
}; };
outputs = {nixpkgs, nvf, ...}: let outputs = {
system = "x86_64-linux"; nixpkgs,
pkgs = nixpkgs.legacyPackages.${system}; nvf,
configModule = { self,
# Add any custom options (and do feel free to upstream them!) ...
# options = { ... }; }: {
config.vim = {
theme.enable = true;
# and more options as you see fit...
};
};
customNeovim = nvf.lib.neovimConfiguration {
inherit pkgs;
modules = [configModule];
};
in {
# This will make the package available as a flake output under 'packages' # This will make the package available as a flake output under 'packages'
packages.${system}.my-neovim = customNeovim.neovim; packages.x86_64-linux.my-neovim =
(nvf.lib.neovimConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [
# Or move this to a separate file and add it's path here instead
# IE: ./nvf_module.nix
(
{pkgs, ...}: {
# Add any custom options (and do feel free to upstream them!)
# options = { ... };
config.vim = {
theme.enable = true;
# and more options as you see fit...
};
}
)
];
})
.neovim;
# Example nixosConfiguration using the configured Neovim package # Example nixosConfiguration using the configured Neovim package
nixosConfigurations = { nixosConfigurations = {
@ -43,11 +49,13 @@ the default theme enabled. You may use other options inside `config.vim` in
# ... # ...
modules = [ modules = [
# This will make wrapped neovim available in your system packages # This will make wrapped neovim available in your system packages
{environment.systemPackages = [customNeovim.neovim];} # Can also move this to another config file if you pass inputs/self around with specialArgs
({pkgs, ...}: {
environment.systemPackages = [self.packages.${pkgs.stdenv.system}.neovim];
})
]; ];
# ... # ...
}; };
}; };
}; };
} }```
```

View file

@ -1,9 +1,13 @@
# Neovim Flake Configuration Options {#ch-options} # nvf Configuration Options {#ch-options}
Below are the module options provided by nvf, in no particular order. Most Below are the module options provided by nvf, in no particular order. Most
options will include useful comments, warnings or setup tips on how a module options will include useful comments, warnings or setup tips on how a module
option is meant to be used as well as examples in complex cases. option is meant to be used as well as examples in complex cases.
An offline version of this page is bundled with nvf as a part of the manpages
which you can access with `man 5 nvf`. Please us know if you believe any of the
options below are missing useful examples.
<!-- <!--
In the manual, individual options may be referenced in Hyperlinks as follows: In the manual, individual options may be referenced in Hyperlinks as follows:
[](#opt-vim.*) If changing the prefix here, do keep in mind the #opt- suffix will have [](#opt-vim.*) If changing the prefix here, do keep in mind the #opt- suffix will have

View file

@ -1,6 +1,7 @@
# Helpful Tips {#ch-helpful-tips} # Helpful Tips {#ch-helpful-tips}
```{=include=} chapters ```{=include=} chapters
tips/pure-lua-config.md
tips/debugging-nvf.md tips/debugging-nvf.md
tips/offline-docs.md tips/offline-docs.md
``` ```

View file

@ -17,3 +17,9 @@ nvf-print-config | bat --language=lua
``` ```
Alternatively, `cat` or `less` may also be used. Alternatively, `cat` or `less` may also be used.
## Accessing `neovimConfig` {#sec-accessing-config}
It is also possible to access the configuration for the wrapped package. The
_built_ Neovim package will contain a `neovimConfig` attribute in its
`passthru`.

View file

@ -0,0 +1,117 @@
# Pure Lua Configuration {#sec-pure-lua-config}
We recognize that you might not always want to configure your setup purely in
Nix, sometimes doing things in Lua is simply the "superior" option. In such a
case you might want to configure your Neovim instance using Lua, and nothing but
Lua. It is also possible to mix Lua and Nix configurations.
Pure Lua or hybrid Lua/Nix configurations can be achieved in two different ways.
_Purely_, by modifying Neovim's runtime directory or _impurely_ by placing Lua
configuration in a directory found in `$HOME`. For your convenience, this
section will document both methods as they can be used.
## Pure Runtime Directory {#sec-pure-nvf-runtime}
As of 0.6, nvf allows you to modify Neovim's runtime path to suit your needs.
One of the ways the new runtime option is to add a configuration **located
relative to your `flake.nix`**, which must be version controlled in pure flakes
manner.
```nix
{
# Let us assume we are in the repository root, i.e., the same directory as the
# flake.nix. For the sake of the argument, we will assume that the Neovim lua
# configuration is in a nvim/ directory relative to flake.nix.
vim = {
additionalRuntimeDirectories = [
# This will be added to Neovim's runtime paths. Conceptually, this behaves
# very similarly to ~/.config/nvim but you may not place a top-level
# init.lua to be able to require it directly.
./nvim
];
};
}
```
This will add the `nvim` directory, or rather, the _store path_ that will be
realised after your flake gets copied to the Nix store, to Neovim's runtime
directory. You may now create a `lua/myconfig` directory within this nvim
directory, and call it with [](#opt-vim.luaConfigRC).
```nix
{pkgs, ...}: {
vim = {
additionalRuntimeDirectories = [
# You can list more than one file here.
./nvim-custom-1
# To make sure list items are ordered, use lib.mkBefore or lib.mkAfter
# Simply placing list items in a given order will **not** ensure that
# this list will be deterministic.
./nvim-custom-2
];
startPlugins = [pkgs.vimPlugins.gitsigns];
# Neovim supports in-line syntax highlighting for multi-line strings.
# Simply place the filetype in a /* comment */ before the line.
luaConfigRC.myconfig = /* lua */ ''
-- Call the Lua module from ./nvim/lua/myconfig
require("myconfig")
-- Any additional Lua configuration that you might want *after* your own
-- configuration. For example, a plugin setup call.
require('gitsigns').setup({})
'';
};
}
```
## Impure Absolute Directory {#sec-impure-absolute-dir}
[Neovim 0.9]: https://github.com/neovim/neovim/pull/22128
As of [Neovim 0.9], {var}`$NVIM_APPNAME` is a variable expected by Neovim to
decide on the configuration directory. nvf sets this variable as `"nvf"`,
meaning `~/.config/nvf` will be regarded as _the_ configuration directory by
Neovim, similar to how `~/.config/nvim` behaves in regular installations. This
allows some degree of Lua configuration, backed by our low-level wrapper
[mnw](https://github.com/Gerg-L/mnw). Creating a `lua/` directory located in
`$NVIM_APPNAME` ("nvf" by default) and placing your configuration in, e.g.,
`~/.config/nvf/lua/myconfig` will allow you to `require` it as a part of the Lua
module system through nvf's module system.
Let's assume your `~/.config/nvf/lua/myconfig/init.lua` consists of the
following:
```lua
-- init.lua
vim.keymap.set("n", " ", "<Nop>", { silent = true, remap = false })
vim.g.mapleader = " "
```
The following Nix configuration via [](#opt-vim.luaConfigRC) will allow loading
this
```nix
{
# The attribute name "myconfig-dir" here is arbitrary. It is required to be
# a *named* attribute by the DAG system, but the name is entirely up to you.
vim.luaConfigRC.myconfig-dir = ''
require("myconfig")
-- Any additional Lua
'';
}
```
[DAG system]: https://notashelf.github.io/nvf/index.xhtml#ch-using-dags
After you load your custom configuration, you may use an `init.lua` located in
your custom configuration directory to configure Neovim exactly as you would
without a wrapper like nvf. If you want to place your `require` call in a
specific position (i.e., before or after options you set in nvf) the
[DAG system] will let you place your configuration in a location of your
choosing.
[top-level DAG system]: https://notashelf.github.io/nvf/index.xhtml#ch-vim-luaconfigrc

View file

@ -4,6 +4,7 @@
[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim [typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim [render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
[yanky.nvim]: https://github.com/gbprod/yanky.nvim
- Add [typst-preview.nvim] under - Add [typst-preview.nvim] under
`languages.typst.extensions.typst-preview-nvim`. `languages.typst.extensions.typst-preview-nvim`.
@ -33,16 +34,25 @@
- Add [](#opt-vim.lsp.lightbulb.autocmd.enable) for manually managing the - Add [](#opt-vim.lsp.lightbulb.autocmd.enable) for manually managing the
previously managed lightbulb autocommand. previously managed lightbulb autocommand.
- A warning will occur if [](#opt-vim.lsp.lightbulb.autocmd.enable) and - A warning will occur if [](#opt-vim.lsp.lightbulb.autocmd.enable) and
`vim.lsp.lightbulb.setupOpts.autocmd.enabled` are both set at the same time. `vim.lsp.lightbulb.setupOpts.autocmd.enabled` are both set at the same time.
Pick only one. Pick only one.
- Add [yanky.nvim] to available plugins, under `vim.utility.yanky-nvim`.
[amadaluzia](https://github.com/amadaluzia): [amadaluzia](https://github.com/amadaluzia):
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim [haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
- Add Haskell support under `vim.languages.haskell` using [haskell-tools.nvim]. - Add Haskell support under `vim.languages.haskell` using [haskell-tools.nvim].
[horriblename](https://github.com/horriblename):
[blink.cmp]: https://github.com/saghen/blink.cmp
- Add [blink.cmp] support
[diniamo](https://github.com/diniamo): [diniamo](https://github.com/diniamo):
- Add Odin support under `vim.languages.odin`. - Add Odin support under `vim.languages.odin`.
@ -133,5 +143,30 @@
[ARCIII](https://github.com/ArmandoCIII): [ARCIII](https://github.com/ArmandoCIII):
[leetcode.nvim]: https://github.com/kawre/leetcode.nvim
- Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. Code - Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. Code
Inspiration from `vim.languages.clang.dap` implementation. Inspiration from `vim.languages.clang.dap` implementation.
- Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`.
[nezia1](https://github.com/nezia1)
- Add support for [nixd](https://github.com/nix-community/nixd) language server.
[folospior](https://github.com/folospior)
- Fix plugin name for lsp/lspkind.
[iynaix](https://github.com/iynaix)
- Add lsp options support for [nixd](https://github.com/nix-community/nixd)
language server.
[Mr-Helpful](https://github.com/Mr-Helpful)
- Corrects pin names used for nvim themes
[Libadoxon](https://github.com/Libadoxon)
- Add [git-conflict](https://github.com/akinsho/git-conflict.nvim) plugin for resolving git conflicts

2807
flake.lock generated

File diff suppressed because it is too large Load diff

876
flake.nix
View file

@ -7,7 +7,7 @@
} @ inputs: let } @ inputs: let
# call the extended library with `inputs` # call the extended library with `inputs`
# inputs is used to get the original standard library, and to pass inputs to the plugin autodiscovery function # inputs is used to get the original standard library, and to pass inputs to the plugin autodiscovery function
lib = import ./lib/stdlib-extended.nix inputs; lib = import ./lib/stdlib-extended.nix {inherit inputs self;};
in in
flake-parts.lib.mkFlake { flake-parts.lib.mkFlake {
inherit inputs; inherit inputs;
@ -17,6 +17,8 @@
# «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/templates
./flake/apps.nix ./flake/apps.nix
./flake/legacyPackages.nix ./flake/legacyPackages.nix
./flake/overlays.nix ./flake/overlays.nix
@ -31,7 +33,7 @@
}; };
homeManagerModules = { homeManagerModules = {
nvf = import ./flake/modules/home-manager.nix {inherit lib self;}; nvf = import ./flake/modules/home-manager.nix {inherit lib inputs;};
default = self.homeManagerModules.nvf; default = self.homeManagerModules.nvf;
neovim-flake = neovim-flake =
lib.warn '' lib.warn ''
@ -42,7 +44,7 @@
}; };
nixosModules = { nixosModules = {
nvf = import ./flake/modules/nixos.nix {inherit lib self;}; nvf = import ./flake/modules/nixos.nix {inherit lib inputs;};
default = self.nixosModules.nvf; default = self.nixosModules.nvf;
neovim-flake = neovim-flake =
lib.warn '' lib.warn ''
@ -51,6 +53,8 @@
'' ''
self.nixosModules.nvf; self.nixosModules.nvf;
}; };
inherit (lib.importJSON ./npins/sources.json) pins;
}; };
perSystem = {pkgs, ...}: { perSystem = {pkgs, ...}: {
@ -94,871 +98,5 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils"; inputs.flake-utils.follows = "flake-utils";
}; };
## Plugins
# Lazy loading
plugin-lz-n = {
url = "github:nvim-neorocks/lz.n";
flake = false;
};
plugin-lzn-auto-require = {
url = "github:horriblename/lzn-auto-require/require-rewrite";
flake = false;
};
plugin-rtp-nvim = {
url = "github:nvim-neorocks/rtp.nvim";
flake = false;
};
# LSP plugins
plugin-nvim-lspconfig = {
url = "github:neovim/nvim-lspconfig";
flake = false;
};
plugin-lspsaga = {
url = "github:tami5/lspsaga.nvim";
flake = false;
};
plugin-lspkind = {
url = "github:onsails/lspkind-nvim";
flake = false;
};
plugin-trouble = {
url = "github:folke/trouble.nvim";
flake = false;
};
plugin-nvim-treesitter-context = {
url = "github:nvim-treesitter/nvim-treesitter-context";
flake = false;
};
plugin-nvim-lightbulb = {
url = "github:kosayoda/nvim-lightbulb";
flake = false;
};
plugin-fastaction-nvim = {
url = "github:Chaitanyabsprip/fastaction.nvim";
flake = false;
};
plugin-lsp-signature = {
url = "github:ray-x/lsp_signature.nvim";
flake = false;
};
plugin-lsp-lines = {
url = "sourcehut:~whynothugo/lsp_lines.nvim";
flake = false;
};
plugin-none-ls = {
# https://github.com/nvimtools/none-ls.nvim/issues/58
url = "github:nvimtools/none-ls.nvim/bb680d752cec37949faca7a1f509e2fe67ab418a";
flake = false;
};
plugin-nvim-docs-view = {
url = "github:amrbashir/nvim-docs-view";
flake = false;
};
plugin-otter-nvim = {
url = "github:jmbuhr/otter.nvim";
flake = false;
};
# Language support
plugin-sqls-nvim = {
url = "github:nanotee/sqls.nvim";
flake = false;
};
plugin-rustaceanvim = {
url = "github:mrcjkb/rustaceanvim";
flake = false;
};
plugin-flutter-tools = {
url = "github:akinsho/flutter-tools.nvim";
flake = false;
};
plugin-neodev-nvim = {
url = "github:folke/neodev.nvim";
flake = false;
};
plugin-elixir-tools = {
url = "github:elixir-tools/elixir-tools.nvim";
flake = false;
};
plugin-ts-error-translator = {
url = "github:dmmulroy/ts-error-translator.nvim";
flake = false;
};
plugin-typst-preview-nvim = {
url = "github:chomosuke/typst-preview.nvim";
flake = false;
};
plugin-nvim-metals = {
url = "github:scalameta/nvim-metals";
flake = false;
};
plugin-omnisharp-extended = {
url = "github:Hoffs/omnisharp-extended-lsp.nvim";
flake = false;
};
plugin-csharpls-extended = {
url = "github:Decodetalkers/csharpls-extended-lsp.nvim";
flake = false;
};
# Copying/Registers
plugin-registers = {
url = "github:tversteeg/registers.nvim";
flake = false;
};
plugin-nvim-neoclip = {
url = "github:AckslD/nvim-neoclip.lua";
flake = false;
};
# Pickers
plugin-telescope = {
url = "github:nvim-telescope/telescope.nvim";
flake = false;
};
plugin-fzf-lua = {
url = "github:ibhagwan/fzf-lua";
flake = false;
};
# Runners
plugin-run-nvim = {
url = "github:diniamo/run.nvim";
flake = false;
};
# Debuggers
plugin-nvim-dap = {
url = "github:mfussenegger/nvim-dap";
flake = false;
};
plugin-nvim-dap-ui = {
url = "github:rcarriga/nvim-dap-ui";
flake = false;
};
plugin-nvim-dap-go = {
url = "github:leoluz/nvim-dap-go";
flake = false;
};
# Filetrees
plugin-nvim-tree-lua = {
url = "github:nvim-tree/nvim-tree.lua";
flake = false;
};
plugin-neo-tree-nvim = {
url = "github:nvim-neo-tree/neo-tree.nvim";
flake = false;
};
# Tablines
plugin-nvim-bufferline-lua = {
url = "github:akinsho/nvim-bufferline.lua";
flake = false;
};
# Statuslines
plugin-lualine = {
url = "github:hoob3rt/lualine.nvim";
flake = false;
};
plugin-nvim-cmp = {
url = "github:hrsh7th/nvim-cmp";
flake = false;
};
plugin-cmp-buffer = {
url = "github:hrsh7th/cmp-buffer";
flake = false;
};
plugin-cmp-nvim-lsp = {
url = "github:hrsh7th/cmp-nvim-lsp";
flake = false;
};
plugin-cmp-path = {
url = "github:hrsh7th/cmp-path";
flake = false;
};
plugin-cmp-treesitter = {
url = "github:ray-x/cmp-treesitter";
flake = false;
};
plugin-cmp-luasnip = {
url = "github:saadparwaiz1/cmp_luasnip";
flake = false;
};
# snippets
plugin-luasnip = {
url = "github:L3MON4D3/LuaSnip";
flake = false;
};
plugin-friendly-snippets = {
url = "github:rafamadriz/friendly-snippets";
flake = false;
};
# Presence
plugin-neocord = {
url = "github:IogaMaster/neocord";
flake = false; # uses flake-utils, avoid the flake
};
# Autopairs
plugin-nvim-autopairs = {
url = "github:windwp/nvim-autopairs";
flake = false;
};
plugin-nvim-ts-autotag = {
url = "github:windwp/nvim-ts-autotag";
flake = false;
};
# Commenting
plugin-comment-nvim = {
url = "github:numToStr/Comment.nvim";
flake = false;
};
plugin-todo-comments = {
url = "github:folke/todo-comments.nvim";
flake = false;
};
# Buffer tools
plugin-bufdelete-nvim = {
url = "github:famiu/bufdelete.nvim";
flake = false;
};
# Dashboard Utilities
plugin-dashboard-nvim = {
url = "github:glepnir/dashboard-nvim";
flake = false;
};
plugin-alpha-nvim = {
url = "github:goolord/alpha-nvim";
flake = false;
};
plugin-vim-startify = {
url = "github:mhinz/vim-startify";
flake = false;
};
# Themes
plugin-base16 = {
url = "github:rrethy/base16-nvim";
flake = false;
};
plugin-tokyonight = {
url = "github:folke/tokyonight.nvim";
flake = false;
};
plugin-onedark = {
url = "github:navarasu/onedark.nvim";
flake = false;
};
plugin-catppuccin = {
url = "github:catppuccin/nvim";
flake = false;
};
plugin-dracula = {
url = "github:Mofiqul/dracula.nvim";
flake = false;
};
plugin-oxocarbon = {
url = "github:nyoom-engineering/oxocarbon.nvim";
flake = false;
};
plugin-gruvbox = {
url = "github:ellisonleao/gruvbox.nvim";
flake = false;
};
plugin-rose-pine = {
url = "github:rose-pine/neovim";
flake = false;
};
plugin-nord = {
url = "github:gbprod/nord.nvim";
flake = false;
};
# Rust crates
plugin-crates-nvim = {
url = "github:Saecki/crates.nvim";
flake = false;
};
# Project Management
plugin-project-nvim = {
url = "github:ahmedkhalf/project.nvim";
flake = false;
};
# Visuals
plugin-nvim-cursorline = {
url = "github:yamatsum/nvim-cursorline";
flake = false;
};
plugin-nvim-scrollbar = {
url = "github:petertriho/nvim-scrollbar";
flake = false;
};
plugin-cinnamon-nvim = {
url = "github:declancm/cinnamon.nvim";
flake = false;
};
plugin-cellular-automaton = {
url = "github:Eandrju/cellular-automaton.nvim";
flake = false;
};
plugin-indent-blankline = {
url = "github:lukas-reineke/indent-blankline.nvim";
flake = false;
};
plugin-nvim-web-devicons = {
url = "github:nvim-tree/nvim-web-devicons";
flake = false;
};
plugin-tiny-devicons-auto-colors = {
url = "github:rachartier/tiny-devicons-auto-colors.nvim";
flake = false;
};
plugin-gitsigns-nvim = {
url = "github:lewis6991/gitsigns.nvim";
flake = false;
};
plugin-vim-fugitive = {
url = "github:tpope/vim-fugitive";
flake = false;
};
plugin-fidget-nvim = {
url = "github:j-hui/fidget.nvim";
flake = false;
};
plugin-highlight-undo = {
url = "github:tzachar/highlight-undo.nvim";
flake = false;
};
plugin-render-markdown-nvim = {
url = "github:MeanderingProgrammer/render-markdown.nvim";
flake = false;
};
plugin-rainbow-delimiters = {
url = "github:HiPhish/rainbow-delimiters.nvim";
flake = false;
};
# Minimap
plugin-minimap-vim = {
url = "github:wfxr/minimap.vim";
flake = false;
};
plugin-codewindow-nvim = {
url = "github:gorbit99/codewindow.nvim";
flake = false;
};
# Notifications
plugin-nvim-notify = {
url = "github:rcarriga/nvim-notify";
flake = false;
};
# Utilities
plugin-ccc = {
url = "github:uga-rosa/ccc.nvim";
flake = false;
};
plugin-diffview-nvim = {
url = "github:sindrets/diffview.nvim";
flake = false;
};
plugin-icon-picker-nvim = {
url = "github:ziontee113/icon-picker.nvim";
flake = false;
};
plugin-which-key = {
url = "github:folke/which-key.nvim";
flake = false;
};
plugin-cheatsheet-nvim = {
url = "github:sudormrfbin/cheatsheet.nvim";
flake = false;
};
plugin-gesture-nvim = {
url = "github:notomo/gesture.nvim";
flake = false;
};
plugin-hop-nvim = {
url = "github:phaazon/hop.nvim";
flake = false;
};
plugin-leap-nvim = {
url = "github:ggandor/leap.nvim";
flake = false;
};
plugin-smartcolumn = {
url = "github:m4xshen/smartcolumn.nvim";
flake = false;
};
plugin-nvim-surround = {
url = "github:kylechui/nvim-surround";
flake = false;
};
plugin-glow-nvim = {
url = "github:ellisonleao/glow.nvim";
flake = false;
};
plugin-image-nvim = {
url = "github:3rd/image.nvim";
flake = false;
};
plugin-precognition-nvim = {
url = "github:tris203/precognition.nvim";
flake = false;
};
# Note-taking
plugin-obsidian-nvim = {
url = "github:epwalsh/obsidian.nvim";
flake = false;
};
plugin-orgmode-nvim = {
url = "github:nvim-orgmode/orgmode";
flake = false;
};
plugin-mind-nvim = {
url = "github:phaazon/mind.nvim";
flake = false;
};
# Spellchecking
plugin-vim-dirtytalk = {
url = "github:psliwka/vim-dirtytalk";
flake = false;
};
# Terminal
plugin-toggleterm-nvim = {
url = "github:akinsho/toggleterm.nvim";
flake = false;
};
# UI
plugin-nvim-navbuddy = {
url = "github:SmiteshP/nvim-navbuddy";
flake = false;
};
plugin-nvim-navic = {
url = "github:SmiteshP/nvim-navic";
flake = false;
};
plugin-noice-nvim = {
url = "github:folke/noice.nvim";
flake = false;
};
plugin-modes-nvim = {
url = "github:mvllow/modes.nvim";
flake = false;
};
plugin-nvim-colorizer-lua = {
url = "github:NvChad/nvim-colorizer.lua";
flake = false;
};
plugin-vim-illuminate = {
url = "github:RRethy/vim-illuminate";
flake = false;
};
# Assistant
plugin-chatgpt = {
url = "github:jackMort/ChatGPT.nvim";
flake = false;
};
plugin-copilot-lua = {
url = "github:zbirenbaum/copilot.lua";
flake = false;
};
plugin-copilot-cmp = {
url = "github:zbirenbaum/copilot-cmp";
flake = false;
};
# Session management
plugin-nvim-session-manager = {
url = "github:Shatur/neovim-session-manager";
flake = false;
};
# Dependencies
plugin-plenary-nvim = {
# (required by crates-nvim)
url = "github:nvim-lua/plenary.nvim";
flake = false;
};
plugin-dressing-nvim = {
# (required by icon-picker-nvim)
url = "github:stevearc/dressing.nvim";
flake = false;
};
plugin-vim-markdown = {
# (required by obsidian-nvim)
url = "github:preservim/vim-markdown";
flake = false;
};
plugin-tabular = {
# (required by vim-markdown)
url = "github:godlygeek/tabular";
flake = false;
};
plugin-lua-utils-nvim = {
url = "github:nvim-neorg/lua-utils.nvim";
flake = false;
};
plugin-pathlib-nvim = {
url = "github:pysan3/pathlib.nvim";
flake = false;
};
plugin-neorg = {
url = "github:nvim-neorg/neorg";
flake = false;
};
plugin-neorg-telescope = {
url = "github:nvim-neorg/neorg-telescope";
flake = false;
};
plugin-nui-nvim = {
# (required by noice.nvim)
url = "github:MunifTanjim/nui.nvim";
flake = false;
};
plugin-vim-repeat = {
# (required by leap.nvim)
url = "github:tpope/vim-repeat";
flake = false;
};
plugin-nvim-nio = {
# (required by nvim-dap-ui)
url = "github:nvim-neotest/nvim-nio";
flake = false;
};
plugin-promise-async = {
url = "github:kevinhwang91/promise-async";
flake = false;
};
plugin-nvim-ufo = {
url = "github:kevinhwang91/nvim-ufo";
flake = false;
};
plugin-new-file-template-nvim = {
# (required by new-file-template.nvim)
url = "github:otavioschwanck/new-file-template.nvim";
flake = false;
};
plugin-haskell-tools-nvim = {
url = "github:mrcjkb/haskell-tools.nvim";
flake = false;
};
plugin-aerial-nvim = {
url = "github:stevearc/aerial.nvim";
flake = false;
};
# Mini.nvim
plugin-mini-ai = {
url = "github:echasnovski/mini.ai";
flake = false;
};
plugin-mini-align = {
url = "github:echasnovski/mini.align";
flake = false;
};
plugin-mini-animate = {
url = "github:echasnovski/mini.animate";
flake = false;
};
plugin-mini-base16 = {
url = "github:echasnovski/mini.base16";
flake = false;
};
plugin-mini-basics = {
url = "github:echasnovski/mini.basics";
flake = false;
};
plugin-mini-bracketed = {
url = "github:echasnovski/mini.bracketed";
flake = false;
};
plugin-mini-bufremove = {
url = "github:echasnovski/mini.bufremove";
flake = false;
};
plugin-mini-clue = {
url = "github:echasnovski/mini.clue";
flake = false;
};
plugin-mini-colors = {
url = "github:echasnovski/mini.colors";
flake = false;
};
plugin-mini-comment = {
url = "github:echasnovski/mini.comment";
flake = false;
};
plugin-mini-completion = {
url = "github:echasnovski/mini.completion";
flake = false;
};
plugin-mini-diff = {
url = "github:echasnovski/mini.diff";
flake = false;
};
plugin-mini-doc = {
url = "github:echasnovski/mini.doc";
flake = false;
};
plugin-mini-extra = {
url = "github:echasnovski/mini.extra";
flake = false;
};
plugin-mini-files = {
url = "github:echasnovski/mini.files";
flake = false;
};
plugin-mini-fuzzy = {
url = "github:echasnovski/mini.fuzzy";
flake = false;
};
plugin-mini-git = {
url = "github:echasnovski/mini-git";
flake = false;
};
plugin-mini-hipatterns = {
url = "github:echasnovski/mini.hipatterns";
flake = false;
};
plugin-mini-hues = {
url = "github:echasnovski/mini.hues";
flake = false;
};
plugin-mini-icons = {
url = "github:echasnovski/mini.icons";
flake = false;
};
plugin-mini-indentscope = {
url = "github:echasnovski/mini.indentscope";
flake = false;
};
plugin-mini-jump = {
url = "github:echasnovski/mini.jump";
flake = false;
};
plugin-mini-jump2d = {
url = "github:echasnovski/mini.jump2d";
flake = false;
};
plugin-mini-map = {
url = "github:echasnovski/mini.map";
flake = false;
};
plugin-mini-misc = {
url = "github:echasnovski/mini.misc";
flake = false;
};
plugin-mini-move = {
url = "github:echasnovski/mini.move";
flake = false;
};
plugin-mini-notify = {
url = "github:echasnovski/mini.notify";
flake = false;
};
plugin-mini-operators = {
url = "github:echasnovski/mini.operators";
flake = false;
};
plugin-mini-pairs = {
url = "github:echasnovski/mini.pairs";
flake = false;
};
plugin-mini-pick = {
url = "github:echasnovski/mini.pick";
flake = false;
};
plugin-mini-sessions = {
url = "github:echasnovski/mini.sessions";
flake = false;
};
plugin-mini-snippets = {
url = "github:echasnovski/mini.snippets";
flake = false;
};
plugin-mini-splitjoin = {
url = "github:echasnovski/mini.splitjoin";
flake = false;
};
plugin-mini-starter = {
url = "github:echasnovski/mini.starter";
flake = false;
};
plugin-mini-statusline = {
url = "github:echasnovski/mini.statusline";
flake = false;
};
plugin-mini-surround = {
url = "github:echasnovski/mini.surround";
flake = false;
};
plugin-mini-tabline = {
url = "github:echasnovski/mini.tabline";
flake = false;
};
plugin-mini-test = {
url = "github:echasnovski/mini.test";
flake = false;
};
plugin-mini-trailspace = {
url = "github:echasnovski/mini.trailspace";
flake = false;
};
plugin-mini-visits = {
url = "github:echasnovski/mini.visits";
flake = false;
};
}; };
} }

View file

@ -9,7 +9,7 @@
default = self'.devShells.lsp; default = self'.devShells.lsp;
nvim-nix = pkgs.mkShellNoCC {packages = [config.packages.nix];}; nvim-nix = pkgs.mkShellNoCC {packages = [config.packages.nix];};
lsp = pkgs.mkShellNoCC { lsp = pkgs.mkShellNoCC {
packages = with pkgs; [nil statix deadnix alejandra]; packages = with pkgs; [nil statix deadnix alejandra npins];
}; };
}; };

View file

@ -1,4 +1,8 @@
{inputs, ...}: { {
inputs,
self,
...
}: {
perSystem = { perSystem = {
system, system,
inputs', inputs',
@ -9,10 +13,21 @@
overlays = [ overlays = [
inputs.self.overlays.default inputs.self.overlays.default
(_: _: { (final: prev: {
# Build nil from source to get most recent # Build nil from source to get most recent
# features as they are added. # features as they are added.
nil = inputs'.nil.packages.default; nil = inputs'.nil.packages.default;
blink-cmp = let
pin = self.pins.blink-cmp;
in
final.callPackage ./legacyPackages/blink-cmp.nix {
inherit (pin) version;
src = prev.fetchFromGitHub {
inherit (pin.repository) owner repo;
rev = pin.revision;
sha256 = pin.hash;
};
};
}) })
]; ];
}; };

View file

@ -0,0 +1,38 @@
{
rustPlatform,
hostPlatform,
vimUtils,
git,
src,
version,
}: let
blink-fuzzy-lib = rustPlatform.buildRustPackage {
pname = "blink-fuzzy-lib";
inherit version src;
# TODO: remove this if plugin stops using nightly rust
env.RUSTC_BOOTSTRAP = true;
nativeBuildInputs = [git];
cargoLock = {
lockFile = "${src}/Cargo.lock";
allowBuiltinFetchGit = true;
};
};
libExt =
if hostPlatform.isDarwin
then "dylib"
else "so";
in
vimUtils.buildVimPlugin {
pname = "blink-cmp";
inherit version src;
# blink references a repro.lua which is placed outside the lua/ directory
doCheck = false;
preInstall = ''
mkdir -p target/release
ln -s ${blink-fuzzy-lib}/lib/libblink_cmp_fuzzy.${libExt} target/release/libblink_cmp_fuzzy.${libExt}
'';
}

View file

@ -1,13 +1,13 @@
# Home Manager module # Home Manager module
{ {
self, inputs,
lib, lib,
}: { }: {
config, config,
pkgs, pkgs,
... ...
}: let }: let
inherit (self) packages inputs; inherit (inputs.self) packages;
inherit (lib) maintainers; inherit (lib) maintainers;
inherit (lib.modules) mkIf mkAliasOptionModule; inherit (lib.modules) mkIf mkAliasOptionModule;
inherit (lib.lists) optional; inherit (lib.lists) optional;

View file

@ -1,13 +1,13 @@
# NixOS module # NixOS module
{ {
self, inputs,
lib, lib,
}: { }: {
config, config,
pkgs, pkgs,
... ...
}: let }: let
inherit (self) inputs packages; inherit (inputs.self) packages;
inherit (lib) maintainers; inherit (lib) maintainers;
inherit (lib.modules) mkIf mkOverride mkAliasOptionModule; inherit (lib.modules) mkIf mkOverride mkAliasOptionModule;
inherit (lib.lists) optional; inherit (lib.lists) optional;

View file

@ -10,10 +10,10 @@
nixConfig = import ../configuration.nix false; nixConfig = import ../configuration.nix false;
maximalConfig = import ../configuration.nix true; maximalConfig = import ../configuration.nix true;
in { in {
flake.overlays.default = _final: prev: { flake.overlays.default = final: _prev: {
inherit neovimConfiguration; inherit neovimConfiguration;
neovim-nix = buildPkg prev [nixConfig]; neovim-nix = buildPkg final [nixConfig];
neovim-maximal = buildPkg prev [maximalConfig]; neovim-maximal = buildPkg final [maximalConfig];
devPkg = buildPkg pkgs [nixConfig {config.vim.languages.html.enable = pkgs.lib.mkForce true;}]; devPkg = buildPkg pkgs [nixConfig {config.vim.languages.html.enable = pkgs.lib.mkForce true;}];
}; };
} }

View file

@ -19,9 +19,11 @@
in in
pkgs.testers.lycheeLinkCheck { pkgs.testers.lycheeLinkCheck {
inherit site; inherit site;
remap = { remap = {
"https://notashelf.github.io/nvf/" = site; "https://notashelf.github.io/nvf/" = site;
}; };
extraConfig = { extraConfig = {
exclude = []; exclude = [];
include_mail = true; include_mail = true;
@ -29,43 +31,39 @@
}; };
}; };
# Build and open the built manual in your system browser # Helper utility for building the HTML manual and opening it in the
docs-html-wrapped = pkgs.writeScriptBin "docs-html-wrapped" '' # browser with $BROWSER or using xdg-open as a fallback tool.
#!${pkgs.stdenv.shell} # Adapted from Home-Manager, available under the MIT license.
# use xdg-open to open the docs in the browser docs-html-wrapped = let
${pkgs.xdg-utils}/bin/xdg-open ${docs.manual.html} xdg-open = lib.getExe' pkgs.xdg-utils "xdg-open";
''; docs-html = docs.manual.html + /share/doc/nvf;
in
pkgs.writeShellScriptBin "docs-html-wrapped" ''
set -euo pipefail
if [[ ! -v BROWSER || -z $BROWSER ]]; then
for candidate in xdg-open open w3m; do
BROWSER="$(type -P $candidate || true)"
if [[ -x $BROWSER ]]; then
break;
fi
done
fi
if [[ ! -v BROWSER || -z $BROWSER ]]; then
echo "$0: unable to start a web browser; please set \$BROWSER"
echo "$0: Trying xdg-open as a fallback"
${xdg-open} ${docs-html}/index.xhtml
else
echo "\$BROWSER is set. Attempting to open manual"
exec "$BROWSER" "${docs-html}/index.xhtml"
fi
'';
# Exposed neovim configurations # Exposed neovim configurations
nix = config.legacyPackages.neovim-nix; nix = config.legacyPackages.neovim-nix;
maximal = config.legacyPackages.neovim-maximal; maximal = config.legacyPackages.neovim-maximal;
default = config.legacyPackages.neovim-nix; default = config.legacyPackages.neovim-nix;
# Published docker images
docker-nix = let
inherit (pkgs) bash gitFull buildEnv;
inherit (config.legacyPackages) neovim-nix;
in
pkgs.dockerTools.buildImage {
name = "nvf";
tag = "latest";
copyToRoot = buildEnv {
name = "neovim-root";
pathsToLink = ["/bin"];
paths = [
neovim-nix
gitFull
bash
];
};
config = {
Cmd = ["${neovim-nix}/bin/nvim"];
WorkingDir = "/home/neovim/demo";
Volumes = {"/home/neovim/demo" = {};};
};
};
}; };
}; };
} }

View file

@ -0,0 +1,17 @@
{
flake.templates = {
standalone = {
path = ./standalone;
description = "Standalone flake template for nvf";
welcomeText = ''
Template flake.nix has been created in flake.nix!
Note that this is a very basic example to bootstrap nvf for you. Please edit your
configuration as described in the nvf manual before using this template. The
configured packages will be ran with 'nix run .' or 'nix run .#neovimConfigured'
Happy editing!
'';
};
};
}

View file

@ -0,0 +1,64 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nvf.url = "github:notashelf/nvf";
};
outputs = {
self,
nixpkgs,
...
} @ inputs: let
# An abstraction over systems to easily provide the same package
# for multiple systems. This is preferable to abstraction libraries.
forEachSystem = nixpkgs.lib.genAttrs ["x86_64-linux"];
in {
packages = forEachSystem (system: let
pkgs = inputs.nixpkgs.legacyPackages.${system};
# A module to be evaluated via lib.evalModules inside nvf's module system.
# All options supported by nvf will go under config.vim to create the final
# wrapped package. You may also add some new *options* under options.* to
# expand the module system.
configModule = {
# You may browse available options for nvf on the online manual. Please see
# <https://notashelf.github.io/nvf/options.html>
config.vim = {
theme.enable = true;
# Language support and automatic configuration of companion plugins.
# Note that enabling, e.g., languages.<lang>.diagnostics will automatically
# enable top-level options such as enableLSP or enableExtraDiagnostics as
# they are needed.
languages = {
enableLSP = true;
enableFormat = true;
enableTreesitter = true;
enableExtraDiagnostics = true;
# Nix language and diagnostics.
nix.enable = true;
};
};
};
# Evaluate any and all modules to create the wrapped Neovim package.
neovimConfigured = inputs.nvf.lib.neovimConfiguration {
inherit pkgs;
modules = [
# Configuration module to be imported. You may define multiple modules
# or even import them from other files (e.g., ./modules/lsp.nix) to
# better modularize your configuration.
configModule
];
};
in {
# Packages to be exposed under packages.<system>. Those can accessed
# directly from package outputs in other flakes if this flake is added
# as an input. You may run those packages with 'nix run .#<package>'
default = self.packages.${system}.neovim;
neovimConfigured = neovimConfigured.neovim;
});
};
}

View file

@ -24,7 +24,7 @@ in {
entryAfter, and entryBefore to a topologically sorted list of entryAfter, and entryBefore to a topologically sorted list of
entries. entries.
Internally this function uses the `toposort` function in Internally this function uses the `topoSort` function in
`<nixpkgs/lib/lists.nix>` and its value is accordingly. `<nixpkgs/lib/lists.nix>` and its value is accordingly.
Specifically, the result on success is Specifically, the result on success is
@ -136,16 +136,26 @@ in {
entriesAfter = tag: entriesBetween tag []; entriesAfter = tag: entriesBetween tag [];
entriesBefore = tag: before: entriesBetween tag before []; entriesBefore = tag: before: entriesBetween tag before [];
# mkLuarcSection and mkVimrcSection take a section DAG # mkLuarcSection takes a section DAG, containing 'name' and 'data' fields
# and return a string containing a comment to identify # then returns a string containing a comment to identify the section, and
# the data contained within the section.
# the section, and the data contained within the section # the section, and the data contained within the section
# #
# all operations are done without any modifications # All operations are done without any modifications to the inputted section
# to the inputted section data # data, but if a non-string is passed to name or data, then it will try to
mkLuarcSection = section: '' # coerce it into a string, which may fail. Setting data to "" or null will
-- SECTION: ${section.name} # return an empty string.
${section.data} #
''; # section.data should never be null, though taking 'null' as a value that
# can "clear" the DAG might come in handy for filtering sections more easily.
# Or perhaps simply unsetting them from an user perspective.
mkLuarcSection = section:
if section.data == "" || section.data == null
then ""
else ''
-- SECTION: ${section.name}
${section.data}
'';
resolveDag = { resolveDag = {
name, name,

View file

@ -1,10 +1,10 @@
{ {
self,
inputs, inputs,
lib, lib,
... ...
}: { }: {
types = import ./types {inherit inputs lib;}; types = import ./types {inherit lib;};
config = import ./config.nix {inherit lib;}; config = import ./config.nix {inherit lib;};
binds = import ./binds.nix {inherit lib;}; binds = import ./binds.nix {inherit lib;};
dag = import ./dag.nix {inherit lib;}; dag = import ./dag.nix {inherit lib;};
@ -12,5 +12,5 @@
lists = import ./lists.nix {inherit lib;}; lists = import ./lists.nix {inherit lib;};
attrsets = import ./attrsets.nix {inherit lib;}; attrsets = import ./attrsets.nix {inherit lib;};
lua = import ./lua.nix {inherit lib;}; lua = import ./lua.nix {inherit lib;};
neovimConfiguration = import ../modules {inherit inputs lib;}; neovimConfiguration = import ../modules {inherit self inputs lib;};
} }

View file

@ -1,6 +1,10 @@
# Convenience function that returns the given Nixpkgs standard library # Convenience function that returns the given Nixpkgs standard library
# extended with our functions using `lib.extend`. # extended with our functions using `lib.extend`.
inputs: {
inputs,
self,
...
} @ args:
inputs.nixpkgs.lib.extend (self: super: { inputs.nixpkgs.lib.extend (self: super: {
# WARNING: New functions should not be added here, but to files # WARNING: New functions should not be added here, but to files
# imported by `./default.nix` under their own categories. If your # imported by `./default.nix` under their own categories. If your
@ -12,7 +16,7 @@ inputs.nixpkgs.lib.extend (self: super: {
# E.g. for an input called `nvf`, `inputs.nvf.lib.nvim` will return the set # E.g. for an input called `nvf`, `inputs.nvf.lib.nvim` will return the set
# below. # below.
nvim = import ./. { nvim = import ./. {
inherit inputs; inherit (args) inputs self;
lib = self; lib = self;
}; };

View file

@ -1,10 +1,6 @@
{ {lib}: let
inputs,
lib,
...
}: let
typesDag = import ./dag.nix {inherit lib;}; typesDag = import ./dag.nix {inherit lib;};
typesPlugin = import ./plugins.nix {inherit inputs lib;}; typesPlugin = import ./plugins.nix {inherit lib;};
typesLanguage = import ./languages.nix {inherit lib;}; typesLanguage = import ./languages.nix {inherit lib;};
customTypes = import ./custom.nix {inherit lib;}; customTypes = import ./custom.nix {inherit lib;};
in { in {

View file

@ -1,12 +1,8 @@
{ {lib}: let
inputs,
lib,
...
}: let
inherit (lib.options) mkOption; inherit (lib.options) mkOption;
inherit (lib.attrsets) attrNames mapAttrs' filterAttrs nameValuePair; inherit (lib.attrsets) attrNames mapAttrs' filterAttrs nameValuePair;
inherit (lib.strings) hasPrefix removePrefix; 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 anything listOf nullOr;
# Get the names of all flake inputs that start with the given prefix. # Get the names of all flake inputs that start with the given prefix.
fromInputs = { fromInputs = {
@ -15,11 +11,8 @@
}: }:
mapAttrs' (n: v: nameValuePair (removePrefix prefix n) {src = v;}) (filterAttrs (n: _: hasPrefix prefix n) inputs); mapAttrs' (n: v: nameValuePair (removePrefix prefix n) {src = v;}) (filterAttrs (n: _: hasPrefix prefix n) inputs);
# Get the names of all flake inputs that start with the given prefix. # Get the names of all npins
pluginInputNames = attrNames (fromInputs { pluginInputNames = attrNames (lib.importJSON ../../npins/sources.json).pins;
inherit inputs;
prefix = "plugin-";
});
# You can either use the name of the plugin or a package. # You can either use the name of the plugin or a package.
pluginType = nullOr ( pluginType = nullOr (

View file

@ -1,4 +1,5 @@
{ {
self,
inputs, inputs,
lib, lib,
}: { }: {
@ -23,7 +24,7 @@
specialArgs = specialArgs =
extraSpecialArgs extraSpecialArgs
// { // {
inherit inputs; inherit self inputs;
modulesPath = toString ./.; modulesPath = toString ./.;
}; };
modules = concatLists [ modules = concatLists [

View file

@ -4,6 +4,7 @@
inherit (lib.nvim.config) batchRenameOptions; inherit (lib.nvim.config) batchRenameOptions;
renamedVimOpts = batchRenameOptions ["vim"] ["vim" "options"] { renamedVimOpts = batchRenameOptions ["vim"] ["vim" "options"] {
# 2024-12-01
colourTerm = "termguicolors"; colourTerm = "termguicolors";
mouseSupport = "mouse"; mouseSupport = "mouse";
cmdHeight = "cmdheight"; cmdHeight = "cmdheight";
@ -15,6 +16,9 @@
autoIndent = "autoindent"; autoIndent = "autoindent";
wordWrap = "wrap"; wordWrap = "wrap";
showSignColumn = "signcolumn"; showSignColumn = "signcolumn";
# 2025-02-07
scrollOff = "scrolloff";
}; };
in { in {
imports = concatLists [ imports = concatLists [
@ -93,9 +97,15 @@ in {
# 2024-12-02 # 2024-12-02
(mkRenamedOptionModule ["vim" "enableEditorconfig"] ["vim" "globals" "editorconfig"]) (mkRenamedOptionModule ["vim" "enableEditorconfig"] ["vim" "globals" "editorconfig"])
# 2025-02-06
(mkRemovedOptionModule ["vim" "disableArrows"] ''
Top-level convenience options are now in the process of being removed from nvf as
their behaviour was abstract, and confusing. Please use 'vim.options' or 'vim.luaConfigRC'
to replicate previous behaviour.
'')
] ]
# 2024-12-01
# Migrated via batchRenameOptions. Further batch renames must be below this line. # Migrated via batchRenameOptions. Further batch renames must be below this line.
renamedVimOpts renamedVimOpts
]; ];

View file

@ -23,7 +23,9 @@
"completion" "completion"
"dashboard" "dashboard"
"debugger" "debugger"
"diagnostics"
"filetree" "filetree"
"formatter"
"git" "git"
"languages" "languages"
"lsp" "lsp"

View file

@ -16,12 +16,6 @@
cfg = config.vim; cfg = config.vim;
in { in {
options.vim = { options.vim = {
disableArrows = mkOption {
type = bool;
default = false;
description = "Set to prevent arrow keys from moving cursor";
};
hideSearchHighlight = mkOption { hideSearchHighlight = mkOption {
type = bool; type = bool;
default = false; default = false;

View file

@ -26,34 +26,6 @@
in { in {
config = { config = {
vim.keymaps = mkMerge [ vim.keymaps = mkMerge [
(
mkIf cfg.disableArrows [
{
key = "<up>";
mode = ["n" "i"];
action = "<nop>";
noremap = false;
}
{
key = "<down>";
mode = ["n" "i"];
action = "<nop>";
noremap = false;
}
{
key = "<left>";
mode = ["n" "i"];
action = "<nop>";
noremap = false;
}
{
key = "<right>";
mode = ["n" "i"];
action = "<nop>";
noremap = false;
}
]
)
( (
pipe cfg.maps pipe cfg.maps
[ [

View file

@ -30,17 +30,19 @@
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
startPlugins = [ startPlugins = ["chatgpt-nvim"];
"chatgpt"
];
pluginRC.chagpt = entryAnywhere '' pluginRC.chagpt = entryAnywhere ''
require("chatgpt").setup(${toLuaObject cfg.setupOpts}) require("chatgpt").setup(${toLuaObject cfg.setupOpts})
''; '';
maps.normal = mkMerge [
(mkSetBinding mappings.chatGpt "<cmd>ChatGPT<CR>") maps = {
maps visual = maps;
]; normal = mkMerge [
maps.visual = maps; (mkSetBinding mappings.chatGpt "<cmd>ChatGPT<CR>")
maps
];
};
}; };
}; };
} }

View file

@ -0,0 +1,120 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption mkOption literalMD;
inherit (lib.types) listOf str either attrsOf submodule enum anything int nullOr;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.nvim.config) mkBool;
keymapType = submodule {
freeformType = attrsOf (listOf (either str luaInline));
options = {
preset = mkOption {
type = enum ["default" "none" "super-tab" "enter"];
default = "none";
description = "keymap presets";
};
};
};
providerType = submodule {
freeformType = anything;
options = {
module = mkOption {
type = str;
description = "module of the provider";
};
};
};
in {
options.vim.autocomplete.blink-cmp = {
enable = mkEnableOption "blink.cmp";
setupOpts = mkPluginSetupOption "blink.cmp" {
sources = {
default = mkOption {
type = listOf str;
default = ["lsp" "path" "snippets" "buffer"];
description = "Default list of sources to enable for completion.";
};
cmdline = mkOption {
type = nullOr (listOf str);
default = [];
description = "List of sources to enable for cmdline. Null means use default source list.";
};
providers = mkOption {
type = attrsOf providerType;
default = {};
description = "Settings for completion providers";
};
transform_items = mkOption {
type = nullOr luaInline;
default = mkLuaInline "function(_, items) return items end";
defaultText = ''
Our default does nothing. If you want blink.cmp's default, which
lowers the score for snippets, set this option to null.
'';
description = ''
Function to use when transforming the items before they're returned
for all providers.
'';
};
};
completion = {
documentation = {
auto_show = mkBool true "Show documentation whenever an item is selected";
auto_show_delay_ms = mkOption {
type = int;
default = 200;
description = "Delay before auto show triggers";
};
};
};
keymap = mkOption {
type = keymapType;
default = {};
description = "blink.cmp keymap";
example = literalMD ''
```nix
vim.autocomplete.blink-cmp.setupOpts.keymap = {
preset = "none";
"<Up>" = ["select_prev" "fallback"];
"<C-n>" = [
(lib.generators.mkLuaInline ''''
function(cmp)
if some_condition then return end -- runs the next command
return true -- doesn't run the next command
end,
'''')
"select_next"
];
};
```
'';
};
fuzzy = {
prebuilt_binaries = {
download = mkBool false ''
Auto-downloads prebuilt binaries. Do not enable, it doesn't work on nix
'';
};
};
};
mappings = {
complete = mkMappingOption "Complete [blink.cmp]" "<C-Space>";
confirm = mkMappingOption "Confirm [blink.cmp]" "<CR>";
next = mkMappingOption "Next item [blink.cmp]" "<Tab>";
previous = mkMappingOption "Previous item [blink.cmp]" "<S-Tab>";
close = mkMappingOption "Close [blink.cmp]" "<C-e>";
scrollDocsUp = mkMappingOption "Scroll docs up [blink.cmp]" "<C-d>";
scrollDocsDown = mkMappingOption "Scroll docs down [blink.cmp]" "<C-f>";
};
};
}

View file

@ -0,0 +1,91 @@
{
lib,
config,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.strings) optionalString;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.lua) toLuaObject;
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
cfg = config.vim.autocomplete.blink-cmp;
cmpCfg = config.vim.autocomplete.nvim-cmp;
inherit (cfg) mappings;
getPluginName = plugin:
if typeOf plugin == "string"
then plugin
else if (plugin ? pname && (tryEval plugin.pname).success)
then plugin.pname
else plugin.name;
in {
vim = mkIf cfg.enable {
startPlugins = ["blink-compat"];
lazy.plugins = {
blink-cmp = {
package = "blink-cmp";
setupModule = "blink.cmp";
inherit (cfg) setupOpts;
# TODO: lazy disabled until lspconfig is lazy loaded
#
# event = ["InsertEnter" "CmdlineEnter"];
after = ''
${optionalString config.vim.lazy.enable
(concatStringsSep "\n" (map
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
cmpCfg.sourcePlugins))}
'';
};
};
autocomplete = {
enableSharedCmpSources = true;
blink-cmp.setupOpts = {
sources = {
default = ["lsp" "path" "snippets" "buffer"] ++ (attrNames cmpCfg.sources);
providers =
mapAttrs (name: _: {
inherit name;
module = "blink.compat.source";
})
cmpCfg.sources;
};
snippets = mkIf config.vim.snippets.luasnip.enable {
preset = "luasnip";
};
keymap = {
${mappings.complete} = ["show" "fallback"];
${mappings.close} = ["hide" "fallback"];
${mappings.scrollDocsUp} = ["scroll_documentation_up" "fallback"];
${mappings.scrollDocsDown} = ["scroll_documentation_down" "fallback"];
${mappings.confirm} = ["accept" "fallback"];
${mappings.next} = [
"select_next"
"snippet_forward"
(mkLuaInline ''
function(cmp)
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
has_words_before = col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
if has_words_before then
return cmp.show()
end
end
'')
"fallback"
];
${mappings.previous} = [
"select_prev"
"snippet_backward"
"fallback"
];
};
};
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./blink-cmp.nix
./config.nix
];
}

View file

@ -0,0 +1,34 @@
{
lib,
config,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.attrsets) mapListToAttrs;
inherit (builtins) typeOf tryEval;
cfg = config.vim.autocomplete;
getPluginName = plugin:
if typeOf plugin == "string"
then plugin
else if (plugin ? pname && (tryEval plugin.pname).success)
then plugin.pname
else plugin.name;
in {
config.vim = mkIf cfg.enableSharedCmpSources {
startPlugins = ["rtp-nvim"];
lazy.plugins =
mapListToAttrs (package: {
name = getPluginName package;
value = {
inherit package;
lazy = true;
after = ''
local path = vim.fn.globpath(vim.o.packpath, 'pack/*/opt/${getPluginName package}')
require("rtp_nvim").source_after_plugin_dir(path)
'';
};
})
cfg.nvim-cmp.sourcePlugins;
};
}

View file

@ -1,5 +1,9 @@
{ {
imports = [ imports = [
./module.nix
./config.nix
./nvim-cmp ./nvim-cmp
./blink-cmp
]; ];
} }

View file

@ -0,0 +1,7 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
in {
options.vim.autocomplete = {
enableSharedCmpSources = mkEnableOption "sources shared by blink.cmp and nvim-cmp";
};
}

View file

@ -24,114 +24,103 @@
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
startPlugins = ["rtp-nvim"]; lazy.plugins = {
lazy.plugins = mkMerge [ nvim-cmp = {
(mapListToAttrs (package: { package = "nvim-cmp";
name = getPluginName package; after = ''
value = { ${optionalString luasnipEnable "local luasnip = require('luasnip')"}
inherit package; local cmp = require("cmp")
lazy = true;
after = '' local kinds = require("cmp.types").lsp.CompletionItemKind
local path = vim.fn.globpath(vim.o.packpath, 'pack/*/opt/${getPluginName package}') local deprio = function(kind)
require("rtp_nvim").source_after_plugin_dir(path) return function(e1, e2)
if e1:get_kind() == kind then
return false
end
if e2:get_kind() == kind then
return true
end
return nil
end
end
cmp.setup(${toLuaObject cfg.setupOpts})
${optionalString config.vim.lazy.enable
(concatStringsSep "\n" (map
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
cfg.sourcePlugins))}
'';
event = ["InsertEnter" "CmdlineEnter"];
};
};
autocomplete = {
enableSharedCmpSources = true;
nvim-cmp = {
sources = {
nvim-cmp = null;
buffer = "[Buffer]";
path = "[Path]";
};
sourcePlugins = ["cmp-buffer" "cmp-path"];
setupOpts = {
sources = map (s: {name = s;}) (attrNames cfg.sources);
window = mkIf borders.enable {
completion.border = borders.style;
documentation.border = borders.style;
};
formatting.format = cfg.format;
# `cmp` and `luasnip` are defined above, in the `nvim-cmp` section
mapping = {
${mappings.complete} = mkLuaInline "cmp.mapping.complete()";
${mappings.close} = mkLuaInline "cmp.mapping.abort()";
${mappings.scrollDocsUp} = mkLuaInline "cmp.mapping.scroll_docs(-4)";
${mappings.scrollDocsDown} = mkLuaInline "cmp.mapping.scroll_docs(4)";
${mappings.confirm} = mkLuaInline "cmp.mapping.confirm({ select = true })";
${mappings.next} = mkLuaInline ''
cmp.mapping(function(fallback)
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
if cmp.visible() then
cmp.select_next_item()
${optionalString luasnipEnable ''
elseif luasnip.locally_jumpable(1) then
luasnip.jump(1)
''}
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end)
'';
${mappings.previous} = mkLuaInline ''
cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
${optionalString luasnipEnable ''
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
''}
else
fallback()
end
end)
''; '';
}; };
})
cfg.sourcePlugins)
{
nvim-cmp = {
package = "nvim-cmp";
after = ''
${optionalString luasnipEnable "local luasnip = require('luasnip')"}
local cmp = require("cmp")
local kinds = require("cmp.types").lsp.CompletionItemKind
local deprio = function(kind)
return function(e1, e2)
if e1:get_kind() == kind then
return false
end
if e2:get_kind() == kind then
return true
end
return nil
end
end
cmp.setup(${toLuaObject cfg.setupOpts})
${optionalString config.vim.lazy.enable
(concatStringsSep "\n" (map
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
cfg.sourcePlugins))}
'';
event = ["InsertEnter" "CmdlineEnter"];
};
}
];
autocomplete.nvim-cmp = {
sources = {
nvim-cmp = null;
buffer = "[Buffer]";
path = "[Path]";
};
sourcePlugins = ["cmp-buffer" "cmp-path"];
setupOpts = {
sources = map (s: {name = s;}) (attrNames cfg.sources);
window = mkIf borders.enable {
completion.border = borders.style;
documentation.border = borders.style;
};
formatting.format = cfg.format;
# `cmp` and `luasnip` are defined above, in the `nvim-cmp` section
mapping = {
${mappings.complete} = mkLuaInline "cmp.mapping.complete()";
${mappings.close} = mkLuaInline "cmp.mapping.abort()";
${mappings.scrollDocsUp} = mkLuaInline "cmp.mapping.scroll_docs(-4)";
${mappings.scrollDocsDown} = mkLuaInline "cmp.mapping.scroll_docs(4)";
${mappings.confirm} = mkLuaInline "cmp.mapping.confirm({ select = true })";
${mappings.next} = mkLuaInline ''
cmp.mapping(function(fallback)
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
if cmp.visible() then
cmp.select_next_item()
${optionalString luasnipEnable ''
elseif luasnip.locally_jumpable(1) then
luasnip.jump(1)
''}
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end)
'';
${mappings.previous} = mkLuaInline ''
cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
${optionalString luasnipEnable ''
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
''}
else
fallback()
end
end)
'';
}; };
}; };
}; };

View file

@ -0,0 +1,3 @@
{
imports = [./nvim-lint];
}

View file

@ -0,0 +1,20 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.diagnostics.nvim-lint;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["nvim-lint"];
pluginRC.nvim-lint = entryAnywhere ''
require("lint").setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./nvim-lint.nix
./config.nix
];
}

View file

@ -0,0 +1,27 @@
{lib, ...}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) attrsOf listOf str;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.diagnostics.nvim-lint = {
enable = mkEnableOption "asynchronous linter plugin for Neovim [nvim-lint]";
setupOpts = mkPluginSetupOption "nvim-lint" {
linters_by_ft = mkOption {
type = attrsOf (listOf str);
default = {};
example = {
text = ["vale"];
markdown = ["vale"];
};
description = ''
Map of filetype to formatters. This option takes a set of
`key = value` format where the `value` will be converted
to its Lua equivalent. You are responsible for passing the
correct Nix data types to generate a correct Lua value that
conform is able to accept.
'';
};
};
};
}

View file

@ -0,0 +1,20 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.formatter.conform-nvim;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["conform-nvim"];
pluginRC.conform-nvim = entryAnywhere ''
require("conform").setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -0,0 +1,56 @@
{
pkgs,
lib,
...
}: let
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) attrs enum;
inherit (lib.nvim.types) mkPluginSetupOption;
inherit (lib.nvim.lua) mkLuaInline;
in {
options.vim.formatter.conform-nvim = {
enable = mkEnableOption "lightweight yet powerful formatter plugin for Neovim [conform-nvim]";
setupOpts = mkPluginSetupOption "conform.nvim" {
formatters_by_ft = mkOption {
type = attrs;
default = {};
example = {lua = ["stylua"];};
description = ''
Map of filetype to formatters. This option takes a set of
`key = value` format where the `value will` be converted
to its Lua equivalent. You are responsible for passing the
correct Nix data types to generate a correct Lua value that
conform is able to accept.
'';
};
default_format_opts = mkOption {
type = attrs;
default = {lsp_format = "fallback";};
description = "Default values when calling `conform.format()`";
};
format_on_save = mkOption {
type = attrs;
default = {
lsp_format = "fallback";
timeout_ms = 500;
};
description = ''
Table that will be passed to `conform.format()`. If this
is set, Conform will run the formatter on save.
'';
};
format_after_save = mkOption {
type = attrs;
default = {lsp_format = "fallback";};
description = ''
Table that will be passed to `conform.format()`. If this
is set, Conform will run the formatter asynchronously after
save.
'';
};
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./conform-nvim.nix
./config.nix
];
}

View file

@ -0,0 +1,3 @@
{
imports = [./conform-nvim];
}

View file

@ -4,6 +4,7 @@ in {
imports = [ imports = [
./gitsigns ./gitsigns
./vim-fugitive ./vim-fugitive
./git-conflict
]; ];
options.vim.git = { options.vim.git = {
@ -13,6 +14,7 @@ in {
Enabling this option will enable the following plugins: Enabling this option will enable the following plugins:
* gitsigns * gitsigns
* vim-fugitive * vim-fugitive
* git-conflict
''; '';
}; };
} }

View file

@ -0,0 +1,40 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.git.git-conflict;
self = import ./git-conflict.nix {inherit lib config;};
gcMappingDefinitions = self.options.vim.git.git-conflict.mappings;
gcMappings = addDescriptionsToMappings cfg.mappings gcMappingDefinitions;
in {
config = mkIf cfg.enable (mkMerge [
{
vim = {
startPlugins = ["git-conflict-nvim"];
maps = {
normal = mkMerge [
(mkSetBinding gcMappings.ours "<Plug>(git-conflict-ours)")
(mkSetBinding gcMappings.theirs "<Plug>(git-conflict-theirs)")
(mkSetBinding gcMappings.both "<Plug>(git-conflict-both)")
(mkSetBinding gcMappings.none "<Plug>(git-conflict-none)")
(mkSetBinding gcMappings.prevConflict "<Plug>(git-conflict-prev-conflict)")
(mkSetBinding gcMappings.nextConflict "<Plug>(git-conflict-next-conflict)")
];
};
pluginRC.git-conflict = entryAnywhere ''
require('git-conflict').setup(${toLuaObject ({default_mappings = false;} // cfg.setupOpts)})
'';
};
}
]);
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./git-conflict.nix
];
}

View file

@ -0,0 +1,23 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.git.git-conflict = {
enable = mkEnableOption "git-conflict" // {default = config.vim.git.enable;};
setupOpts = mkPluginSetupOption "git-conflict" {};
mappings = {
ours = mkMappingOption "Choose Ours [Git-Conflict]" "co";
theirs = mkMappingOption "Choose Theirs [Git-Conflict]" "ct";
both = mkMappingOption "Choose Both [Git-Conflict]" "cb";
none = mkMappingOption "Choose None [Git-Conflict]" "c0";
prevConflict = mkMappingOption "Go to the previous Conflict [Git-Conflict]" "]x";
nextConflict = mkMappingOption "Go to the next Conflict [Git-Conflict]" "[x";
};
};
}

View file

@ -75,8 +75,8 @@
}; };
extraServerPlugins = { extraServerPlugins = {
omnisharp = ["omnisharp-extended"]; omnisharp = ["omnisharp-extended-lsp-nvim"];
csharp_ls = ["csharpls-extended"]; csharp_ls = ["csharpls-extended-lsp-nvim"];
}; };
cfg = config.vim.languages.csharp; cfg = config.vim.languages.csharp;

View file

@ -137,7 +137,7 @@ in {
vim.startPlugins = vim.startPlugins =
if ftcfg.enableNoResolvePatch if ftcfg.enableNoResolvePatch
then ["flutter-tools-patched"] then ["flutter-tools-patched"]
else ["flutter-tools"]; else ["flutter-tools-nvim"];
vim.pluginRC.flutter-tools = entryAnywhere '' vim.pluginRC.flutter-tools = entryAnywhere ''
require('flutter-tools').setup { require('flutter-tools').setup {

View file

@ -112,7 +112,7 @@ in {
}) })
(mkIf cfg.elixir-tools.enable { (mkIf cfg.elixir-tools.enable {
vim.startPlugins = ["elixir-tools"]; vim.startPlugins = ["elixir-tools-nvim"];
vim.pluginRC.elixir-tools = entryAnywhere '' vim.pluginRC.elixir-tools = entryAnywhere ''
local elixir = require("elixir") local elixir = require("elixir")
local elixirls = require("elixir.elixirls") local elixirls = require("elixir.elixirls")

View file

@ -8,7 +8,6 @@
inherit (lib.modules) mkIf mkMerge; inherit (lib.modules) mkIf mkMerge;
inherit (lib.meta) getExe; inherit (lib.meta) getExe;
inherit (lib.lists) isList; inherit (lib.lists) isList;
inherit (lib.strings) optionalString;
inherit (lib.types) either listOf package str; inherit (lib.types) either listOf package str;
inherit (lib.nvim.types) mkGrammarOption; inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.lua) expToLua; inherit (lib.nvim.lua) expToLua;
@ -16,6 +15,12 @@
cfg = config.vim.languages.lua; cfg = config.vim.languages.lua;
in { in {
imports = [
(lib.mkRemovedOptionModule ["vim" "languages" "lua" "lsp" "neodev"] ''
neodev has been replaced by lazydev
'')
];
options.vim.languages.lua = { options.vim.languages.lua = {
enable = mkEnableOption "Lua language support"; enable = mkEnableOption "Lua language support";
treesitter = { treesitter = {
@ -32,7 +37,7 @@ in {
default = pkgs.lua-language-server; default = pkgs.lua-language-server;
}; };
neodev.enable = mkEnableOption "neodev.nvim integration, useful for neovim plugin developers"; lazydev.enable = mkEnableOption "lazydev.nvim integration, useful for neovim plugin developers";
}; };
}; };
@ -49,7 +54,6 @@ in {
lspconfig.lua_ls.setup { lspconfig.lua_ls.setup {
capabilities = capabilities; capabilities = capabilities;
on_attach = default_on_attach; on_attach = default_on_attach;
${optionalString cfg.lsp.neodev.enable "before_init = require('neodev.lsp').before_init;"}
cmd = ${ cmd = ${
if isList cfg.lsp.package if isList cfg.lsp.package
then expToLua cfg.lsp.package then expToLua cfg.lsp.package
@ -59,10 +63,15 @@ in {
''; '';
}) })
(mkIf cfg.lsp.neodev.enable { (mkIf cfg.lsp.lazydev.enable {
vim.startPlugins = ["neodev-nvim"]; vim.startPlugins = ["lazydev-nvim"];
vim.pluginRC.neodev = entryBefore ["lua-lsp"] '' vim.pluginRC.lazydev = entryBefore ["lua-lsp"] ''
require("neodev").setup({}) require("lazydev").setup({
enabled = function(root_dir)
return not vim.uv.fs_stat(root_dir .. "/.luarc.json")
end,
library = { { path = "''${3rd}/luv/library", words = { "vim%.uv" } } },
})
''; '';
}) })
])) ]))

View file

@ -10,9 +10,9 @@
inherit (lib.modules) mkIf mkMerge; inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList; inherit (lib.lists) isList;
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
inherit (lib.types) enum either listOf package str; inherit (lib.types) anything attrsOf enum either listOf nullOr package str;
inherit (lib.nvim.types) mkGrammarOption diagnostics; inherit (lib.nvim.types) mkGrammarOption diagnostics;
inherit (lib.nvim.lua) expToLua; inherit (lib.nvim.lua) expToLua toLuaObject;
inherit (lib.nvim.languages) diagnosticsToLua; inherit (lib.nvim.languages) diagnosticsToLua;
cfg = config.vim.languages.nix; cfg = config.vim.languages.nix;
@ -59,6 +59,41 @@
} }
''; '';
}; };
nixd = {
package = pkgs.nixd;
internalFormatter = true;
lspConfig = ''
lspconfig.nixd.setup{
capabilities = capabilities,
${
if cfg.format.enable
then useFormat
else noFormat
},
cmd = ${packageToCmd cfg.lsp.package "nixd"},
${optionalString cfg.format.enable ''
settings = {
nixd = {
${optionalString (cfg.format.type == "alejandra")
''
formatting = {
command = {"${cfg.format.package}/bin/alejandra", "--quiet"},
},
''}
${optionalString (cfg.format.type == "nixfmt")
''
formatting = {
command = {"${cfg.format.package}/bin/nixfmt"},
},
''}
options = ${toLuaObject cfg.lsp.options},
},
},
''}
}
'';
};
}; };
defaultFormat = "alejandra"; defaultFormat = "alejandra";
@ -139,6 +174,12 @@ in {
type = either package (listOf str); type = either package (listOf str);
default = servers.${cfg.lsp.server}.package; default = servers.${cfg.lsp.server}.package;
}; };
options = mkOption {
type = nullOr (attrsOf anything);
default = null;
description = "Options to pass to nixd LSP server";
};
}; };
format = { format = {

View file

@ -82,7 +82,7 @@
ls_sources, ls_sources,
null_ls.builtins.formatting.prettier.with({ null_ls.builtins.formatting.prettier.with({
command = "${cfg.format.package}/bin/prettier", command = "${cfg.format.package}/bin/prettier",
filetypes = { "typescript" }, filetypes = { "typescript", "javascript" },
}) })
) )
''; '';
@ -230,7 +230,7 @@ in {
# Extensions # Extensions
(mkIf cfg.extensions."ts-error-translator".enable { (mkIf cfg.extensions."ts-error-translator".enable {
vim.startPlugins = ["ts-error-translator"]; vim.startPlugins = ["ts-error-translator-nvim"];
vim.pluginRC.ts-error-translator = entryAnywhere '' vim.pluginRC.ts-error-translator = entryAnywhere ''
require("ts-error-translator").setup(${toLuaObject cfg.extensions.ts-error-translator.setupOpts}) require("ts-error-translator").setup(${toLuaObject cfg.extensions.ts-error-translator.setupOpts})
''; '';

View file

@ -11,6 +11,7 @@
cfg = config.vim.lsp; cfg = config.vim.lsp;
usingNvimCmp = config.vim.autocomplete.nvim-cmp.enable; usingNvimCmp = config.vim.autocomplete.nvim-cmp.enable;
usingBlinkCmp = config.vim.autocomplete.blink-cmp.enable;
self = import ./module.nix {inherit config lib pkgs;}; self = import ./module.nix {inherit config lib pkgs;};
mappingDefinitions = self.options.vim.lsp.mappings; mappingDefinitions = self.options.vim.lsp.mappings;
@ -22,7 +23,7 @@
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
autocomplete.nvim-cmp = { autocomplete.nvim-cmp = mkIf usingNvimCmp {
sources = {nvim_lsp = "[LSP]";}; sources = {nvim_lsp = "[LSP]";};
sourcePlugins = ["cmp-nvim-lsp"]; sourcePlugins = ["cmp-nvim-lsp"];
}; };
@ -170,6 +171,10 @@ in {
}, },
} }
''} ''}
${optionalString usingBlinkCmp ''
capabilities = require('blink.cmp').get_lsp_capabilities()
''}
''; '';
}; };
}; };

View file

@ -10,9 +10,19 @@
cfg = config.vim.lsp; cfg = config.vim.lsp;
in { in {
config = mkIf (cfg.enable && cfg.lspSignature.enable) { config = mkIf (cfg.enable && cfg.lspSignature.enable) {
assertions = [
{
assertion = !config.vim.autocomplete.blink-cmp.enable;
message = ''
lsp-signature does not work with blink.cmp. Please use blink.cmp's builtin signature feature:
vim.autocomplete.blink-cmp.setupOpts.signature.enabled = true;
'';
}
];
vim = { vim = {
startPlugins = [ startPlugins = [
"lsp-signature" "lsp-signature-nvim"
]; ];
lsp.lspSignature.setupOpts = { lsp.lspSignature.setupOpts = {

View file

@ -8,27 +8,39 @@
inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.lsp.lspkind; cfg = config.vim.lsp.lspkind;
usingCmp = config.vim.autocomplete.nvim-cmp.enable;
usingBlink = config.vim.autocomplete.blink-cmp.enable;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
assertions = [ assertions = [
{ {
assertion = config.vim.autocomplete.nvim-cmp.enable; assertion = usingCmp || usingBlink;
message = '' message = ''
While lspkind supports Neovim's native lsp upstream, using that over While lspkind supports Neovim's native lsp upstream, using that over
nvim-cmp isn't recommended, nor supported by nvf. nvim-cmp/blink.cmp isn't recommended, nor supported by nvf.
Please migrate to nvim-cmp if you want to use lspkind. Please migrate to nvim-cmp/blink.cmp if you want to use lspkind.
''; '';
} }
]; ];
vim = { vim = {
startPlugins = ["lspkind"]; startPlugins = ["lspkind-nvim"];
lsp.lspkind.setupOpts.before = config.vim.autocomplete.nvim-cmp.format; lsp.lspkind.setupOpts.before = config.vim.autocomplete.nvim-cmp.format;
autocomplete.nvim-cmp.setupOpts.formatting.format = mkForce (mkLuaInline '' autocomplete = {
require("lspkind").cmp_format(${toLuaObject cfg.setupOpts}) nvim-cmp = mkIf usingCmp {
''); setupOpts.formatting.format = mkForce (mkLuaInline ''
require("lspkind").cmp_format(${toLuaObject cfg.setupOpts})
'');
};
blink-cmp = mkIf usingBlink {
setupOpts.appearance.kind_icons = mkLuaInline ''
require("lspkind").symbol_map
'';
};
};
}; };
}; };
} }

View file

@ -16,7 +16,7 @@
in { in {
config = mkIf (cfg.enable && cfg.lspsaga.enable) { config = mkIf (cfg.enable && cfg.lspsaga.enable) {
vim = { vim = {
startPlugins = ["lspsaga"]; startPlugins = ["lspsaga-nvim"];
maps = { maps = {
visual = mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').range_code_action"; visual = mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').range_code_action";

View file

@ -14,7 +14,7 @@ in {
{ {
vim = { vim = {
startPlugins = [ startPlugins = [
"none-ls" "none-ls-nvim"
"plenary-nvim" "plenary-nvim"
]; ];

View file

@ -7,6 +7,8 @@
inherit (lib.types) bool str nullOr; inherit (lib.types) bool str nullOr;
inherit (lib.modules) mkRenamedOptionModule; inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.nvim.types) mkPluginSetupOption; inherit (lib.nvim.types) mkPluginSetupOption;
autocompleteCfg = config.vim.autocomplete;
in { in {
imports = let imports = let
renamedSetupOption = oldPath: newPath: renamedSetupOption = oldPath: newPath:
@ -42,7 +44,7 @@ in {
# If using nvim-cmp, otherwise set to false # If using nvim-cmp, otherwise set to false
type = bool; type = bool;
description = "If using nvim-cmp, otherwise set to false"; description = "If using nvim-cmp, otherwise set to false";
default = config.vim.autocomplete.nvim-cmp.enable; default = autocompleteCfg.nvim-cmp.enable || autocompleteCfg.blink-cmp.enable;
}; };
}; };
}; };

View file

@ -13,9 +13,7 @@ in {
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (mkMerge [
{ {
vim = { vim = {
startPlugins = [ startPlugins = ["orgmode"];
"orgmode-nvim"
];
binds.whichKey.register = pushDownDefault { binds.whichKey.register = pushDownDefault {
"<leader>o" = "+Notes"; "<leader>o" = "+Notes";

View file

@ -15,7 +15,7 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
startPlugins = [ startPlugins = [
"todo-comments" "todo-comments-nvim"
]; ];
maps.normal = mkMerge [ maps.normal = mkMerge [

View file

@ -15,7 +15,7 @@ in {
vim = { vim = {
startPlugins = startPlugins =
[ [
"nvim-session-manager" "neovim-session-manager"
"plenary-nvim" "plenary-nvim"
] ]
++ optionals cfg.usePicker ["dressing-nvim"]; ++ optionals cfg.usePicker ["dressing-nvim"];

View file

@ -20,7 +20,7 @@ in {
after = cfg.loaders; after = cfg.loaders;
}; };
startPlugins = cfg.providers; startPlugins = cfg.providers;
autocomplete.nvim-cmp = { autocomplete.nvim-cmp = mkIf config.vim.autocomplete.nvim-cmp.enable {
sources = {luasnip = "[LuaSnip]";}; sources = {luasnip = "[LuaSnip]";};
sourcePlugins = ["cmp-luasnip"]; sourcePlugins = ["cmp-luasnip"];
}; };

View file

@ -34,7 +34,7 @@ in {
}) })
(mkIf cfg.enable { (mkIf cfg.enable {
vim = { vim = {
startPlugins = ["lualine"]; startPlugins = ["lualine-nvim"];
pluginRC.lualine = entryAnywhere '' pluginRC.lualine = entryAnywhere ''
local lualine = require('lualine') local lualine = require('lualine')
lualine.setup ${toLuaObject cfg.setupOpts} lualine.setup ${toLuaObject cfg.setupOpts}

View file

@ -20,7 +20,8 @@ in {
vim = { vim = {
startPlugins = ["nvim-treesitter"]; startPlugins = ["nvim-treesitter"];
autocomplete.nvim-cmp = { # cmp-treesitter doesn't work on blink.cmp
autocomplete.nvim-cmp = mkIf config.vim.autocomplete.nvim-cmp.enable {
sources = {treesitter = "[Treesitter]";}; sources = {treesitter = "[Treesitter]";};
sourcePlugins = ["cmp-treesitter"]; sourcePlugins = ["cmp-treesitter"];
}; };

View file

@ -11,7 +11,7 @@
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
startPlugins = ["smartcolumn"]; startPlugins = ["smartcolumn-nvim"];
pluginRC.smartcolumn = entryAnywhere '' pluginRC.smartcolumn = entryAnywhere ''
require("smartcolumn").setup(${toLuaObject cfg.setupOpts}) require("smartcolumn").setup(${toLuaObject cfg.setupOpts})

View file

@ -14,7 +14,7 @@
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
startPlugins = ["which-key"]; startPlugins = ["which-key-nvim"];
pluginRC.whichkey = entryAnywhere '' pluginRC.whichkey = entryAnywhere ''
local wk = require("which-key") local wk = require("which-key")

View file

@ -9,9 +9,7 @@
cfg = config.vim.utility.ccc; cfg = config.vim.utility.ccc;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim.startPlugins = [ vim.startPlugins = ["ccc-nvim"];
"ccc"
];
vim.pluginRC.ccc = entryAnywhere '' vim.pluginRC.ccc = entryAnywhere ''
local ccc = require("ccc") local ccc = require("ccc")

View file

@ -3,6 +3,7 @@
./binds ./binds
./ccc ./ccc
./diffview ./diffview
./fzf-lua
./gestures ./gestures
./icon-picker ./icon-picker
./images ./images
@ -13,8 +14,7 @@
./surround ./surround
./telescope ./telescope
./wakatime ./wakatime
./surround ./yanky-nvim
./preview ./leetcode-nvim
./fzf-lua
]; ];
} }

View file

@ -0,0 +1,26 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.utility.leetcode-nvim;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = [
"leetcode-nvim"
"plenary-nvim"
"fzf-lua"
"nui-nvim"
];
lazy.plugins.leetcode-nvim = {
package = "leetcode-nvim";
setupModule = "leetcode";
inherit (cfg) setupOpts;
};
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./leetcode-nvim.nix
./config.nix
];
}

View file

@ -0,0 +1,74 @@
{lib, ...}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) enum str bool;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
in {
options.vim.utility = {
leetcode-nvim = {
enable = mkEnableOption "complementary neovim plugin for leetcode.nvim";
setupOpts = mkPluginSetupOption "leetcode-nvim" {
logging = mkEnableOption "logging for leetcode.nvim status notifications." // {default = true;};
image_support = mkEnableOption "question description images using image.nvim (image-nvim must be enabled).";
lang = mkOption {
type = enum [
"cpp"
"java"
"python"
"python3"
"c"
"csharp"
"javascript"
"typescript"
"php"
"swift"
"kotlin"
"dart"
"golang"
"ruby"
"scala"
"rust"
"racket"
"erlang"
"elixir"
"bash"
];
default = "python3";
description = "Language to start your session with";
};
arg = mkOption {
type = str;
default = "leetcode.nvim";
description = "Argument for Neovim";
};
cn = {
enabled = mkEnableOption "leetcode.cn instead of leetcode.com";
translator = mkEnableOption "translator" // {default = true;};
translate_problems = mkEnableOption "translation for problem questions" // {default = true;};
};
storage = {
home = mkOption {
type = luaInline;
default = mkLuaInline "vim.fn.stdpath(\"data\") .. \"/leetcode\"";
description = "Home storage directory";
};
cache = mkOption {
type = luaInline;
default = mkLuaInline "vim.fn.stdpath(\"cache\") .. \"/leetcode\"";
description = "Cache storage directory";
};
};
plugins = {
non_standalone = mkEnableOption "leetcode.nvim in a non-standalone mode";
};
};
};
};
}

View file

@ -38,7 +38,7 @@ in {
default = false; default = false;
description = '' description = ''
nvim-surround: add/change/delete surrounding delimiter pairs with ease. nvim-surround: add/change/delete surrounding delimiter pairs with ease.
Note that the default mappings deviate from upstreeam to avoid conflicts Note that the default mappings deviate from upstream to avoid conflicts
with nvim-leap. with nvim-leap.
''; '';
}; };

View file

@ -99,12 +99,6 @@
type = float; type = float;
default = 0.55; default = 0.55;
}; };
results_width = mkOption {
description = "";
type = float;
default = 0.8;
};
}; };
vertical = { vertical = {

View file

@ -0,0 +1,32 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.lists) optionals concatLists;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.utility.yanky-nvim;
usingSqlite = cfg.setupOpts.ring.storage == "sqlite";
in {
config = mkIf cfg.enable {
vim = {
# TODO: this could probably be lazyloaded. I'm not yet sure which event is
# ideal, so it's loaded normally for now.
startPlugins = concatLists [
["yanky-nvim"]
# If using the sqlite backend, sqlite-lua must be loaded
# alongside yanky.
(optionals usingSqlite [pkgs.vimPlugins.sqlite-lua])
];
pluginRC.yanky-nvim = entryAnywhere ''
require("yanky").setup(${toLuaObject cfg.setupOpts});
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./yanky-nvim.nix
];
}

View file

@ -0,0 +1,28 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) enum;
in {
options.vim.utility.yanky-nvim = {
enable = mkEnableOption ''
improved Yank and Put functionalities for Neovim [yanky-nvim]
'';
setupOpts = {
ring.storage = mkOption {
type = enum ["shada" "sqlite" "memory"];
default = "shada";
example = "sqlite";
description = ''
storage mode for ring values.
- shada: this will save pesistantly using Neovim ShaDa feature.
This means that history will be persisted between each session of Neovim.
- memory: each Neovim instance will have his own history and it will be
lost between sessions.
- sqlite: more reliable than `shada`, requires `sqlite.lua` as a dependency.
nvf will add this dependency to `PATH` automatically.
'';
};
};
};
}

View file

@ -13,7 +13,7 @@
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
startPlugins = ["cellular-automaton"]; startPlugins = ["cellular-automaton-nvim"];
maps.normal = mkBinding cfg.mappings.makeItRain "<cmd>CellularAutomaton make_it_rain<CR>" "Make it rain"; maps.normal = mkBinding cfg.mappings.makeItRain "<cmd>CellularAutomaton make_it_rain<CR>" "Make it rain";

View file

@ -11,7 +11,7 @@
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
startPlugins = ["highlight-undo"]; startPlugins = ["highlight-undo-nvim"];
pluginRC.highlight-undo = entryAnywhere '' pluginRC.highlight-undo = entryAnywhere ''
require("highlight-undo").setup(${toLuaObject cfg.setupOpts}) require("highlight-undo").setup(${toLuaObject cfg.setupOpts})

View file

@ -11,7 +11,7 @@
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
startPlugins = ["indent-blankline"]; startPlugins = ["indent-blankline-nvim"];
pluginRC.indent-blankline = entryAnywhere '' pluginRC.indent-blankline = entryAnywhere ''
require("ibl").setup(${toLuaObject cfg.setupOpts}) require("ibl").setup(${toLuaObject cfg.setupOpts})

View file

@ -9,7 +9,7 @@
cfg = config.vim.visuals.rainbow-delimiters; cfg = config.vim.visuals.rainbow-delimiters;
in { in {
vim = mkIf cfg.enable { vim = mkIf cfg.enable {
startPlugins = ["rainbow-delimiters"]; startPlugins = ["rainbow-delimiters-nvim"];
pluginRC.rainbow-delimiters = entryAnywhere '' pluginRC.rainbow-delimiters = entryAnywhere ''
vim.g.rainbow_delimiters = ${toLuaObject cfg.setupOpts} vim.g.rainbow_delimiters = ${toLuaObject cfg.setupOpts}

View file

@ -11,7 +11,7 @@
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
startPlugins = ["tiny-devicons-auto-colors" "nvim-web-devicons"]; startPlugins = ["tiny-devicons-auto-colors-nvim" "nvim-web-devicons"];
pluginRC.tiny-devicons-auto-colors = entryAnywhere '' pluginRC.tiny-devicons-auto-colors = entryAnywhere ''
require("tiny-devicons-auto-colors").setup(${toLuaObject cfg.setupOpts}) require("tiny-devicons-auto-colors").setup(${toLuaObject cfg.setupOpts})

Some files were not shown because too many files have changed in this diff Show more