Merge branch 'main' into feat-languages-qml

This commit is contained in:
TheSunCat 2025-04-07 23:34:03 +02:00 committed by GitHub
commit 115f3aa594
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
127 changed files with 3625 additions and 1580 deletions

View file

@ -14,7 +14,7 @@ indent_style = space
indent_size = 2
trim_trailing_whitespace = false
[*.{js,json,nix,yml,yaml}]
[*.{js,json,nix,yml,yaml,toml}]
indent_style = space
indent_size = 2
tab_width = 2

6
.github/CODEOWNERS vendored
View file

@ -1 +1,5 @@
* @NotAShelf
# Codeowners should be used to distinguish the maintainers of the project
# and not contributors of specific modules to nvf. While adding a new module
# please consider adding yourself to 'meta.maintainers' in the module instead
# of CODEOWNERS here.
* @NotAShelf @horriblename @Soliprem

27
.github/README.md vendored
View file

@ -200,8 +200,9 @@ fix.
**Q**: What platforms are supported?
**A**: nvf actively supports **Linux and Darwin** platforms using standalone
Nix, NixOS or Home-Manager. Please take a look at the [nvf manual] for available
installation instructions.
Nix, NixOS or Home-Manager. It has been reported that **Android** is also
supported through the Home-Manager module, or using standalone package. Please
take a look at the [nvf manual] for available installation instructions.
**Q**: Can you add _X_?
@ -237,7 +238,7 @@ customizability of plugin inputs, which is one of our primary features.
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
**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.
@ -246,14 +247,15 @@ Neovim's behaviour with Nix.
### Co-Maintainers
Alongside myself, nvf is developed by those talented folk:
Alongside [myself](https://github.com/notashelf), nvf is developed by those
talented folk. nvf would not be what it is today without their invaluable
contributions.
- [**@horriblename**](https://github.com/horriblename)
([Liberapay](https://liberapay.com/horriblename/))- For actively implementing
planned features and quality of life updates.
- [**@Diniamo**](https://github.com/Diniamo)
([Liberapay](https://en.liberapay.com/diniamo/)) - For actively submitting
pull requests, issues and assistance with maintenance of nvf.
- [**@Soliprem**](https://github.com/soliprem) - For rigorously implementing
missing features and excellent work on new language modules.
Please do remember to extend your thanks (financially or otherwise) if this
project has been helpful to you.
@ -270,14 +272,14 @@ heart-felt thanks to
- [**@FlafyDev**](https://github.com/FlafyDev) - For getting Home-Manager module
to work and Nix assistance.
- [**@n3oney**](https://github.com/n3oney) - For making custom keybinds finally
possible, and other module additions.
possible, great ideas and module additions.
- [**@Yavko**](https://github.com/Yavko) - For the amazing **nvf** logo
- [**@FrothyMarrow**](https://github.com/FrothyMarrow) - For seeing mistakes
that I could not.
that I could not and contributing good ideas & code.
- [**@Gerg-l**](https://github.com/gerg-l) 🐸 - For the modern Neovim wrapper,
[mnw], and occasional code improvements.
- [**@Soliprem**](https://github.com/soliprem) - Rigorously implementing missing
features and excellent work on new language modules.
[mnw], and occasional improvements to the codebase.
- [**@Diniamo**](https://github.com/Diniamo) - For actively submitting pull
requests, issues and assistance with co-maintenance of nvf.
and everyone who has submitted issues or pull requests!
@ -301,7 +303,6 @@ including:
I am grateful for their previous work and inspiration, and I wholeheartedly
recommend checking their work out.
<br/>
## License

11
.github/typos.toml vendored
View file

@ -1,5 +1,10 @@
default.extend-ignore-words-re = ["(?i)(noice)", "befores", "annote", "viw"]
files.extend-exclude = [
"npins/sources.json"
files.extend-exclude = ["npins/sources.json"]
default.extend-ignore-words-re = [
"(?i)(noice)",
"befores",
"annote",
"viw",
"BA", # somehow "BANanaD3V" is valid, but BA is not...
]

View file

@ -36,7 +36,7 @@ jobs:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- uses: cachix/cachix-action@v15
- uses: cachix/cachix-action@v16
with:
authToken: ${{ secrets.CACHIX_TOKEN }}
extraPullNames: nix-community

View file

@ -1,56 +0,0 @@
name: "Validate flake & check documentation"
on:
pull_request:
workflow_dispatch:
push:
branches:
- main
paths:
- docs/**
jobs:
flake-docs-check:
name: Validate Flake Documentation
runs-on: ubuntu-latest
strategy:
matrix:
package:
- docs
- docs-html
- docs-manpages
- docs-json
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Checkout
uses: actions/checkout@v4
- name: Set default git branch (to reduce log spam)
run: git config --global init.defaultBranch main
- name: Build documentation packages
run: nix build .#${{ matrix.package }} --print-build-logs
- name: Get current date
id: get-date
# output format: 2023-12-22-120000
run: echo "date=$(date +'%Y-%m-%d-%H%M%S')" >> ${GITHUB_OUTPUT}
- name: Upload doc artifacts
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.package }}"
path: result/share/doc/nvf
flake-docs-linkcheck:
name: Validate hyperlinks in documentation sources
runs-on: ubuntu-latest
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Checkout
uses: actions/checkout@v4
- name: Build documentation packages
run: nix build .#docs-linkcheck -Lv

View file

@ -1,4 +1,6 @@
name: "Validate flake & check formatting"
name: "Treewide Checks"
permissions: read-all
on:
pull_request:
workflow_dispatch:
@ -6,13 +8,13 @@ on:
branches:
- main
paths-ignore:
- .github/**
- assets/**
- .gitignore
jobs:
nix-flake-check:
name: Validate Flake
name: "Validate flake"
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v4
@ -24,8 +26,9 @@ jobs:
run: nix flake check
format-with-alejandra:
name: Formatting via Alejandra
name: "Check formatting"
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v4
@ -33,4 +36,118 @@ jobs:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- run: nix run nixpkgs#alejandra -- -c .
- name: Check formatting via Alejandra
run: nix run nixpkgs#alejandra -- -c .
check-typos:
name: "Check source tree for typos"
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for typos
uses: crate-ci/typos@master
with:
config: .github/typos.toml
- if: ${{ failure() }}
shell: bash
run: |
echo "::error:: Current codebase contains typos that were caught by the CI!"
echo "If those typos were intentional, please add them to the ignored regexes in .github/typos.toml"
echo "[skip ci] label may be added to the PR title if this is a one-time issue and is safe to ignore"
exit 1
flake-docs-check:
name: "Validate documentation builds"
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
strategy:
matrix:
package:
- docs
- docs-html
- docs-manpages
- docs-json
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Checkout
uses: actions/checkout@v4
- name: Set default git branch (to reduce log spam)
run: git config --global init.defaultBranch main
- name: Build documentation packages
run: nix build .#${{ matrix.package }} --print-build-logs
- name: Get current date
id: get-date
# output format: 2023-12-22-120000
run: echo "date=$(date +'%Y-%m-%d-%H%M%S')" >> ${GITHUB_OUTPUT}
- name: Upload doc artifacts
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.package }}"
path: result/share/doc/nvf
flake-docs-linkcheck:
name: "Validate hyperlinks in documentation sources"
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Checkout
uses: actions/checkout@v4
- name: Build linkcheck package
run: nix build .#docs-linkcheck -Lv
check-editorconfig:
name: "Validate Editorconfig conformance"
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2 # slows down checkout, but we need to compare against the previous commit on push events
- name: Get list of changed files from PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
gh api repos/${{ github.repository }}/pulls/${{ github.event.number }}/files --paginate \
| jq -r '.[] | select(.status != "removed") | .filename' \
> "$HOME/changed_files"
else
git diff --name-only HEAD^ > "$HOME/changed_files"
fi
- name: Print list of changed files
run: |
cat "$HOME/changed_files"
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Checking Editorconfig conformance
shell: bash
run: |
< "$HOME/changed_files" nix-shell -p editorconfig-checker --run 'xargs -r editorconfig-checker -disable-indent-size'
- if: ${{ failure() }}
shell: bash
run: |
echo "::error:: Current formatting does not fit convention provided by .editorconfig located in the project root."
echo "Please make sure your editor properly integrates editorconfig, Neovim does so by default."
echo "See https://editorconfig.org/#download on how to integrate Editorconfig to your editor."
exit 1

View file

@ -1,9 +1,13 @@
name: Cleanup
name: Delete Stale Branches
permissions:
contents: write
on:
workflow_dispatch:
schedule:
- cron: "0 4 1 * *" # 4AM on 1st of every month
- cron: "0 4 15 * *" # 4AM on the 15th of every month
jobs:
branches:
name: Cleanup old branches
@ -13,7 +17,7 @@ jobs:
uses: actions/checkout@v4
- name: "Delete old branches"
uses: beatlabs/delete-old-branches-action@v0.0.10
uses: beatlabs/delete-old-branches-action@v0.0.11
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
date: "1 months ago"

View file

@ -9,7 +9,7 @@ on:
- "modules/**"
- "docs/**"
# Defining permissions here passes it to all workflows.
# Defining permissions here passes it to all jobs.
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
permissions:
contents: write
@ -34,7 +34,7 @@ jobs:
run: git config --global init.defaultBranch main
- name: Build documentation packages
run: nix build .#docs-html --print-build-logs
run: nix build .#docs-html --print-build-logs || exit 1
- name: Deploy to GitHub Pages preview
run: |

View file

@ -1,46 +0,0 @@
name: "Check validity of .editorconfig"
permissions: read-all
on:
pull_request:
jobs:
check-editorconfig:
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
steps:
- name: Get list of changed files from PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api \
repos/notashelf/nvf/pulls/${{github.event.number}}/files --paginate \
| jq '.[] | select(.status != "removed") | .filename' \
> "$HOME/changed_files"
- name: Print list of changed files
run: |
cat "$HOME/changed_files"
- name: Checkout
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Checking EditorConfig
shell: bash
run: |
cat "$HOME/changed_files" | nix-shell -p editorconfig-checker.out --run 'xargs -r editorconfig-checker -disable-indentation -exclude flake.lock --verbose'
echo -n "Check status: $?"
- name: Fail Gracefully
if: ${{ failure() }}
shell: bash
run: |
echo "::error:: Current formatting does not fit convention provided by .editorconfig located in the project root."
echo "Please make sure your editor properly integrates editorconfig. See https://editorconfig.org/#download for more."
exit 1

View file

@ -1,30 +0,0 @@
name: "Check for typos in the source tree"
permissions: read-all
on:
pull_request:
workflow_dispatch:
push:
jobs:
check-typos:
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for typos
uses: crate-ci/typos@master
with:
config: .github/typos.toml
- name: Fail Gracefully
if: ${{ failure() }}
shell: bash
run: |
echo "::error:: Current codebase contains typos that were caught by the CI!"
echo "If those typos were intentional, please add them to the ignored regexes in .github/typos.toml"
echo "[skip ci] label may be used if this is a one-time issue"
exit 1

View file

@ -25,7 +25,6 @@ isMaximal: {
trouble.enable = true;
lspSignature.enable = true;
otter-nvim.enable = isMaximal;
lsplines.enable = isMaximal;
nvim-docs-view.enable = isMaximal;
};
@ -83,6 +82,7 @@ isMaximal: {
elixir.enable = false;
haskell.enable = false;
ruby.enable = false;
fsharp.enable = false;
tailwind.enable = false;
svelte.enable = false;
@ -235,6 +235,7 @@ isMaximal: {
enable = false;
cmp.enable = isMaximal;
};
codecompanion-nvim.enable = false;
};
session = {

View file

@ -95,8 +95,6 @@
inherit (nvimModuleDocs) optionsJSON;
};
in {
inherit (inputs) nmd;
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
# `nixosOptionsDoc` is more customizable.
options.json =

View file

@ -67,7 +67,7 @@ of individual sections of configuration as needed. nvf provides helper functions
in the extended library, usually under `inputs.nvf.lib.nvim.dag` that you may
use.
Please refer to the [DAG section](/index.xhtml#ch-dag-entries) in the nvf manual
Please refer to the [DAG section](#ch-dag-entries) in the nvf manual
to find out more about the DAG system.
:::

View file

@ -38,3 +38,22 @@ As of version **0.7**, we exposed an API for configuring lazy-loaded plugins via
};
}
```
## LazyFile event {#sec-lazyfile-event}
You can use the `LazyFile` user event to load a plugin when a file is opened:
```nix
{
config.vim.lazy.plugins = {
"aerial.nvim" = {
package = pkgs.vimPlugins.aerial-nvim;
event = [{event = "User"; pattern = "LazyFile";}];
# ...
};
};
}
```
You can consider `LazyFile` as an alias to
`["BufReadPost" "BufNewFile" "BufWritePre"]`

View file

@ -19,6 +19,7 @@ formatting to diagnostics. The following languages have sections under the
- Go: [vim.languages.go.enable](#opt-vim.languages.go.enable)
- Lua: [vim.languages.lua.enable](#opt-vim.languages.lua.enable)
- PHP: [vim.languages.php.enable](#opt-vim.languages.php.enable)
- F#: [vim.languages.fsharp.enable](#opt-vim.languages.fsharp.enable)
Adding support for more languages, and improving support for existing ones are
great places where you can contribute with a PR.

View file

@ -5,8 +5,8 @@ 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.
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.
which you can access with `man 5 nvf`. Please let 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:

View file

@ -2,8 +2,22 @@
## Breaking changes
[Lspsaga documentation]: https://nvimdev.github.io/lspsaga/
- `git-conflict` keybinds are now prefixed with `<leader>` to avoid conflicting
with builtins
with builtins.
- `alpha` is now configured with nix, default config removed.
- Lspsaga module no longer ships default keybindings. The keybind format has
been changed by upstream, and old keybindings do not have equivalents under
the new API they provide. Please manually set your keybinds according to
[Lspsaga documentation] following the new API.
- none-ls has been updated to the latest version. If you have been using raw Lua
configuration to _manually_ configure it, some of the formats may become
unavailable as they have been refactored out of the main none-ls repository
upstream.
[NotAShelf](https://github.com/notashelf):
@ -11,6 +25,8 @@
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
[yanky.nvim]: https://github.com/gbprod/yanky.nvim
[yazi.nvim]: https://github.com/mikavilpas/yazi.nvim
[snacks.nvim]: https://github.com/folke/snacks.nvim
[oil.nvim]: https://github.com/stevearc/oil.nvim
- Add [typst-preview.nvim] under
`languages.typst.extensions.typst-preview-nvim`.
@ -18,7 +34,7 @@
- Add a search widget to the options page in the nvf manual.
- Add [render-markdown.nvim] under
`languages.markdown.extensions.render-markdown-nvim`
`languages.markdown.extensions.render-markdown-nvim`.
- Implement [](#opt-vim.git.gitsigns.setupOpts) for user-specified setup table
in gitsigns configuration.
@ -52,6 +68,29 @@
- Add [yazi.nvim] as a companion plugin for Yazi, the terminal file manager.
- Add [](#opt-vim.autocmds) and [](#opt-vim.augroups) to allow declaring
autocommands via Nix.
- Fix plugin `setupOpts` for yanky.nvim and assert if shada is configured as a
backend while shada is disabled in Neovim options.
- Add [yazi.nvim] as a companion plugin for Yazi, the terminal file manager.
- Add [snacks.nvim] under `vim.utility.snacks-nvim` as a general-purpose utility
plugin.
- Move LSPSaga to `setupOpts` format, allowing freeform configuration in
`vim.lsp.lspsaga.setupOpts`.
- Lazyload Lspsaga and remove default keybindings for it.
- Add [oil.nvim] as an alternative file explorer. It will be available under
`vim.utility.oil-nvim`.
- Add `vim.diagnostics` to interact with Neovim's diagnostics module. Available
options for `vim.diagnostic.config()` can now be customized through the
[](#opt-vim.diagnostics.config) in nvf.
[amadaluzia](https://github.com/amadaluzia):
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
@ -62,7 +101,12 @@
[blink.cmp]: https://github.com/saghen/blink.cmp
- Add [blink.cmp] support
- Add [aerial.nvim].
- Add [nvim-ufo].
- Add [blink.cmp] support.
- Add `LazyFile` user event.
- Migrate language modules from none-ls to conform/nvim-lint
- Add tsx support in conform and lint
[diniamo](https://github.com/diniamo):
@ -71,14 +115,6 @@
- Disable the built-in format-on-save feature of zls. Use `vim.lsp.formatOnSave`
instead.
[horriblename](https://github.com/horriblename):
[aerial.nvim]: (https://github.com/stevearc/aerial.nvim)
[nvim-ufo]: (https://github.com/kevinhwang91/nvim-ufo)
- Add [aerial.nvim]
- Add [nvim-ufo]
[LilleAila](https://github.com/LilleAila):
- Remove `vim.notes.obsidian.setupOpts.dir`, which was set by default. Fixes
@ -149,18 +185,22 @@
[thamenato](https://github.com/thamenato):
[ruff]: (https://github.com/astral-sh/ruff)
[cue]: (https://cuelang.org/)
- Add [ruff] as a formatter option in `vim.languages.python.format.type`.
- Add [cue] support under `vim.languages.cue`.
[ARCIII](https://github.com/ArmandoCIII):
[leetcode.nvim]: https://github.com/kawre/leetcode.nvim
[codecompanion-nvim]: https://github.com/olimorris/codecompanion.nvim
- Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. Code
Inspiration from `vim.languages.clang.dap` implementation.
- Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`.
- Add [codecompanion.nvim] plugin under `vim.assistant.codecompanion-nvim`.
[nezia1](https://github.com/nezia1)
[nezia1](https://github.com/nezia1):
- Add support for [nixd](https://github.com/nix-community/nixd) language server.
@ -170,33 +210,127 @@
available plugins, under `vim.utility.multicursors`.
- Add [hydra.nvim](https://github.com/nvimtools/hydra.nvim) as dependency for
`multicursors.nvim` and lazy loads by default.
[folospior](https://github.com/folospior)
[folospior](https://github.com/folospior):
- Fix plugin name for lsp/lspkind.
- Move `vim-illuminate` to `setupOpts format`
[iynaix](https://github.com/iynaix)
[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)
[Mr-Helpful](https://github.com/Mr-Helpful):
- Corrects pin names used for nvim themes
- Corrects pin names used for nvim themes.
[Libadoxon](https://github.com/Libadoxon)
[Libadoxon](https://github.com/Libadoxon):
- Add [git-conflict](https://github.com/akinsho/git-conflict.nvim) plugin for
resolving git conflicts
resolving git conflicts.
- Add formatters for go: [gofmt](https://go.dev/blog/gofmt),
[golines](https://github.com/segmentio/golines) and
[gofumpt](https://github.com/mvdan/gofumpt)
[TheSunCat](https://github.com/TheSunCat)
[gofumpt](https://github.com/mvdan/gofumpt).
[TheSunCat](https://git.allpurposem.at/mat):
[qmlls]: https://doc.qt.io/qt-6/qtqml-tooling-qmlls.html
[qmlformat]: https://doc.qt.io/qt-6/qtqml-tooling-qmlformat.html
- Add QML LSP and formatter support under `vim.languages.qml` using [qmlls] and
[qmlformat].
[UltraGhostie](https://github.com/UltraGhostie)
- Add [harpoon](https://github.com/ThePrimeagen/harpoon) plugin for navigation
[MaxMur](https://github.com/TheMaxMur):
- Add YAML support under `vim.languages.yaml`.
[alfarel](https://github.com/alfarelcynthesis):
[conform.nvim]: https://github.com/stevearc/conform.nvim
- Add missing `yazi.nvim` dependency (`snacks.nvim`).
- Add [mkdir.nvim](https://github.com/jghauser/mkdir.nvim) plugin for automatic
creation of parent directories when editing a nested file.
- Add [nix-develop.nvim](https://github.com/figsoda/nix-develop.nvim) plugin for
in-neovim `nix develop`, `nix shell` and more.
- Add [direnv.vim](https://github.com/direnv/direnv.vim) plugin for automatic
syncing of nvim shell environment with direnv's.
- Add [blink.cmp] source options and some default-disabled sources.
- Add [blink.cmp] option to add
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so
blink.cmp can source snippets from it.
- Fix [blink.cmp] breaking when built-in sources were modified.
- Fix [conform.nvim] not allowing disabling formatting on and after save. Use
`null` value to disable them if conform is enabled.
[TheColorman](https://github.com/TheColorman):
- Fix plugin `setupOpts` for `neovim-session-manager` having an invalid value
for `autoload_mode`.
[esdevries](https://github.com/esdevries):
[projekt0n/github-nvim-theme]: https://github.com/projekt0n/github-nvim-theme
- Add `github-nvim-theme` theme from [projekt0n/github-nvim-theme].
[BANanaD3V](https://github.com/BANanaD3V):
- `alpha` is now configured with nix.
[viicslen](https://github.com/viicslen):
- Add `intelephense` language server support under
`vim.languages.php.lsp.server`
[Butzist](https://github.com/butzist):
- Add Helm chart support under `vim.languages.helm`.
[rice-cracker-dev](https://github.com/rice-cracker-dev):
- `eslint_d` now checks for configuration files to load.
[Sc3l3t0n](https://github.com/Sc3l3t0n):
- Add F# support under `vim.languages.fsharp`.
[venkyr77](https://github.com/venkyr77):
- Add lint (luacheck) and formatting (stylua) support for Lua.
- Add lint (markdownlint-cli2) support for Markdown.
- Add catppuccin integration for Bufferline, Lspsaga.
- Add neo-tree integration for Bufferline.
- Add more applicable filetypes to illuminate denylist.
- Disable mini.indentscope for applicable filetypes.
- Fix fzf-lua having a hard dependency on fzf.
- Enable inlay hints support - `config.vim.lsp.inlayHints`.
[tebuevd](https://github.com/tebuevd):
- Fix `pickers` configuration for `telescope` by nesting it under `setupOpts`
- Fix `find_command` configuration for `telescope` by nesting it under
`setupOpts.pickers.find_files`
- Update default `telescope.setupOpts.pickers.find_files.find_command` to only
include files (and therefore exclude directories from results)
[ckoehler](https://github.com/ckoehler):
[flash.nvim]: https://github.com/folke/flash.nvim
[gitlinker.nvim]: https://github.com/linrongbin16/gitlinker.nvim
- Fix oil config referencing snacks
- Add [flash.nvim] plugin to `vim.utility.motion.flash-nvim`
- Fix default telescope ignore list entry for '.git/' to properly match
- Add [gitlinker.nvim] plugin to `vim.git.gitlinker-nvim`
[rrvsh](https://github.com/rrvsh):
- Fix namespace of python-lsp-server by changing it to python3Packages

62
flake.lock generated
View file

@ -5,11 +5,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1738453229,
"narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
"lastModified": 1741352980,
"narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
"rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9",
"type": "github"
},
"original": {
@ -38,11 +38,11 @@
},
"mnw": {
"locked": {
"lastModified": 1738852285,
"narHash": "sha256-8Y1uyE6gGHxdU0Vcx2CMg/dAmDSxJw19aAl3TKbbo54=",
"lastModified": 1742255973,
"narHash": "sha256-XfEGVKatTgEMMOVb4SNp1LYLQOSzzrFTDMVDTZFyMVE=",
"owner": "Gerg-L",
"repo": "mnw",
"rev": "6ae73dc9cb72cea17bcc2e3d4670825f483e80e8",
"rev": "b982dbd5e6d55d4438832b3567c09bc2a129649d",
"type": "github"
},
"original": {
@ -62,11 +62,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1732053863,
"narHash": "sha256-DCIVdlb81Fct2uwzbtnawLBC/U03U2hqx8trqTJB7WA=",
"lastModified": 1741118843,
"narHash": "sha256-ggXU3RHv6NgWw+vc+HO4/9n0GPufhTIUjVuLci8Za8c=",
"owner": "oxalica",
"repo": "nil",
"rev": "2e24c9834e3bb5aa2a3701d3713b43a6fb106362",
"rev": "577d160da311cc7f5042038456a0713e9863d09e",
"type": "github"
},
"original": {
@ -77,11 +77,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1740303746,
"narHash": "sha256-XcdiWLEhjJkMxDLKQJ0CCivmYYCvA5MDxu9pMybM5kM=",
"lastModified": 1743076231,
"narHash": "sha256-yQugdVfi316qUfqzN8JMaA2vixl+45GxNm4oUfXlbgw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2d068ae5c6516b2d04562de50a58c682540de9bf",
"rev": "6c5963357f3c1c840201eda129a99d455074db04",
"type": "github"
},
"original": {
@ -93,30 +93,17 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1738452942,
"narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
"lastModified": 1740877520,
"narHash": "sha256-oiwv/ZK/2FhGxrCkQkB83i7GnWXPPLzoqFHpDD3uYpk=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "147dee35aab2193b174e4c0868bd80ead5ce755c",
"type": "github"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
}
},
"nmd": {
"flake": false,
"locked": {
"lastModified": 1705050560,
"narHash": "sha256-x3zzcdvhJpodsmdjqB4t5mkVW22V3wqHLOun0KRBzUI=",
"owner": "~rycee",
"repo": "nmd",
"rev": "66d9334933119c36f91a78d565c152a4fdc8d3d3",
"type": "sourcehut"
},
"original": {
"owner": "~rycee",
"repo": "nmd",
"type": "sourcehut"
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"root": {
@ -126,7 +113,6 @@
"mnw": "mnw",
"nil": "nil",
"nixpkgs": "nixpkgs",
"nmd": "nmd",
"systems": "systems_2"
}
},
@ -138,11 +124,11 @@
]
},
"locked": {
"lastModified": 1731983527,
"narHash": "sha256-JECaBgC0pQ91Hq3W4unH6K9to8s2Zl2sPNu7bLOv4ek=",
"lastModified": 1741055476,
"narHash": "sha256-52vwEV0oS2lCnx3c/alOFGglujZTLmObit7K8VblnS8=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "71287228d96e9568e1e70c6bbfa3f992d145947b",
"rev": "aefb7017d710f150970299685e8d8b549d653649",
"type": "github"
},
"original": {

View file

@ -86,12 +86,6 @@
# Alternate neovim-wrapper
mnw.url = "github:Gerg-L/mnw";
# For generating documentation website
nmd = {
url = "sourcehut:~rycee/nmd";
flake = false;
};
# Language servers (use master instead of nixpkgs)
nil = {
url = "github:oxalica/nil";

View file

@ -1,8 +1,8 @@
{
stdenv,
rustPlatform,
hostPlatform,
vimUtils,
git,
gitMinimal,
src,
version,
}: let
@ -13,17 +13,11 @@
# TODO: remove this if plugin stops using nightly rust
env.RUSTC_BOOTSTRAP = true;
nativeBuildInputs = [git];
cargoLock = {
lockFile = "${src}/Cargo.lock";
allowBuiltinFetchGit = true;
};
};
useFetchCargoVendor = true;
cargoHash = "sha256-F1wh/TjYoiIbDY3J/prVF367MKk3vwM7LqOpRobOs7I=";
libExt =
if hostPlatform.isDarwin
then "dylib"
else "so";
nativeBuildInputs = [gitMinimal];
};
in
vimUtils.buildVimPlugin {
pname = "blink-cmp";
@ -31,8 +25,13 @@ in
# blink references a repro.lua which is placed outside the lua/ directory
doCheck = false;
preInstall = ''
preInstall = let
ext = stdenv.hostPlatform.extensions.sharedLibrary;
in ''
mkdir -p target/release
ln -s ${blink-fuzzy-lib}/lib/libblink_cmp_fuzzy.${libExt} target/release/libblink_cmp_fuzzy.${libExt}
ln -s ${blink-fuzzy-lib}/lib/libblink_cmp_fuzzy${ext} target/release/libblink_cmp_fuzzy${ext}
'';
# Module for reproducing issues
nvimSkipModules = ["repro"];
}

View file

@ -104,6 +104,13 @@ in {
their behaviour was abstract, and confusing. Please use 'vim.options' or 'vim.luaConfigRC'
to replicate previous behaviour.
'')
# 2025-04-04
(mkRemovedOptionModule ["vim" "lsp" "lsplines"] ''
lsplines module has been removed from nvf, as its functionality is now built into Neovim
under the diagnostics module. Please consider using one of 'vim.diagnostics.config' or
'vim.luaConfigRC' to configure LSP lines for Neovim through its own diagnostics API.
'')
]
# Migrated via batchRenameOptions. Further batch renames must be below this line.

View file

@ -0,0 +1,185 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.lists) filter;
inherit (lib.strings) optionalString;
inherit (lib.types) nullOr submodule listOf str bool;
inherit (lib.nvim.types) luaInline;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAfter;
autocommandType = submodule {
options = {
enable =
mkEnableOption ""
// {
default = true;
description = "Whether to enable this autocommand";
};
event = mkOption {
type = nullOr (listOf str);
default = null;
example = ["BufRead" "BufWritePre"];
description = "The event(s) that trigger the autocommand.";
};
pattern = mkOption {
type = nullOr (listOf str);
default = null;
example = ["*.lua" "*.vim"];
description = "The file pattern(s) that determine when the autocommand applies).";
};
callback = mkOption {
type = nullOr luaInline;
default = null;
example = literalExpression ''
mkLuaInline '''
function()
print("Saving a Lua file...")
end
''''
'';
description = "The file pattern(s) that determine when the autocommand applies.";
};
command = mkOption {
type = nullOr str;
default = null;
description = "Vim command string instead of a Lua function.";
};
group = mkOption {
type = nullOr str;
default = null;
example = "MyAutoCmdGroup";
description = "An optional autocommand group to manage related autocommands.";
};
desc = mkOption {
type = nullOr str;
default = null;
example = "Notify when saving a Lua file";
description = "A description for the autocommand.";
};
once = mkOption {
type = bool;
default = false;
description = "Whether autocommand run only once.";
};
nested = mkOption {
type = bool;
default = false;
description = "Whether to allow nested autocommands to trigger.";
};
};
};
autogroupType = submodule {
options = {
enable =
mkEnableOption ""
// {
default = true;
description = "Whether to enable this autogroup";
};
name = mkOption {
type = str;
example = "MyAutoCmdGroup";
description = "The name of the autocommand group.";
};
clear = mkOption {
type = bool;
default = true;
description = ''
Whether to clear existing autocommands in this group before defining new ones.
This helps avoid duplicate autocommands.
'';
};
};
};
cfg = config.vim;
in {
options.vim = {
augroups = mkOption {
type = listOf autogroupType;
default = [];
description = ''
A list of Neovim autogroups, which are used to organize and manage related
autocommands together. Groups allow multiple autocommands to be cleared
or redefined collectively, preventing duplicate definitions.
Each autogroup consists of a name, a boolean indicating whether to clear
existing autocommands, and a list of associated autocommands.
'';
};
autocmds = mkOption {
type = listOf autocommandType;
default = [];
description = ''
A list of Neovim autocommands to be registered.
Each entry defines an autocommand, specifying events, patterns, optional
callbacks, commands, groups, and execution settings.
'';
};
};
config = {
vim = let
enabledAutocommands = filter (cmd: cmd.enable) cfg.autocmds;
enabledAutogroups = filter (au: au.enable) cfg.augroups;
in {
luaConfigRC = {
augroups = entryAfter ["pluginConfigs"] (optionalString (enabledAutogroups != []) ''
local nvf_autogroups = {}
for _, group in ipairs(${toLuaObject enabledAutogroups}) do
if group.name then
nvf_autogroups[group.name] = { clear = group.clear }
end
end
for group_name, options in pairs(nvf_autogroups) do
vim.api.nvim_create_augroup(group_name, options)
end
'');
autocmds = entryAfter ["pluginConfigs"] (optionalString (enabledAutocommands != []) ''
local nvf_autocommands = ${toLuaObject enabledAutocommands}
for _, autocmd in ipairs(nvf_autocommands) do
vim.api.nvim_create_autocmd(
autocmd.event,
{
group = autocmd.group,
pattern = autocmd.pattern,
buffer = autocmd.buffer,
desc = autocmd.desc,
callback = autocmd.callback,
command = autocmd.command,
once = autocmd.once,
nested = autocmd.nested
}
)
end
'');
};
};
assertions = [
{
assertion = builtins.all (cmd: (cmd.command == null || cmd.callback == null)) cfg.autocmds;
message = "An autocommand cannot have both 'command' and 'callback' defined at the same time.";
}
];
};
}

View file

@ -1,7 +1,9 @@
{
imports = [
./autocmds.nix
./basic.nix
./debug.nix
./diagnostics.nix
./highlight.nix
./spellcheck.nix
];

View file

@ -0,0 +1,109 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) attrsOf anything oneOf bool submodule;
inherit (lib.nvim.dag) entryAfter;
inherit (lib.nvim.types) luaInline;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.diagnostics;
# Takes a boolean, a table, or a Lua list ({key = value}). We
# would like to allow all of those types, while clearly expressing
# them in the option's type. As such, this type is what it is.
diagnosticType = oneOf [(attrsOf anything) bool luaInline];
diagnosticsSubmodule = submodule {
# The table might need to be extended, so let's allow that case
# with a freeform type of what is supported by diagnostics opts.
freeformType = attrsOf diagnosticType;
options = {
underline = mkOption {
type = diagnosticType;
default = true;
description = "Use underline for diagnostics.";
};
virtual_text = mkOption {
type = diagnosticType;
default = false;
example = literalExpression ''
{
format = lib.generators.mkLuaInline '''
function(diagnostic)
return string.format("%s (%s)", diagnostic.message, diagnostic.source)
end
''';
}
'';
description = ''
Use virtual text for diagnostics. If multiple diagnostics are set for a namespace,
one prefix per diagnostic + the last diagnostic message are shown.
'';
};
virtual_lines = mkOption {
type = diagnosticType;
default = false;
description = ''
Use virtual lines for diagnostics.
'';
};
signs = mkOption {
type = diagnosticType;
default = false;
example = {
signs.text = {
"vim.diagnostic.severity.ERROR" = "󰅚 ";
"vim.diagnostic.severity.WARN" = "󰀪 ";
};
};
description = ''
Use signs for diagnostics. See {command}`:help diagnostic-signs`.
'';
};
update_in_insert = mkOption {
type = bool;
default = false;
description = ''
Update diagnostics in Insert mode. If `false`, diagnostics will
be updated on InsertLeave ({command}`:help InsertLeave`).
'';
};
};
};
in {
options.vim = {
diagnostics = {
enable = mkEnableOption "diagostics module for Neovim";
config = mkOption {
type = diagnosticsSubmodule;
default = {};
description = ''
Values that will be passed to `vim.diagnostic.config` after being converted
to a Lua table. Possible values for each key can be found in the help text
for `vim.diagnostics.Opts`. You may find more about the diagnostics API of
Neovim in {command}`:help diagnostic-api`.
:::{.note}
This option is freeform. You may set values that are not present in nvf
documentation, but those values will not be fully type checked. Please
refer to the help text for `vim.diagnostic.Opts` for appropriate values.
:::
'';
};
};
};
config.vim = mkIf cfg.enable {
luaConfigRC.diagnostics = entryAfter ["basic"] ''
vim.diagnostic.config(${toLuaObject cfg.config})
'';
};
}

View file

@ -0,0 +1,278 @@
{lib, ...}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) int str enum nullOr attrs;
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
in {
options.vim.assistant = {
codecompanion-nvim = {
enable = mkEnableOption "complementary neovim plugin for codecompanion.nvim";
setupOpts = mkPluginSetupOption "codecompanion-nvim" {
opts = {
send_code = mkEnableOption "code from being sent to the LLM.";
log_level = mkOption {
type = enum ["DEBUG" "INFO" "ERROR" "TRACE"];
default = "ERROR";
description = "Change the level of logging.";
};
language = mkOption {
type = str;
default = "English";
description = "Specify which language an LLM should respond in.";
};
};
display = {
diff = {
enabled =
mkEnableOption ""
// {
default = true;
description = "a diff view to see the changes made by the LLM.";
};
close_chat_at = mkOption {
type = int;
default = 240;
description = ''
Close an open chat buffer if the
total columns of your display are less than...
'';
};
layout = mkOption {
type = enum ["vertical" "horizontal"];
default = "vertical";
description = "Type of split for default provider.";
};
provider = mkOption {
type = enum ["default" "mini_diff"];
default = "default";
description = "The preferred kind of provider.";
};
};
inline = {
layout = mkOption {
type = enum ["vertical" "horizontal" "buffer"];
default = "vertical";
description = "Customize how output is created in new buffer.";
};
};
chat = {
auto_scroll = mkEnableOption "automatic page scrolling.";
show_settings = mkEnableOption ''
LLM settings to appear at the top of the chat buffer.
'';
start_in_insert_mode = mkEnableOption ''
opening the chat buffer in insert mode.
'';
show_header_separator = mkEnableOption ''
header separators in the chat buffer.
Set this to false if you're using an
external markdown formatting plugin.
'';
show_references =
mkEnableOption ""
// {
default = true;
description = "references in the chat buffer.";
};
show_token_count =
mkEnableOption ""
// {
default = true;
description = "the token count for each response.";
};
intro_message = mkOption {
type = str;
default = "Welcome to CodeCompanion ! Press ? for options.";
description = "Message to appear in chat buffer.";
};
separator = mkOption {
type = str;
default = "";
description = ''
The separator between the
different messages in the chat buffer.
'';
};
icons = {
pinned_buffer = mkOption {
type = str;
default = " ";
description = "The icon to represent a pinned buffer.";
};
watched_buffer = mkOption {
type = str;
default = "👀 ";
description = "The icon to represent a watched buffer.";
};
};
};
action_palette = {
width = mkOption {
type = int;
default = 95;
description = "Width of the action palette.";
};
height = mkOption {
type = int;
default = 10;
description = "Height of the action palette.";
};
prompt = mkOption {
type = str;
default = "Prompt ";
description = "Prompt used for interactive LLM calls.";
};
provider = mkOption {
type = enum ["default" "telescope" "mini_pick"];
default = "default";
description = "Provider used for the action palette.";
};
opts = {
show_default_actions =
mkEnableOption ""
// {
default = true;
description = "showing default actions in the action palette.";
};
show_default_prompt_library =
mkEnableOption ""
// {
default = true;
description = ''
showing default prompt library in the action palette.
'';
};
};
};
};
adapters = mkOption {
type = nullOr luaInline;
default = null;
description = "An adapter is what connects Neovim to an LLM.";
};
strategies = {
chat = {
adapter = mkOption {
type = nullOr str;
default = null;
description = "Adapter used for the chat strategy.";
};
keymaps = mkOption {
type = nullOr attrs;
default = null;
description = "Define or override the default keymaps.";
};
variables = mkOption {
type = nullOr luaInline;
default = null;
description = ''
Define your own variables
to share specific content.
'';
};
slash_commands = mkOption {
type = nullOr luaInline;
default = null;
description = ''
Slash Commands (invoked with /) let you dynamically
insert context into the chat buffer,
such as file contents or date/time.
'';
};
tools = mkOption {
type = nullOr attrs;
default = null;
description = ''
Configure tools to perform specific
tasks when invoked by an LLM.
'';
};
roles = mkOption {
type = nullOr luaInline;
default = null;
description = ''
The chat buffer places user and LLM responses under a H2 header.
These can be customized in the configuration.
'';
};
};
inline = {
adapter = mkOption {
type = nullOr str;
default = null;
description = "Adapter used for the inline strategy.";
};
variables = mkOption {
type = nullOr luaInline;
default = null;
description = ''
Define your own variables
to share specific content.
'';
};
keymaps = {
accept_change = {
n = mkOption {
type = str;
default = "ga";
description = "Accept the suggested change.";
};
};
reject_change = {
n = mkOption {
type = str;
default = "gr";
description = "Reject the suggested change.";
};
};
};
};
};
prompt_library = mkOption {
type = nullOr attrs;
default = null;
description = ''
A prompt library is a collection of prompts
that can be used in the action palette.
'';
};
};
};
};
}

View file

@ -0,0 +1,27 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.assistant.codecompanion-nvim;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = [
"plenary-nvim"
];
lazy.plugins = {
codecompanion-nvim = {
package = "codecompanion-nvim";
setupModule = "codecompanion";
inherit (cfg) setupOpts;
};
};
treesitter.enable = true;
};
};
}

View file

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

View file

@ -37,6 +37,12 @@ in {
inherit (cfg) setupOpts;
after = mkIf cfg.cmp.enable "require('copilot_cmp').setup()";
event = [
{
event = "User";
pattern = "LazyFile";
}
];
cmd = ["Copilot" "CopilotAuth" "CopilotDetach" "CopilotPanel" "CopilotStop"];
keys = [
(mkLuaKeymap ["n"] cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion" {})

View file

@ -2,5 +2,6 @@
imports = [
./chatgpt
./copilot
./codecompanion
];
}

View file

@ -1,8 +1,8 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption mkOption literalMD;
inherit (lib.types) listOf str either attrsOf submodule enum anything int nullOr;
inherit (lib.types) bool listOf str either attrsOf submodule enum anything int nullOr;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
inherit (lib.nvim.types) mkPluginSetupOption luaInline pluginType;
inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.nvim.config) mkBool;
@ -21,8 +21,9 @@
freeformType = anything;
options = {
module = mkOption {
type = str;
description = "module of the provider";
type = nullOr str;
default = null;
description = "Provider module.";
};
};
};
@ -40,20 +41,7 @@ in {
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.
'';
description = "Settings for completion providers.";
};
};
@ -63,6 +51,12 @@ in {
default = [];
description = "List of sources to enable for cmdline. Null means use default source list.";
};
keymap = mkOption {
type = keymapType;
default = {};
description = "blink.cmp cmdline keymap";
};
};
completion = {
@ -74,6 +68,16 @@ in {
description = "Delay before auto show triggers";
};
};
menu.auto_show = mkOption {
type = bool;
default = true;
description = ''
Manages the appearance of the completion menu. You may prevent the menu
from automatically showing by this option to `false` and manually showing
it with the show keymap command.
'';
};
};
keymap = mkOption {
@ -103,7 +107,25 @@ in {
fuzzy = {
prebuilt_binaries = {
download = mkBool false ''
Auto-downloads prebuilt binaries. Do not enable, it doesn't work on nix
Auto-downloads prebuilt binaries.
::: .{warning}
Do not enable this option, as it does **not work** on Nix!
:::
'';
};
implementation = mkOption {
type = enum ["lua" "prefer_rust" "rust" "prefer_rust_with_warning"];
default = "prefer_rust";
description = ''
fuzzy matcher implementation for Blink.
* `"lua"`: slower, Lua native fuzzy matcher implementation
* `"rust": use the SIMD fuzzy matcher, 'frizbee'
* `"prefer_rust"`: use the rust implementation, but fall back to lua
* `"prefer_rust_with_warning"`: use the rust implementation, and fall back to lua
if it is not available after emitting a warning.
'';
};
};
@ -118,5 +140,67 @@ in {
scrollDocsUp = mkMappingOption "Scroll docs up [blink.cmp]" "<C-d>";
scrollDocsDown = mkMappingOption "Scroll docs down [blink.cmp]" "<C-f>";
};
sourcePlugins = let
sourcePluginType = submodule {
options = {
enable = mkEnableOption "this source";
package = mkOption {
type = pluginType;
description = ''
`blink-cmp` source plugin package.
'';
};
module = mkOption {
type = str;
description = ''
Value of {option}`vim.autocomplete.blink-cmp.setupOpts.sources.providers.<name>.module`.
Should be present in the source's documentation.
'';
};
};
};
in
mkOption {
type = submodule {
freeformType = attrsOf sourcePluginType;
options = let
defaultSourcePluginOption = name: package: module: {
package = mkOption {
type = pluginType;
default = package;
description = ''
`blink-cmp` ${name} source plugin package.
'';
};
module = mkOption {
type = str;
default = module;
description = ''
Value of {option}`vim.autocomplete.blink-cmp.setupOpts.sources.providers.${name}.module`.
'';
};
enable = mkEnableOption "${name} source";
};
in {
# emoji completion after :
emoji = defaultSourcePluginOption "emoji" "blink-emoji-nvim" "blink-emoji";
# spelling suggestions as completions
spell = defaultSourcePluginOption "spell" "blink-cmp-spell" "blink-cmp-spell";
# words from nearby files
ripgrep = defaultSourcePluginOption "ripgrep" "blink-ripgrep-nvim" "blink-ripgrep";
};
};
default = {};
description = ''
`blink.cmp` sources.
Attribute names must be source names used in {option}`vim.autocomplete.blink-cmp.setupOpts.sources.default`.
'';
};
friendly-snippets.enable = mkEnableOption "friendly-snippets for blink to source from automatically";
};
}

View file

@ -6,6 +6,8 @@
inherit (lib.modules) mkIf;
inherit (lib.strings) optionalString;
inherit (lib.generators) mkLuaInline;
inherit (lib.attrsets) attrValues filterAttrs mapAttrsToList;
inherit (lib.lists) map optional elem;
inherit (lib.nvim.lua) toLuaObject;
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
@ -19,9 +21,27 @@
else if (plugin ? pname && (tryEval plugin.pname).success)
then plugin.pname
else plugin.name;
enabledBlinkSources = filterAttrs (_source: definition: definition.enable) cfg.sourcePlugins;
blinkSourcePlugins = map (definition: definition.package) (attrValues enabledBlinkSources);
blinkBuiltins = [
"path"
"lsp"
"snippets"
"buffer"
"omni"
];
in {
assertions =
mapAttrsToList (provider: definition: {
assertion = elem provider blinkBuiltins || definition.module != null;
message = "`config.vim.autocomplete.blink-cmp.setupOpts.sources.providers.${provider}.module` is `null`: non-builtin providers must set `module`.";
})
cfg.setupOpts.sources.providers;
vim = mkIf cfg.enable {
startPlugins = ["blink-compat"];
startPlugins = ["blink-compat"] ++ blinkSourcePlugins ++ (optional cfg.friendly-snippets.enable "friendly-snippets");
lazy.plugins = {
blink-cmp = {
package = "blink-cmp";
@ -32,12 +52,14 @@ in {
#
# event = ["InsertEnter" "CmdlineEnter"];
after = ''
${optionalString config.vim.lazy.enable
(concatStringsSep "\n" (map
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
cmpCfg.sourcePlugins))}
'';
after =
# lua
''
${optionalString config.vim.lazy.enable
(concatStringsSep "\n" (map
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
cmpCfg.sourcePlugins))}
'';
};
};
@ -45,13 +67,26 @@ in {
enableSharedCmpSources = true;
blink-cmp.setupOpts = {
sources = {
default = ["lsp" "path" "snippets" "buffer"] ++ (attrNames cmpCfg.sources);
default =
[
"lsp"
"path"
"snippets"
"buffer"
]
++ (attrNames cmpCfg.sources)
++ (attrNames enabledBlinkSources);
providers =
mapAttrs (name: _: {
inherit name;
module = "blink.compat.source";
})
cmpCfg.sources;
cmpCfg.sources
// (mapAttrs (name: definition: {
inherit name;
inherit (definition) module;
})
enabledBlinkSources);
};
snippets = mkIf config.vim.snippets.luasnip.enable {
preset = "luasnip";
@ -67,16 +102,18 @@ in {
${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
(mkLuaInline
# lua
''
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()
if has_words_before then
return cmp.show()
end
end
end
'')
'')
"fallback"
];
${mappings.previous} = [

View file

@ -60,12 +60,6 @@ in {
enableSharedCmpSources = true;
nvim-cmp = {
sources = {
nvim-cmp = null;
buffer = "[Buffer]";
path = "[Path]";
};
sourcePlugins = ["cmp-buffer" "cmp-path"];
setupOpts = {

View file

@ -98,14 +98,16 @@ in {
sources = mkOption {
type = attrsOf (nullOr str);
default = {};
default = {
nvim-cmp = null;
buffer = "[Buffer]";
path = "[Path]";
};
example = {
nvim-cmp = null;
buffer = "[Buffer]";
};
description = "The list of sources used by nvim-cmp";
example = literalExpression ''
{
nvim-cmp = null;
buffer = "[Buffer]";
}
'';
};
sourcePlugins = mkOption {

View file

@ -1,7 +1,23 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) listOf attrsOf anything nullOr enum;
in {
options.vim.dashboard.alpha = {
enable = mkEnableOption "fast and fully programmable greeter for neovim [alpha.mvim]";
enable = mkEnableOption "fast and fully programmable greeter for neovim [alpha.nvim]";
theme = mkOption {
type = nullOr (enum ["dashboard" "startify" "theta"]);
default = "dashboard";
description = "Alpha default theme to use";
};
layout = mkOption {
type = listOf (attrsOf anything);
default = [];
description = "Alpha dashboard layout";
};
opts = mkOption {
type = attrsOf anything;
default = {};
description = "Optional global options";
};
};
}

View file

@ -5,8 +5,11 @@
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.dashboard.alpha;
themeDefined = cfg.theme != null;
layoutDefined = cfg.layout != [];
in {
config = mkIf cfg.enable {
vim.startPlugins = [
@ -14,207 +17,30 @@ in {
"nvim-web-devicons"
];
# the entire credit for this dashboard configuration to https://github.com/Rishabh672003
# honestly, excellent work
vim.pluginRC.alpha = entryAnywhere ''
local alpha = require("alpha")
local plenary_path = require("plenary.path")
local dashboard = require("alpha.themes.dashboard")
local cdir = vim.fn.getcwd()
local if_nil = vim.F.if_nil
local nvim_web_devicons = {
enabled = true,
highlight = true,
}
local function get_extension(fn)
local match = fn:match("^.+(%..+)$")
local ext = ""
if match ~= nil then
ext = match:sub(2)
end
return ext
end
local function icon(fn)
local nwd = require("nvim-web-devicons")
local ext = get_extension(fn)
return nwd.get_icon(fn, ext, { default = true })
end
local function file_button(fn, sc, short_fn)
short_fn = short_fn or fn
local ico_txt
local fb_hl = {}
if nvim_web_devicons.enabled then
local ico, hl = icon(fn)
local hl_option_type = type(nvim_web_devicons.highlight)
if hl_option_type == "boolean" then
if hl and nvim_web_devicons.highlight then
table.insert(fb_hl, { hl, 0, 3 })
end
end
if hl_option_type == "string" then
table.insert(fb_hl, { nvim_web_devicons.highlight, 0, 3 })
end
ico_txt = ico .. " "
else
ico_txt = ""
end
local file_button_el = dashboard.button(sc, ico_txt .. short_fn, "<cmd>e " .. fn .. " <CR>")
local fn_start = short_fn:match(".*[/\\]")
if fn_start ~= nil then
table.insert(fb_hl, { "Comment", #ico_txt - 2, #fn_start + #ico_txt })
end
file_button_el.opts.hl = fb_hl
return file_button_el
end
local default_mru_ignore = { "gitcommit" }
local mru_opts = {
ignore = function(path, ext)
return (string.find(path, "COMMIT_EDITMSG")) or (vim.tbl_contains(default_mru_ignore, ext))
end,
}
--- @param start number
--- @param cwd string optional
--- @param items_number number optional number of items to generate, default = 10
local function mru(start, cwd, items_number, opts)
opts = opts or mru_opts
items_number = if_nil(items_number, 15)
local oldfiles = {}
for _, v in pairs(vim.v.oldfiles) do
if #oldfiles == items_number then
break
end
local cwd_cond
if not cwd then
cwd_cond = true
else
cwd_cond = vim.startswith(v, cwd)
end
local ignore = (opts.ignore and opts.ignore(v, get_extension(v))) or false
if (vim.fn.filereadable(v) == 1) and cwd_cond and not ignore then
oldfiles[#oldfiles + 1] = v
end
end
local target_width = 35
local tbl = {}
for i, fn in ipairs(oldfiles) do
local short_fn
if cwd then
short_fn = vim.fn.fnamemodify(fn, ":.")
else
short_fn = vim.fn.fnamemodify(fn, ":~")
end
if #short_fn > target_width then
short_fn = plenary_path.new(short_fn):shorten(1, { -2, -1 })
if #short_fn > target_width then
short_fn = plenary_path.new(short_fn):shorten(1, { -1 })
end
end
local shortcut = tostring(i + start - 1)
local file_button_el = file_button(fn, shortcut, short_fn)
tbl[i] = file_button_el
end
return {
type = "group",
val = tbl,
opts = {},
}
end
local default_header = {
type = "text",
val = {
[[ ]],
[[ ]],
[[ ]],
[[ ]],
[[ ]],
-- [[ __ ]],
-- [[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
-- [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]],
-- [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
-- [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]],
-- [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]],
},
opts = {
position = "center",
hl = "Type",
-- wrap = "overflow";
},
}
local section_mru = {
type = "group",
val = {
{
type = "text",
val = "Recent files",
opts = {
hl = "SpecialComment",
shrink_margin = false,
position = "center",
},
},
{ type = "padding", val = 1 },
{
type = "group",
val = function()
return { mru(0, cdir) }
end,
opts = { shrink_margin = false },
},
},
}
local buttons = {
type = "group",
val = {
{ type = "text", val = "Quick links", opts = { hl = "SpecialComment", position = "center" } },
{ type = "padding", val = 1 },
-- TODO: buttons should be added based on whether or not the relevant plugin is available
dashboard.button("e", " New file", "<cmd>ene<CR>"), -- available all the time
dashboard.button("SPC F", "󰈞 Find file"), -- telescope
dashboard.button("SPC ff", "󰊄 Live grep"), -- telescope
dashboard.button("SPC p", " Projects"), -- any project
dashboard.button("q", "󰅚 Quit", "<cmd>qa<CR>"), -- available all the time
},
position = "center",
}
local config = {
layout = {
{ type = "padding", val = 2 },
default_header,
{ type = "padding", val = 2 },
section_mru,
{ type = "padding", val = 2 },
buttons,
},
opts = {
margin = 5,
setup = function()
vim.cmd([[
autocmd alpha_temp DirChanged * lua require('alpha').redraw()
]])
end,
},
}
alpha.setup(config)
vim.pluginRC.alpha = let
setupOpts =
if themeDefined
then lib.generators.mkLuaInline "require'alpha.themes.${cfg.theme}'.config"
else {
inherit (cfg) layout opts;
};
in ''
require('alpha').setup(${toLuaObject setupOpts})
'';
assertions = [
{
assertion = themeDefined || layoutDefined;
message = ''
One of 'theme' or 'layout' should be defined in Alpha configuration.
'';
}
{
assertion = !(themeDefined && layoutDefined);
message = ''
'theme' and 'layout' cannot be defined at the same time.
'';
}
];
};
}

View file

@ -3,18 +3,48 @@
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.generators) mkLuaInline;
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})
'';
};
};
config = mkMerge [
(mkIf cfg.enable {
vim = {
startPlugins = ["nvim-lint"];
pluginRC.nvim-lint = entryAnywhere ''
require("lint").linters_by_ft = ${toLuaObject cfg.linters_by_ft}
local linters = require("lint").linters
local nvf_linters = ${toLuaObject cfg.linters}
for linter, config in pairs(nvf_linters) do
if linters[linter] == nil then
linters[linter] = config
else
for key, val in pairs(config) do
linters[linter][key] = val
end
end
end
'';
};
})
(mkIf (cfg.enable && cfg.lint_after_save) {
vim = {
augroups = [{name = "nvf_nvim_lint";}];
autocmds = [
{
event = ["BufWritePost"];
callback = mkLuaInline ''
function()
require("lint").try_lint()
end
'';
}
];
};
})
];
}

View file

@ -1,27 +1,121 @@
{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"];
};
inherit (lib.types) nullOr attrsOf listOf str either submodule bool enum;
inherit (lib.nvim.types) luaInline;
linterType = submodule {
options = {
name = mkOption {
type = nullOr str;
default = null;
description = "Name of the linter";
};
cmd = mkOption {
type = nullOr str;
default = null;
description = "Command of the linter";
};
args = mkOption {
type = nullOr (listOf (either str luaInline));
default = null;
description = "Arguments to pass";
};
stdin = mkOption {
type = nullOr bool;
default = null;
description = "Send content via stdin.";
};
append_fname = mkOption {
type = nullOr bool;
default = null;
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.
Automatically add the current file name to the commands arguments. Only
has an effect if stdin is false
'';
};
stream = mkOption {
type = nullOr (enum ["stdout" "stderr" "both"]);
default = null;
description = "Result stream";
};
ignore_exitcode = mkOption {
type = nullOr bool;
default = null;
description = ''
Declares if exit code != 1 should be ignored or result in a warning.
'';
};
env = mkOption {
type = nullOr (attrsOf str);
default = null;
description = "Environment variables to use";
};
cwd = mkOption {
type = nullOr str;
default = null;
description = "Working directory of the linter";
};
parser = mkOption {
type = nullOr luaInline;
default = null;
description = "Parser function";
};
};
};
in {
options.vim.diagnostics.nvim-lint = {
enable = mkEnableOption "asynchronous linter plugin for Neovim [nvim-lint]";
# nvim-lint does not have a setup table.
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
through `toLuaObject. You are responsible for passing the correct Nix
data types to generate a correct Lua value that conform is able to
accept.
'';
};
linters = mkOption {
type = attrsOf linterType;
default = {};
example = ''
{
phpcs = {
args = ["-q" "--report-json" "-"];
# this will replace the builtin's env table if it exists
env = {
ENV_VAR = "something";
};
};
}
'';
description = ''
Linter configurations. Builtin linters will be updated and not
replaced, but note that this is not a deep extend operation, i.e. if
you define an `env` option, it will replace the entire `env` table
provided by the builtin (if it exists).
'';
};
lint_after_save = mkEnableOption "autocmd to lint after each save" // {default = true;};
};
}

View file

@ -4,7 +4,7 @@
...
}: let
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) attrs enum;
inherit (lib.types) attrs enum nullOr;
inherit (lib.nvim.types) mkPluginSetupOption;
inherit (lib.nvim.lua) mkLuaInline;
in {
@ -31,7 +31,7 @@ in {
};
format_on_save = mkOption {
type = attrs;
type = nullOr attrs;
default = {
lsp_format = "fallback";
timeout_ms = 500;
@ -43,7 +43,7 @@ in {
};
format_after_save = mkOption {
type = attrs;
type = nullOr attrs;
default = {lsp_format = "fallback";};
description = ''
Table that will be passed to `conform.format()`. If this

View file

@ -5,6 +5,7 @@ in {
./gitsigns
./vim-fugitive
./git-conflict
./gitlinker-nvim
];
options.vim.git = {
@ -15,6 +16,7 @@ in {
* gitsigns
* vim-fugitive
* git-conflict
* gitlinker-nvim
'';
};
}

View file

@ -0,0 +1,23 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.git.gitlinker-nvim;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["gitlinker-nvim"];
lazy.plugins = {
"gitlinker-nvim" = {
package = "gitlinker-nvim";
setupModule = "gitlinker";
inherit (cfg) setupOpts;
cmd = ["GitLink"];
};
};
};
};
}

View file

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

View file

@ -0,0 +1,13 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.git.gitlinker-nvim = {
enable = mkEnableOption "gitlinker-nvim" // {default = config.vim.git.enable;};
setupOpts = mkPluginSetupOption "gitlinker-nvim" {};
};
}

View file

@ -5,6 +5,7 @@
}: let
inherit (builtins) toJSON;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetExprBinding mkSetLuaBinding pushDownDefault;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
@ -32,6 +33,7 @@ in {
return '<Ignore>'
end
'')
(mkSetExprBinding gsMappings.previousHunk ''
function()
if vim.wo.diff then return ${toJSON gsMappings.previousHunk.value} end
@ -77,13 +79,12 @@ in {
}
(mkIf cfg.codeActions.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.gitsigns-ca = ''
table.insert(
ls_sources,
null_ls.builtins.code_actions.gitsigns
)
'';
vim.lsp.null-ls = {
enable = true;
setupOpts.sources.gitsigns-ca = mkLuaInline ''
require("null-ls").builtins.code_actions.gitsigns
'';
};
})
]);
}

View file

@ -10,8 +10,8 @@
inherit (lib.lists) isList;
inherit (lib.meta) getExe;
inherit (lib.types) enum either listOf package str;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.languages) diagnosticsToLua;
inherit (lib.nvim.types) mkGrammarOption diagnostics;
cfg = config.vim.languages.astro;
@ -22,7 +22,7 @@
package = pkgs.astro-language-server;
lspConfig = ''
lspconfig.astro.setup {
capabilities = capabilities;
capabilities = capabilities,
on_attach = attach_keymaps,
cmd = ${
if isList cfg.lsp.package
@ -39,26 +39,14 @@
formats = {
prettier = {
package = pkgs.nodePackages.prettier;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.prettier.with({
command = "${cfg.format.package}/bin/prettier",
})
)
'';
};
prettierd = {
package = pkgs.prettierd;
};
biome = {
package = pkgs.biome;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.biome.with({
command = "${cfg.format.package}/bin/biome",
})
)
'';
};
};
@ -67,14 +55,23 @@
diagnosticsProviders = {
eslint_d = {
package = pkgs.eslint_d;
nullConfig = pkg: ''
table.insert(
ls_sources,
null_ls.builtins.diagnostics.eslint_d.with({
command = "${getExe pkg}",
})
)
'';
config = {
# HACK: change if nvim-lint gets a dynamic enable thing
parser = mkLuaInline ''
function(output, bufnr, cwd)
local markers = { "eslint.config.js", "eslint.config.mjs",
".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.yml", }
for _, filename in ipairs(markers) do
local path = vim.fs.join(cwd, filename)
if vim.loop.fs_stat(path) then
return require("lint.linters.eslint_d").parser(output, bufnr, cwd)
end
end
return {}
end
'';
};
};
};
in {
@ -91,16 +88,16 @@ in {
enable = mkEnableOption "Astro LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption {
description = "Astro LSP server to use";
type = enum (attrNames servers);
default = defaultServer;
description = "Astro LSP server to use";
};
package = mkOption {
description = "Astro LSP server package, or the command to run as a list of strings";
example = ''[lib.getExe pkgs.astro-language-server "--minify" "--stdio"]'';
type = either package (listOf str);
default = servers.${cfg.lsp.server}.package;
example = ''[lib.getExe pkgs.astro-language-server "--minify" "--stdio"]'';
description = "Astro LSP server package, or the command to run as a list of strings";
};
};
@ -143,16 +140,29 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.astro-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.astro = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
(mkIf cfg.extraDiagnostics.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources = diagnosticsToLua {
lang = "astro";
config = cfg.extraDiagnostics.types;
inherit diagnosticsProviders;
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.astro = cfg.extraDiagnostics.types;
linters = mkMerge (map (
name: {
${name} =
diagnosticsProviders.${name}.config
// {
cmd = getExe diagnosticsProviders.${name}.package;
};
}
)
cfg.extraDiagnostics.types);
};
})
]);

View file

@ -6,10 +6,10 @@
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum either package listOf str bool;
inherit (lib.nvim.languages) diagnosticsToLua;
inherit (lib.nvim.types) diagnostics mkGrammarOption;
inherit (lib.nvim.lua) expToLua;
@ -37,14 +37,6 @@
formats = {
shfmt = {
package = pkgs.shfmt;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.shfmt.with({
command = "${pkgs.shfmt}/bin/shfmt",
})
)
'';
};
};
@ -52,15 +44,6 @@
diagnosticsProviders = {
shellcheck = {
package = pkgs.shellcheck;
nullConfig = pkg: ''
table.insert(
ls_sources,
null_ls.builtins.diagnostics.shellcheck.with({
command = "${pkg}/bin/shellcheck",
diagnostics_format = "#{m} [#{c}]"
})
)
'';
};
};
in {
@ -130,16 +113,23 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.bash-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.sh = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
(mkIf cfg.extraDiagnostics.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources = diagnosticsToLua {
lang = "bash";
config = cfg.extraDiagnostics.types;
inherit diagnosticsProviders;
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.sh = cfg.extraDiagnostics.types;
linters = mkMerge (map (name: {
${name}.cmd = getExe diagnosticsProviders.${name}.package;
})
cfg.extraDiagnostics.types);
};
})
]);

View file

@ -6,6 +6,7 @@
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum either listOf package str;
@ -42,14 +43,6 @@
formats = {
prettier = {
package = pkgs.nodePackages.prettier;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.prettier.with({
command = "${cfg.format.package}/bin/prettier",
})
)
'';
};
prettierd = {
@ -132,8 +125,13 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.css-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.css = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
]);
}

View file

@ -0,0 +1,51 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.types) package;
inherit (lib.nvim.types) mkGrammarOption;
cfg = config.vim.languages.cue;
in {
options.vim.languages.cue = {
enable = mkEnableOption "CUE language support";
treesitter = {
enable = mkEnableOption "CUE treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "cue";
};
lsp = {
enable = mkEnableOption "CUE LSP support" // {default = config.vim.languages.enableLSP;};
package = mkOption {
type = package;
default = pkgs.cue;
description = "cue lsp implementation";
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.cue-lsp = ''
lspconfig.cue.setup {
capabilities = capabilities,
on_attach = default_on_attach,
cmd = {"${cfg.lsp.package}/bin/cue", "lsp"},
}
'';
})
]);
}

View file

@ -5,13 +5,16 @@ in {
./asm.nix
./astro.nix
./bash.nix
./cue.nix
./dart.nix
./clang.nix
./css.nix
./elixir.nix
./fsharp.nix
./gleam.nix
./go.nix
./hcl.nix
./helm.nix
./kotlin.nix
./html.nix
./haskell.nix
@ -40,6 +43,7 @@ in {
./nu.nix
./odin.nix
./wgsl.nix
./yaml.nix
./ruby.nix
];

View file

@ -38,14 +38,9 @@
formats = {
mix = {
package = pkgs.elixir;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.mix.with({
command = "${cfg.format.package}/bin/mix",
})
)
'';
config = {
command = "${cfg.format.package}/bin/mix";
};
};
};
in {
@ -107,8 +102,12 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.elixir-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.elixir = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} =
formats.${cfg.format.type}.config;
};
})
(mkIf cfg.elixir-tools.enable {

View file

@ -0,0 +1,107 @@
{
lib,
pkgs,
config,
...
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) either listOf package str enum;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.lua) expToLua;
defaultServer = "fsautocomplete";
servers = {
fsautocomplete = {
package = pkgs.fsautocomplete;
internalFormatter = false;
lspConfig = ''
lspconfig.fsautocomplete.setup {
capabilities = capabilities;
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else "{'${cfg.lsp.package}/bin/fsautocomplete'}"
},
}
'';
};
};
defaultFormat = "fantomas";
formats = {
fantomas = {
package = pkgs.fantomas;
};
};
cfg = config.vim.languages.fsharp;
in {
options = {
vim.languages.fsharp = {
enable = mkEnableOption "F# language support";
treesitter = {
enable = mkEnableOption "F# treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "fsharp";
};
lsp = {
enable = mkEnableOption "F# LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption {
type = enum (attrNames servers);
default = defaultServer;
description = "F# LSP server to use";
};
package = mkOption {
type = either package (listOf str);
default = servers.${cfg.lsp.server}.package;
example = ''[lib.getExe pkgs.fsautocomplete "--state-directory" "~/.cache/fsautocomplete"]'';
description = "F# LSP server package, or the command to run as a list of strings";
};
};
format = {
enable = mkEnableOption "F# formatting" // {default = config.vim.languages.enableFormat;};
type = mkOption {
type = enum (attrNames formats);
default = defaultFormat;
description = "F# formatter to use";
};
package = mkOption {
type = package;
default = formats.${cfg.format.type}.package;
description = "F# formatter package";
};
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.fsharp-lsp = servers.${cfg.lsp.server}.lspConfig;
})
(mkIf cfg.format.enable {
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.fsharp = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
]);
}

View file

@ -38,36 +38,15 @@
formats = {
gofmt = {
package = pkgs.go;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.gofmt.with({
command = "${cfg.format.package}/bin/gofmt",
})
)
'';
config.command = "${cfg.format.package}/bin/gofmt";
};
gofumpt = {
package = pkgs.gofumpt;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.gofumpt.with({
command = "${cfg.format.package}/bin/gofumpt",
})
)
'';
config.command = getExe cfg.format.package;
};
golines = {
package = pkgs.golines;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.golines.with({
command = "${cfg.format.package}/bin/golines",
})
)
'';
config.command = "${cfg.format.package}/bin/golines";
};
};
@ -153,8 +132,11 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.go-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.go = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
};
})
(mkIf cfg.dap.enable {

View file

@ -6,6 +6,7 @@
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.types) package bool enum;
inherit (lib.nvim.types) mkGrammarOption;
@ -30,14 +31,6 @@
formats = {
hclfmt = {
package = pkgs.hclfmt;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.hclfmt.with({
command = "${lib.getExe cfg.format.package}",
})
)
'';
};
};
in {
@ -110,8 +103,13 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.hcl-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.hcl = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
]);
}

View file

@ -0,0 +1,89 @@
{
pkgs,
config,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum either listOf package str;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.lua) expToLua;
cfg = config.vim.languages.helm;
yamlCfg = config.vim.languages.yaml;
helmCmd =
if isList cfg.lsp.package
then cfg.lsp.package
else ["${cfg.lsp.package}/bin/helm_ls" "serve"];
yamlCmd =
if isList yamlCfg.lsp.package
then builtins.elemAt yamlCfg.lsp.package 0
else "${yamlCfg.lsp.package}/bin/yaml-language-server";
defaultServer = "helm-ls";
servers = {
helm-ls = {
package = pkgs.helm-ls;
lspConfig = ''
lspconfig.helm_ls.setup {
capabilities = capabilities,
on_attach = default_on_attach,
cmd = ${expToLua helmCmd},
settings = {
['helm-ls'] = {
yamlls = {
path = "${yamlCmd}"
}
}
}
}
'';
};
};
in {
options.vim.languages.helm = {
enable = mkEnableOption "Helm language support";
treesitter = {
enable = mkEnableOption "Helm treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "helm";
};
lsp = {
enable = mkEnableOption "Helm LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption {
description = "Helm LSP server to use";
type = enum (attrNames servers);
default = defaultServer;
};
package = mkOption {
description = "Helm LSP server package";
type = either package (listOf str);
default = servers.${cfg.lsp.server}.package;
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.helm-lsp = servers.${cfg.lsp.server}.lspConfig;
})
{
# Enables filetype detection
vim.startPlugins = [pkgs.vimPlugins.vim-helm];
}
]);
}

View file

@ -7,7 +7,6 @@
inherit (lib.options) mkEnableOption mkOption literalExpression;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.meta) getExe;
inherit (lib.nvim.languages) diagnosticsToLua;
inherit (lib.types) either package listOf str;
inherit (lib.nvim.types) mkGrammarOption diagnostics;
inherit (lib.lists) isList;
@ -19,14 +18,6 @@
diagnosticsProviders = {
ktlint = {
package = pkgs.ktlint;
nullConfig = pkg: ''
table.insert(
ls_sources,
null_ls.builtins.diagnostics.ktlint.with({
command = "${getExe pkg}",
})
)
'';
};
};
in {
@ -76,11 +67,13 @@ in {
})
(mkIf cfg.extraDiagnostics.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources = diagnosticsToLua {
lang = "kotlin";
config = cfg.extraDiagnostics.types;
inherit diagnosticsProviders;
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.kotlin = cfg.extraDiagnostics.types;
linters = mkMerge (map (name: {
${name}.cmd = getExe diagnosticsProviders.${name}.package;
})
cfg.extraDiagnostics.types);
};
})

View file

@ -4,16 +4,30 @@
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.meta) getExe;
inherit (lib.lists) isList;
inherit (lib.types) either listOf package str;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.types) bool either enum listOf package str;
inherit (lib.nvim.types) diagnostics mkGrammarOption;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.dag) entryBefore;
cfg = config.vim.languages.lua;
defaultFormat = "stylua";
formats = {
stylua = {
package = pkgs.stylua;
};
};
defaultDiagnosticsProvider = ["luacheck"];
diagnosticsProviders = {
luacheck = {
package = pkgs.luajitPackages.luacheck;
};
};
in {
imports = [
(lib.mkRemovedOptionModule ["vim" "languages" "lua" "lsp" "neodev"] ''
@ -39,6 +53,34 @@ in {
lazydev.enable = mkEnableOption "lazydev.nvim integration, useful for neovim plugin developers";
};
format = {
enable = mkOption {
type = bool;
default = config.vim.languages.enableFormat;
description = "Enable Lua formatting";
};
type = mkOption {
type = enum (attrNames formats);
default = defaultFormat;
description = "Lua formatter to use";
};
package = mkOption {
type = package;
default = formats.${cfg.format.type}.package;
description = "Lua formatter package";
};
};
extraDiagnostics = {
enable = mkEnableOption "extra Lua diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
types = diagnostics {
langDesc = "Lua";
inherit diagnosticsProviders;
inherit defaultDiagnosticsProvider;
};
};
};
config = mkMerge [
@ -74,6 +116,27 @@ in {
})
'';
})
(mkIf cfg.format.enable {
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.lua = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
(mkIf cfg.extraDiagnostics.enable {
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.lua = cfg.extraDiagnostics.types;
linters = mkMerge (map (name: {
${name}.cmd = getExe diagnosticsProviders.${name}.package;
})
cfg.extraDiagnostics.types);
};
})
]))
];
}

View file

@ -5,12 +5,13 @@
...
}: let
inherit (builtins) attrNames;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.lists) isList concatLists;
inherit (lib.lists) isList;
inherit (lib.types) bool enum either package listOf str;
inherit (lib.nvim.lua) expToLua toLuaObject;
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
inherit (lib.nvim.types) diagnostics mkGrammarOption mkPluginSetupOption;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.languages.markdown;
@ -32,31 +33,23 @@
};
};
defaultFormat = "denofmt";
defaultFormat = "deno_fmt";
formats = {
# for backwards compatibility
denofmt = {
package = pkgs.deno;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.deno_fmt.with({
filetypes = ${expToLua (concatLists [cfg.format.extraFiletypes ["markdown"]])},
command = "${cfg.format.package}/bin/deno",
})
)
'';
};
deno_fmt = {
package = pkgs.deno;
};
prettierd = {
package = pkgs.prettierd;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.prettierd.with({
filetypes = ${expToLua (concatLists [cfg.format.extraFiletypes ["markdown"]])},
command = "${cfg.format.package}/bin/prettierd",
})
)
'';
};
};
defaultDiagnosticsProvider = ["markdownlint-cli2"];
diagnosticsProviders = {
markdownlint-cli2 = {
package = pkgs.markdownlint-cli2;
};
};
in {
@ -96,7 +89,7 @@ in {
type = mkOption {
type = enum (attrNames formats);
default = defaultFormat;
description = "Markdown formatter to use";
description = "Markdown formatter to use. `denofmt` is deprecated and currently aliased to deno_fmt.";
};
package = mkOption {
@ -121,17 +114,19 @@ in {
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
Inline Markdown rendering with [render-markdown.nvim]
'';
};
setupOpts = mkPluginSetupOption "render-markdown" {
auto_override_publish_diagnostics = mkOption {
description = "Automatically override the publish_diagnostics handler";
type = bool;
default = true;
};
};
setupOpts = mkPluginSetupOption "render-markdown" {};
};
};
extraDiagnostics = {
enable = mkEnableOption "extra Markdown diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
types = diagnostics {
langDesc = "Markdown";
inherit diagnosticsProviders;
inherit defaultDiagnosticsProvider;
};
};
};
@ -148,8 +143,17 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.markdown-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.markdown = [cfg.format.type];
setupOpts.formatters.${
if cfg.format.type == "denofmt"
then "deno_fmt"
else cfg.format.type
} = {
command = getExe cfg.format.package;
};
};
})
# Extensions
@ -159,5 +163,16 @@ in {
require("render-markdown").setup(${toLuaObject cfg.extensions.render-markdown-nvim.setupOpts})
'';
})
(mkIf cfg.extraDiagnostics.enable {
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.markdown = cfg.extraDiagnostics.types;
linters = mkMerge (map (name: {
${name}.cmd = getExe diagnosticsProviders.${name}.package;
})
cfg.extraDiagnostics.types);
};
})
]);
}

View file

@ -6,6 +6,7 @@
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum either listOf package str;
@ -38,14 +39,9 @@
formats = {
nimpretty = {
package = pkgs.nim;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.nimpretty.with({
command = "${pkgs.nim}/bin/nimpretty",
})
)
'';
config = {
command = "${cfg.format.package}/bin/nimpretty";
};
};
};
in {
@ -110,8 +106,11 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.nim-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.nim = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
};
})
]);
}

View file

@ -6,6 +6,7 @@
}: let
inherit (builtins) attrNames;
inherit (lib) concatStringsSep;
inherit (lib.meta) getExe;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
@ -13,7 +14,6 @@
inherit (lib.types) anything attrsOf enum either listOf nullOr package str;
inherit (lib.nvim.types) mkGrammarOption diagnostics;
inherit (lib.nvim.lua) expToLua toLuaObject;
inherit (lib.nvim.languages) diagnosticsToLua;
cfg = config.vim.languages.nix;
@ -100,29 +100,11 @@
formats = {
alejandra = {
package = pkgs.alejandra;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.alejandra.with({
command = "${cfg.format.package}/bin/alejandra"
})
)
'';
};
nixfmt = {
package = pkgs.nixfmt-rfc-style;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.nixfmt.with({
command = "${cfg.format.package}/bin/nixfmt"
})
)
'';
};
nixpkgs-fmt = null; # removed
};
defaultDiagnosticsProvider = ["statix" "deadnix"];
@ -219,7 +201,6 @@ in {
${concatStringsSep ", " (attrNames formats)}
'';
}
{
assertion = cfg.lsp.server != "rnix";
message = ''
@ -240,17 +221,24 @@ in {
vim.lsp.lspconfig.sources.nix-lsp = servers.${cfg.lsp.server}.lspConfig;
})
(mkIf (cfg.format.enable && !servers.${cfg.lsp.server}.internalFormatter) {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.nix-format = formats.${cfg.format.type}.nullConfig;
(mkIf (cfg.format.enable && (!cfg.lsp.enable || !servers.${cfg.lsp.server}.internalFormatter)) {
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.nix = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
(mkIf cfg.extraDiagnostics.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources = diagnosticsToLua {
lang = "nix";
config = cfg.extraDiagnostics.types;
inherit diagnosticsProviders;
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.nix = cfg.extraDiagnostics.types;
linters = mkMerge (map (name: {
${name}.cmd = getExe diagnosticsProviders.${name}.package;
})
cfg.extraDiagnostics.types);
};
})
]);

View file

@ -37,14 +37,6 @@
formats = {
ocamlformat = {
package = pkgs.ocamlPackages.ocamlformat;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.ocamlformat.with({
command = "${cfg.format.package}/bin/ocamlformat",
})
)
'';
};
};
in {
@ -97,9 +89,13 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.ocamlformat = formats.${cfg.format.type}.nullConfig;
vim.extraPackages = [formats.${cfg.format.type}.package];
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.ocaml = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
]);
}

View file

@ -64,6 +64,26 @@
}
'';
};
intelephense = {
package = pkgs.intelephense;
lspConfig = ''
lspconfig.intelephense.setup{
capabilities = capabilities,
on_attach = default_on_attach,
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''
{
"${getExe cfg.lsp.package}",
"--stdio"
},
''
}
}
'';
};
};
in {
options.vim.languages.php = {

View file

@ -47,7 +47,7 @@
};
python-lsp-server = {
package = pkgs.python-lsp-server;
package = pkgs.python3Packages.python-lsp-server;
lspConfig = ''
lspconfig.pylsp.setup{
capabilities = capabilities;
@ -66,26 +66,10 @@
formats = {
black = {
package = pkgs.black;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.black.with({
command = "${cfg.format.package}/bin/black",
})
)
'';
};
isort = {
package = pkgs.isort;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.isort.with({
command = "${cfg.format.package}/bin/isort",
})
)
'';
};
black-and-isort = {
@ -96,15 +80,6 @@
black --quiet - "$@" | isort --profile black -
'';
};
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.black.with({
command = "${cfg.format.package}/bin/black",
})
)
'';
};
ruff = {
@ -115,14 +90,6 @@
ruff format -
'';
};
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.ruff.with({
command = "${cfg.format.package}/bin/ruff",
})
)
'';
};
};
@ -272,8 +239,22 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.python-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
# HACK: I'm planning to remove these soon so I just took the easiest way out
setupOpts.formatters_by_ft.python =
if cfg.format.type == "black-and-isort"
then ["black"]
else [cfg.format.type];
setupOpts.formatters =
if (cfg.format.type == "black-and-isort")
then {
black.command = "${cfg.format.package}/bin/black";
}
else {
${cfg.format.type}.command = getExe cfg.format.package;
};
};
})
(mkIf cfg.dap.enable {

View file

@ -24,28 +24,29 @@
package = pkgs.rWrapper.override {
packages = [pkgs.rPackages.styler];
};
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.styler.with({
command = "${cfg.format.package}/bin/R",
})
)
'';
config = {
command = "${cfg.format.package}/bin/R";
};
};
format_r = {
package = pkgs.rWrapper.override {
packages = [pkgs.rPackages.formatR];
};
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.format_r.with({
command = "${cfg.format.package}/bin/R",
})
)
'';
config = {
command = "${cfg.format.package}/bin/R";
stdin = true;
args = [
"--slave"
"--no-restore"
"--no-save"
"-s"
"-e"
''formatR::tidy_source(source="stdin")''
];
# TODO: range_args seem to be possible
# https://github.com/nvimtools/none-ls.nvim/blob/main/lua/null-ls/builtins/formatting/format_r.lua
};
};
};
@ -118,8 +119,11 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.r-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.r = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
};
})
(mkIf cfg.lsp.enable {

View file

@ -6,10 +6,10 @@
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.types) mkGrammarOption diagnostics;
inherit (lib.types) either listOf package str enum;
inherit (lib.nvim.languages) diagnosticsToLua;
cfg = config.vim.languages.ruby;
@ -35,24 +35,8 @@
defaultFormat = "rubocop";
formats = {
rubocop = {
# TODO: is this right?
package = pkgs.rubyPackages.rubocop;
nullConfig = ''
local conditional = function(fn)
local utils = require("null-ls.utils").make_conditional_utils()
return fn(utils)
end
table.insert(
ls_sources,
null_ls.builtins.formatting.rubocop.with({
command="${pkgs.bundler}/bin/bundle",
args = vim.list_extend(
{"exec", "rubocop", "-a" },
null_ls.builtins.formatting.rubocop._opts.args
),
})
)
'';
};
};
@ -60,14 +44,7 @@
diagnosticsProviders = {
rubocop = {
package = pkgs.rubyPackages.rubocop;
nullConfig = pkg: ''
table.insert(
ls_sources,
null_ls.builtins.diagnostics.rubocop.with({
command = "${lib.getExe pkg}",
})
)
'';
config.command = getExe cfg.format.package;
};
};
in {
@ -136,16 +113,23 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.ruby-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.ruby = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
(mkIf cfg.extraDiagnostics.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources = diagnosticsToLua {
lang = "ruby";
config = cfg.extraDiagnostics.types;
inherit diagnosticsProviders;
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.ruby = cfg.extraDiagnostics.types;
linters = mkMerge (map (name: {
${name}.cmd = getExe diagnosticsProviders.${name}.package;
})
cfg.extraDiagnostics.types);
};
})
]);

View file

@ -5,6 +5,7 @@
...
}: let
inherit (builtins) attrNames;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.strings) optionalString;
@ -21,14 +22,6 @@
formats = {
rustfmt = {
package = pkgs.rustfmt;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.rustfmt.with({
command = "${cfg.format.package}/bin/rustfmt",
})
)
'';
};
};
in {
@ -62,6 +55,15 @@ in {
description = "Options to pass to rust analyzer";
type = str;
default = "";
example = ''
['rust-analyzer'] = {
cargo = {allFeature = true},
checkOnSave = true,
procMacro = {
enable = true,
},
},
'';
};
};
@ -119,8 +121,13 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.rust-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.rust = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
@ -142,6 +149,9 @@ in {
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
},
default_settings = {
${cfg.lsp.opts}
},
on_attach = function(client, bufnr)
default_on_attach(client, bufnr)
local opts = { noremap=true, silent=true, buffer = bufnr }

View file

@ -6,11 +6,11 @@
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.meta) getExe;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum either listOf package str;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.languages) diagnosticsToLua;
inherit (lib.nvim.types) diagnostics;
cfg = config.vim.languages.sql;
@ -41,15 +41,10 @@
formats = {
sqlfluff = {
package = sqlfluffDefault;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.sqlfluff.with({
command = "${cfg.format.package}/bin/sqlfluff",
extra_args = {"--dialect", "${cfg.dialect}"}
})
)
'';
config = {
command = getExe cfg.format.package;
append_args = ["--dialect=${cfg.dialect}"];
};
};
};
@ -57,15 +52,10 @@
diagnosticsProviders = {
sqlfluff = {
package = sqlfluffDefault;
nullConfig = pkg: ''
table.insert(
ls_sources,
null_ls.builtins.diagnostics.sqlfluff.with({
command = "${pkg}/bin/sqlfluff",
extra_args = {"--dialect", "${cfg.dialect}"}
})
)
'';
config = {
cmd = getExe sqlfluffDefault;
args = ["lint" "--format=json" "--dialect=${cfg.dialect}"];
};
};
};
in {
@ -150,16 +140,20 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources."sql-format" = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.sql = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
};
})
(mkIf cfg.extraDiagnostics.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources = diagnosticsToLua {
lang = "sql";
config = cfg.extraDiagnostics.types;
inherit diagnosticsProviders;
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.sql = cfg.extraDiagnostics.types;
linters =
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
cfg.extraDiagnostics.types);
};
})
]);

View file

@ -9,9 +9,9 @@
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.meta) getExe;
inherit (lib.generators) mkLuaInline;
inherit (lib.types) enum either listOf package str;
inherit (lib.nvim.lua) expToLua;
inherit (lib.nvim.languages) diagnosticsToLua;
inherit (lib.nvim.types) mkGrammarOption diagnostics;
cfg = config.vim.languages.svelte;
@ -39,42 +39,38 @@
formats = {
prettier = {
package = pkgs.nodePackages.prettier;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.prettier.with({
command = "${cfg.format.package}/bin/prettier",
})
)
'';
};
biome = {
package = pkgs.biome;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.biome.with({
command = "${cfg.format.package}/bin/biome",
})
)
'';
};
};
# TODO: specify packages
defaultDiagnosticsProvider = ["eslint_d"];
diagnosticsProviders = {
eslint_d = {
package = pkgs.eslint_d;
nullConfig = pkg: ''
table.insert(
ls_sources,
null_ls.builtins.diagnostics.eslint_d.with({
command = "${getExe pkg}",
})
)
'';
eslint_d = let
pkg = pkgs.eslint_d;
in {
package = pkg;
config = {
cmd = getExe pkg;
# HACK: change if nvim-lint gets a dynamic enable thing
parser = mkLuaInline ''
function(output, bufnr, cwd)
local markers = { "eslint.config.js", "eslint.config.mjs",
".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.yml", }
for _, filename in ipairs(markers) do
local path = vim.fs.join(cwd, filename)
if vim.loop.fs_stat(path) then
return require("lint.linters.eslint_d").parser(output, bufnr, cwd)
end
end
return {}
end
'';
};
};
};
in {
@ -143,16 +139,22 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.svelte-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.svelte = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
(mkIf cfg.extraDiagnostics.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources = diagnosticsToLua {
lang = "svelte";
config = cfg.extraDiagnostics.types;
inherit diagnosticsProviders;
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.svelte = cfg.extraDiagnostics.types;
linters =
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
cfg.extraDiagnostics.types);
};
})
]);

View file

@ -9,10 +9,10 @@
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.meta) getExe;
inherit (lib.generators) mkLuaInline;
inherit (lib.types) enum either listOf package str bool;
inherit (lib.nvim.lua) expToLua toLuaObject;
inherit (lib.nvim.types) mkGrammarOption diagnostics mkPluginSetupOption;
inherit (lib.nvim.languages) diagnosticsToLua;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.languages.ts;
@ -77,39 +77,14 @@
formats = {
prettier = {
package = pkgs.nodePackages.prettier;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.prettier.with({
command = "${cfg.format.package}/bin/prettier",
filetypes = { "typescript", "javascript" },
})
)
'';
};
prettierd = {
package = pkgs.prettierd;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.prettier.with({
command = "${cfg.format.package}/bin/prettierd",
})
)
'';
};
biome = {
package = pkgs.biome;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.biome.with({
command = "${cfg.format.package}/bin/biome",
})
)
'';
};
};
@ -118,14 +93,26 @@
diagnosticsProviders = {
eslint_d = {
package = pkgs.eslint_d;
nullConfig = pkg: ''
table.insert(
ls_sources,
null_ls.builtins.diagnostics.eslint_d.with({
command = "${getExe pkg}",
})
)
'';
config = let
pkg = pkgs.eslint_d;
in {
cmd = getExe pkg;
# HACK: change if nvim-lint gets a dynamic enable thing
parser = mkLuaInline ''
function(output, bufnr, cwd)
local markers = { "eslint.config.js", "eslint.config.mjs",
".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.yml", }
for _, filename in ipairs(markers) do
local path = vim.fs.join(cwd, filename)
if vim.loop.fs_stat(path) then
return require("lint.linters.eslint_d").parser(output, bufnr, cwd)
end
end
return {}
end
'';
};
};
};
in {
@ -215,16 +202,29 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.ts-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts = {
formatters_by_ft.typescript = [cfg.format.type];
# .tsx files
formatters_by_ft.typescriptreact = [cfg.format.type];
formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
};
})
(mkIf cfg.extraDiagnostics.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources = diagnosticsToLua {
lang = "ts";
config = cfg.extraDiagnostics.types;
inherit diagnosticsProviders;
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.typescript = cfg.extraDiagnostics.types;
linters_by_ft.typescriptreact = cfg.extraDiagnostics.types;
linters = mkMerge (map (name: {
${name}.cmd = getExe diagnosticsProviders.${name}.package;
})
cfg.extraDiagnostics.types);
};
})

View file

@ -9,7 +9,6 @@
inherit (lib.lists) isList;
inherit (lib.types) nullOr enum either attrsOf listOf package str;
inherit (lib.attrsets) attrNames;
inherit (lib.generators) mkLuaInline;
inherit (lib.meta) getExe;
inherit (lib.nvim.lua) expToLua toLuaObject;
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
@ -61,26 +60,10 @@
formats = {
typstfmt = {
package = pkgs.typstfmt;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.typstfmt.with({
command = "${cfg.format.package}/bin/typstfmt",
})
)
'';
};
# https://github.com/Enter-tainer/typstyle
typstyle = {
package = pkgs.typstyle;
nullConfig = ''
table.insert(
ls_sources,
null_ls.builtins.formatting.typstfmt.with({
command = "${cfg.format.package}/bin/typstyle",
})
)
'';
};
};
in {
@ -176,8 +159,13 @@ in {
})
(mkIf cfg.format.enable {
vim.lsp.null-ls.enable = true;
vim.lsp.null-ls.sources.typst-format = formats.${cfg.format.type}.nullConfig;
vim.formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft.typst = [cfg.format.type];
setupOpts.formatters.${cfg.format.type} = {
command = getExe cfg.format.package;
};
};
})
(mkIf cfg.lsp.enable {

View file

@ -0,0 +1,85 @@
{
pkgs,
config,
lib,
...
}: let
inherit (builtins) attrNames;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) enum either listOf package str;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.nvim.lua) expToLua;
cfg = config.vim.languages.yaml;
onAttach =
if config.vim.languages.helm.lsp.enable
then ''
on_attach = function(client, bufnr)
local filetype = vim.bo[bufnr].filetype
if filetype == "helm" then
client.stop()
end
end''
else "on_attach = default_on_attach";
defaultServer = "yaml-language-server";
servers = {
yaml-language-server = {
package = pkgs.nodePackages.yaml-language-server;
lspConfig = ''
lspconfig.yamlls.setup {
capabilities = capabilities,
${onAttach},
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/yaml-language-server", "--stdio"}''
},
}
'';
};
};
in {
options.vim.languages.yaml = {
enable = mkEnableOption "YAML language support";
treesitter = {
enable = mkEnableOption "YAML treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "yaml";
};
lsp = {
enable = mkEnableOption "YAML LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption {
type = enum (attrNames servers);
default = defaultServer;
description = "YAML LSP server to use";
};
package = mkOption {
type = either package (listOf str);
default = servers.${cfg.lsp.server}.package;
description = "YAML LSP server package";
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.yaml-lsp = servers.${cfg.lsp.server}.lspConfig;
})
]);
}

View file

@ -4,6 +4,7 @@
pkgs,
...
}: let
inherit (lib.generators) mkLuaInline;
inherit (lib.modules) mkIf;
inherit (lib.strings) optionalString;
inherit (lib.trivial) boolToString;
@ -28,6 +29,25 @@ in {
sourcePlugins = ["cmp-nvim-lsp"];
};
autocmds =
if cfg.inlayHints.enable
then [
{
callback = mkLuaInline ''
function(event)
local bufnr = event.buf
local client = vim.lsp.get_client_by_id(event.data.client_id)
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr })
end
end
'';
desc = "LSP on-attach enable inlay hints autocmd";
event = ["LspAttach"];
}
]
else [];
pluginRC.lsp-setup = ''
vim.g.formatsave = ${boolToString cfg.formatOnSave};

View file

@ -15,7 +15,6 @@
./lightbulb
./otter
./lspkind
./lsplines
./nvim-docs-view
];
}

View file

@ -1,21 +0,0 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAfter;
cfg = config.vim.lsp;
in {
config = mkIf (cfg.enable && cfg.lsplines.enable) {
vim.startPlugins = ["lsp-lines"];
vim.pluginRC.lsplines = entryAfter ["lspconfig"] ''
require("lsp_lines").setup()
vim.diagnostic.config({
virtual_text = false,
})
'';
};
}

View file

@ -1,11 +0,0 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
in {
options.vim.lsp = {
lsplines = {
enable = mkEnableOption ''
diagnostics using virtual lines on top of the real line of code. [lsp_lines]
'';
};
};
}

View file

@ -3,51 +3,24 @@
lib,
...
}: let
inherit (lib.modules) mkIf mkMerge;
inherit (lib.strings) optionalString;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding;
inherit (lib.modules) mkIf mkDefault;
cfg = config.vim.lsp;
self = import ./lspsaga.nix {inherit lib;};
mappingDefinitions = self.options.vim.lsp.lspsaga.mappings;
mappings = addDescriptionsToMappings cfg.lspsaga.mappings mappingDefinitions;
in {
config = mkIf (cfg.enable && cfg.lspsaga.enable) {
vim = {
startPlugins = ["lspsaga-nvim"];
lazy.plugins.lspsaga-nvim = {
package = "lspsaga-nvim";
setupModule = "lspsaga";
inherit (cfg.lspsaga) setupOpts;
maps = {
visual = mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').range_code_action";
normal = mkMerge [
(mkSetLuaBinding mappings.lspFinder "require('lspsaga.provider').lsp_finder")
(mkSetLuaBinding mappings.renderHoveredDoc "require('lspsaga.hover').render_hover_doc")
(mkSetLuaBinding mappings.smartScrollUp "function() require('lspsaga.action').smart_scroll_with_saga(-1) end")
(mkSetLuaBinding mappings.smartScrollDown "function() require('lspsaga.action').smart_scroll_with_saga(1) end")
(mkSetLuaBinding mappings.rename "require('lspsaga.rename').rename")
(mkSetLuaBinding mappings.previewDefinition "require('lspsaga.provider').preview_definition")
(mkSetLuaBinding mappings.showLineDiagnostics "require('lspsaga.diagnostic').show_line_diagnostics")
(mkSetLuaBinding mappings.showCursorDiagnostics "require('lspsaga.diagnostic').show_cursor_diagnostics")
(mkSetLuaBinding mappings.nextDiagnostic "require('lspsaga.diagnostic').navigate('next')")
(mkSetLuaBinding mappings.previousDiagnostic "require('lspsaga.diagnostic').navigate('prev')")
(mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action")
(mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help"))
];
event = ["LspAttach"];
};
pluginRC.lspsaga = entryAnywhere ''
require('lspsaga').init_lsp_saga({
${optionalString config.vim.ui.borders.plugins.lspsaga.enable ''
border_style = '${config.vim.ui.borders.plugins.lspsaga.style}',
''}
})
'';
# Optional dependencies, pretty useful to enhance default functionality of
# Lspsaga.
treesitter.enable = mkDefault true;
visuals.nvim-web-devicons.enable = mkDefault true;
};
};
}

View file

@ -1,29 +1,47 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.binds) mkMappingOption;
{
config,
lib,
...
}: let
inherit (lib.modules) mkRemovedOptionModule;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.nvim.types) borderType mkPluginSetupOption;
inherit (lib.nvim.lua) mkLuaInline;
uiKindSetupOpts =
if config.vim.theme.enable && config.vim.theme.name == "catppuccin"
then {
ui.kind =
mkLuaInline
# lua
''
require("catppuccin.groups.integrations.lsp_saga").custom_kind()
'';
}
else {};
in {
imports = [
(mkRemovedOptionModule ["vim" "lsp" "lspsaga" "mappings"] ''
Lspsaga mappings have been removed from nvf, as the original author has made
very drastic changes to the API after taking back ownership, and the fork we
used is now archived. Please refer to Lspsaga documentation to add keybinds
for functionality you have used.
<https://nvimdev.github.io/lspsaga>
'')
];
options.vim.lsp.lspsaga = {
enable = mkEnableOption "LSP Saga";
mappings = {
lspFinder = mkMappingOption "LSP Finder [LSPSaga]" "<leader>lf";
renderHoveredDoc = mkMappingOption "Rendered hovered docs [LSPSaga]" "<leader>lh";
smartScrollUp = mkMappingOption "Smart scroll up [LSPSaga]" "<C-f>";
smartScrollDown = mkMappingOption "Smart scroll up [LSPSaga]" "<C-b>";
rename = mkMappingOption "Rename [LSPSaga]" "<leader>lr";
previewDefinition = mkMappingOption "Preview definition [LSPSaga]" "<leader>ld";
showLineDiagnostics = mkMappingOption "Show line diagnostics [LSPSaga]" "<leader>ll";
showCursorDiagnostics = mkMappingOption "Show cursor diagnostics [LSPSaga]" "<leader>lc";
nextDiagnostic = mkMappingOption "Next diagnostic [LSPSaga]" "<leader>ln";
previousDiagnostic = mkMappingOption "Previous diagnostic [LSPSaga]" "<leader>lp";
codeAction = mkMappingOption "Code action [LSPSaga]" "<leader>ca";
signatureHelp = mkMappingOption "Signature help [LSPSaga]" "<leader>ls";
};
setupOpts =
mkPluginSetupOption "lspsaga" {
border_style = mkOption {
type = borderType;
default = config.vim.ui.borders.globalStyle;
description = "Border type, see {command}`:help nvim_open_win`";
};
}
// uiKindSetupOpts;
};
}

View file

@ -5,6 +5,9 @@ in {
options.vim.lsp = {
enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options";
formatOnSave = mkEnableOption "format on save";
inlayHints = {
enable = mkEnableOption "inlay hints";
};
mappings = {
goToDefinition =
mkMappingOption "Go to definition"

View file

@ -4,13 +4,12 @@
...
}: let
inherit (lib.modules) mkIf mkMerge;
inherit (lib.attrsets) mapAttrs;
inherit (lib.trivial) boolToString;
inherit (lib.nvim.dag) entryAnywhere entryAfter entryBetween;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAfter;
cfg = config.vim.lsp;
cfg = config.vim.lsp.null-ls;
in {
config = mkIf cfg.null-ls.enable (mkMerge [
config = mkIf cfg.enable (mkMerge [
{
vim = {
startPlugins = [
@ -18,35 +17,14 @@ in {
"plenary-nvim"
];
# null-ls implies LSP already being set up
# since it will hook into LSPs to receive information
# null-ls implies that LSP is already being set up
# as it will hook into LSPs to receive information.
lsp.enable = true;
pluginRC = {
# early setup for null-ls
null_ls-setup = entryAnywhere ''
local null_ls = require("null-ls")
local null_helpers = require("null-ls.helpers")
local null_methods = require("null-ls.methods")
local ls_sources = {}
'';
# null-ls setup
null_ls = entryAfter ["null_ls-setup" "lsp-setup"] ''
require('null-ls').setup({
debug = ${boolToString cfg.null-ls.debug},
diagnostics_format = "${cfg.null-ls.diagnostics_format}",
debounce = ${toString cfg.null-ls.debounce},
default_timeout = ${toString cfg.null-ls.default_timeout},
sources = ls_sources,
on_attach = default_on_attach
})
'';
};
pluginRC.null_ls = entryAfter ["lsp-setup"] ''
require('null-ls').setup(${toLuaObject cfg.setupOpts})
'';
};
}
{
vim.pluginRC = mapAttrs (_: v: (entryBetween ["null_ls"] ["null_ls-setup"] v)) cfg.null-ls.sources;
}
]);
}

View file

@ -1,34 +1,87 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) attrsOf str int;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) attrsOf str int nullOr;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.types) luaInline mkPluginSetupOption;
inherit (lib.nvim.config) batchRenameOptions;
migrationTable = {
debug = "debug";
diagnostics_format = "diagnostics_format";
debounce = "debounce";
default_timeout = "default_timeout";
sources = "sources";
};
renamedSetupOpts =
batchRenameOptions
["vim" "lsp" "null-ls"]
["vim" "lsp" "null-ls" "setupOpts"]
migrationTable;
in {
imports = renamedSetupOpts;
options.vim.lsp.null-ls = {
enable = mkEnableOption "null-ls, also enabled automatically";
enable = mkEnableOption ''
null-ls, plugin to use Neovim as a language server to inject LSP diagnostics,
code actions, and more via Lua.
'';
debug = mkEnableOption "debugging information for `null-ls";
setupOpts = mkPluginSetupOption "null-ls" {
debug = mkEnableOption ''
debugging information for null-ls.
diagnostics_format = mkOption {
type = str;
default = "[#{m}] #{s} (#{c})";
description = "Diagnostic output format for null-ls";
};
Displays all possible log messages and writes them to the null-ls log,
which you can view with the command `:NullLsLog`
'';
debounce = mkOption {
type = int;
default = 250;
description = "Default debounce";
};
diagnostics_format = mkOption {
type = str;
default = "[#{m}] #{s} (#{c})";
description = ''
Sets the default format used for diagnostics. null-ls will replace th
e following special components with the relevant diagnostic information:
default_timeout = mkOption {
type = int;
default = 5000;
description = "Default timeout value, in milliseconds";
};
* `#{m}`: message
* `#{s}`: source name (defaults to null-ls if not specified)
* `#{c}`: code (if available)
'';
};
sources = mkOption {
description = "null-ls sources";
type = attrsOf str;
default = {};
debounce = mkOption {
type = int;
default = 250;
description = ''
Amount of time between the last change to a buffer and the next `textDocument/didChange` notification.
'';
};
default_timeout = mkOption {
type = int;
default = 5000;
description = ''
Amount of time (in milliseconds) after which built-in sources will time out.
:::{.note}
Built-in sources can define their own timeout period and users can override
the timeout period on a per-source basis
:::
'';
};
sources = mkOption {
type = nullOr (attrsOf luaInline);
default = null;
description = "Sources for null-ls to register";
};
on_attach = mkOption {
type = nullOr luaInline;
default = mkLuaInline "on_attach";
description = ''
Defines an on_attach callback to run whenever null-ls attaches to a buffer.
'';
};
};
};
}

View file

@ -57,8 +57,8 @@ in {
};
mappings = {
viewToggle = mkMappingOption "Open or close the docs view panel" "lvt";
viewUpdate = mkMappingOption "Manually update the docs view panel" "lvu";
viewToggle = mkMappingOption "Open or close the docs view panel" "<leader>lvt";
viewUpdate = mkMappingOption "Manually update the docs view panel" "<leader>lvu";
};
};
}

View file

@ -15,13 +15,12 @@
mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions;
in {
config = mkIf (cfg.enable && cfg.otter-nvim.enable) {
assertions = [
{
assertion = !config.vim.utility.ccc.enable;
message = ''
ccc and otter have a breaking conflict. It's been reported upstream. Until it's fixed, disable one of them
'';
}
warnings = [
# TODO: remove warning when we update to nvim 0.11
(mkIf config.vim.utility.ccc.enable ''
ccc and otter occasionally have small conflicts that will disappear with nvim 0.11.
In the meantime, otter handles it by throwing a warning, but both plugins will work.
'')
];
vim = {
startPlugins = ["otter-nvim"];

View file

@ -3,6 +3,7 @@
lib,
...
}: let
inherit (lib.generators) mkLuaInline;
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
@ -10,6 +11,21 @@
cfg = config.vim.mini.indentscope;
in {
vim = mkIf cfg.enable {
autocmds = [
{
callback = mkLuaInline ''
function()
local ignore_filetypes = ${toLuaObject cfg.setupOpts.ignore_filetypes}
if vim.tbl_contains(ignore_filetypes, vim.bo.filetype) then
vim.b.miniindentscope_disable = true
end
end
'';
desc = "Disable indentscope for certain filetypes";
event = ["FileType"];
}
];
startPlugins = ["mini-indentscope"];
pluginRC.mini-indentscope = entryAnywhere ''

View file

@ -1,13 +1,16 @@
{
config,
lib,
...
}: let
inherit (lib.options) mkEnableOption;
{lib, ...}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
inherit (lib.types) str listOf;
in {
options.vim.mini.indentscope = {
enable = mkEnableOption "mini.indentscope";
setupOpts = mkPluginSetupOption "mini.indentscope" {};
setupOpts = mkPluginSetupOption "mini.indentscope" {
ignore_filetypes = mkOption {
type = listOf str;
default = ["help" "neo-tree" "notify" "NvimTree" "TelescopePrompt"];
description = "File types to ignore for illuminate";
};
};
};
}

View file

@ -10,13 +10,13 @@
cfg = config.vim.minimap.minimap-vim;
in {
config = mkIf cfg.enable {
vim.startPlugins = [
pkgs.code-minimap
"minimap-vim"
];
vim = {
startPlugins = ["minimap-vim"];
extraPackages = [pkgs.code-minimap];
vim.binds.whichKey.register = pushDownDefault {
"<leader>m" = "+Minimap";
binds.whichKey.register = pushDownDefault {
"<leader>m" = "+Minimap";
};
};
};
}

View file

@ -1,6 +1,10 @@
{lib, ...}: let
inherit (lib.types) nullOr str bool;
inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.strings) isString;
inherit (lib.types) nullOr str bool int enum listOf either;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.types) luaInline mkPluginSetupOption;
in {
imports = let
renameSetupOpt = oldPath: newPath:
@ -50,68 +54,100 @@ in {
usePicker = mkOption {
type = bool;
default = true;
description = "Whether or not we should use dressing.nvim to build a session picker UI";
description = ''
Whether we should use `dressing.nvim` to build a session picker UI
'';
};
setupOpts = {
setupOpts = mkPluginSetupOption "which-key" {
path_replacer = mkOption {
type = types.str;
type = str;
default = "__";
description = "The character to which the path separator will be replaced for session files";
description = ''
The character to which the path separator will be replaced for session files
'';
};
colon_replacer = mkOption {
type = types.str;
type = str;
default = "++";
description = "The character to which the colon symbol will be replaced for session files";
description = ''
The character to which the colon symbol will be replaced for session files
'';
};
autoload_mode = mkOption {
type = types.enum ["Disabled" "CurrentDir" "LastSession"];
type = either (enum ["Disabled" "CurrentDir" "LastSession"]) luaInline;
# Variable 'sm' is defined in the pluginRC of nvim-session-manager. The
# definition is as follows: `local sm = require('session_manager.config')`
apply = val:
if isString val
then mkLuaInline "sm.AutoloadMode.${val}"
else val;
default = "LastSession";
description = "Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession";
description = ''
Define what to do when Neovim is started without arguments.
Takes either one of `"Disabled"`, `"CurrentDir"`, `"LastSession` in which case the value
will be inserted into `sm.AutoloadMode.<value>`, or an inline Lua value.
'';
};
max_path_length = mkOption {
type = types.nullOr types.int;
type = nullOr int;
default = 80;
description = "Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all";
description = ''
Shorten the display path if length exceeds this threshold.
Use `0` if don't want to shorten the path at all
'';
};
autosave_last_session = mkOption {
type = types.bool;
type = bool;
default = true;
description = "Automatically save last session on exit and on session switch";
description = ''
Automatically save last session on exit and on session switch
'';
};
autosave_ignore_not_normal = mkOption {
type = types.bool;
type = bool;
default = true;
description = "Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed";
description = ''
Plugin will not save a session when no buffers are opened, or all of them are
not writable or listed
'';
};
autosave_ignore_dirs = mkOption {
type = types.listOf types.str;
type = listOf str;
default = [];
description = "A list of directories where the session will not be autosaved";
};
autosave_ignore_filetypes = mkOption {
type = types.listOf types.str;
type = listOf str;
default = ["gitcommit"];
description = "All buffers of these file types will be closed before the session is saved";
description = ''
All buffers of these file types will be closed before the session is saved
'';
};
autosave_ignore_buftypes = mkOption {
type = types.listOf types.str;
type = listOf str;
default = [];
description = "All buffers of these buffer types will be closed before the session is saved";
description = ''
All buffers of these buffer types will be closed before the session is saved
'';
};
autosave_only_in_session = mkOption {
type = types.bool;
type = bool;
default = false;
description = "Always autosaves session. If true, only autosaves after a session is active";
description = ''
Always autosaves session. If `true`, only autosaves after a session is active
'';
};
};
};

View file

@ -21,6 +21,17 @@
"codedark"
"dracula"
"everforest"
"github_dark"
"github_light"
"github_dark_dimmed"
"github_dark_default"
"github_light_default"
"github_dark_high_contrast"
"github_light_high_contrast"
"github_dark_colorblind"
"github_light_colorblind"
"github_dark_tritanopia"
"github_light_tritanopia"
"gruvbox"
"gruvbox_dark"
"gruvbox_light"
@ -113,8 +124,6 @@ in {
mkOption {
type = enum themesConcatted;
default = "auto";
# TODO: xml generation error if the closing '' is on a new line.
# issue: https://gitlab.com/rycee/nmd/-/issues/10
defaultText = ''`config.vim.theme.name` if theme supports lualine else "auto"'';
description = "Theme for lualine";
};
@ -230,35 +239,26 @@ in {
{
-- Lsp server name
function()
local buf_ft = vim.api.nvim_get_option_value('filetype', {})
local buf_ft = vim.bo.filetype
local excluded_buf_ft = { toggleterm = true, NvimTree = true, ["neo-tree"] = true, TelescopePrompt = true }
-- List of buffer types to exclude
local excluded_buf_ft = {"toggleterm", "NvimTree", "neo-tree", "TelescopePrompt"}
-- Check if the current buffer type is in the excluded list
for _, excluded_type in ipairs(excluded_buf_ft) do
if buf_ft == excluded_type then
return ""
if excluded_buf_ft[buf_ft] then
return ""
end
local bufnr = vim.api.nvim_get_current_buf()
local clients = vim.lsp.get_clients({ bufnr = bufnr })
if vim.tbl_isempty(clients) then
return "No Active LSP"
end
-- Get the name of the LSP server active in the current buffer
local clients = vim.lsp.get_active_clients()
local msg = 'No Active Lsp'
-- if no lsp client is attached then return the msg
if next(clients) == nil then
return msg
end
local active_clients = {}
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return client.name
end
table.insert(active_clients, client.name)
end
return msg
return table.concat(active_clients, ", ")
end,
icon = ' ',
separator = {left = ''},

View file

@ -9,7 +9,7 @@
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.tabline.nvimBufferline;
self = import ./nvim-bufferline.nix {inherit lib;};
self = import ./nvim-bufferline.nix {inherit config lib;};
inherit (self.options.vim.tabline.nvimBufferline) mappings;
in {
config = mkIf cfg.enable {

View file

@ -1,4 +1,8 @@
{lib, ...}: let
{
config,
lib,
...
}: let
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) enum bool either nullOr str int listOf attrs;
inherit (lib.generators) mkLuaInline;
@ -23,7 +27,14 @@ in {
setupOpts = mkPluginSetupOption "Bufferline-nvim" {
highlights = mkOption {
type = either attrs luaInline;
default = {};
default =
if config.vim.theme.enable && config.vim.theme.name == "catppuccin"
then
mkLuaInline
''
require("catppuccin.groups.integrations.bufferline").get()
''
else {};
description = ''
Overrides the highlight groups of bufferline.
@ -268,6 +279,12 @@ in {
highlight = "Directory";
separator = true;
}
{
filetype = "neo-tree";
text = "File Explorer";
highlight = "Directory";
separator = true;
}
];
description = "The windows to offset bufferline above, see `:help bufferline-offset`";
};

View file

@ -66,21 +66,22 @@ in {
transparent_background = ${boolToString transparent},
term_colors = true,
integrations = {
nvimtree = {
enabled = true,
transparent_panel = ${boolToString transparent},
show_root = true,
},
nvimtree = {
enabled = true,
transparent_panel = ${boolToString transparent},
show_root = true,
},
hop = true,
gitsigns = true,
telescope = true,
treesitter = true,
gitsigns = true,
telescope = true,
treesitter = true,
treesitter_context = true,
ts_rainbow = true,
ts_rainbow = true,
fidget = true,
alpha = true,
leap = true,
lsp_saga = true,
markdown = true,
noice = true,
notify = true, -- nvim-notify
@ -106,9 +107,9 @@ in {
style' =
warnIf (style == "light") "oxocarbon: light theme is not well-supported" style;
in ''
require('oxocarbon')
vim.opt.background = "${style'}"
vim.cmd.colorscheme = "oxocarbon"
require('oxocarbon')
vim.opt.background = "${style'}"
vim.cmd.colorscheme = "oxocarbon"
${optionalString transparent ''
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
@ -195,4 +196,20 @@ in {
vim.cmd.colorscheme("nord")
'';
};
github = {
setup = {
style ? "dark",
transparent ? false,
...
}: ''
require('github-theme').setup({
options = {
transparent = ${boolToString transparent},
},
})
vim.cmd[[colorscheme github_${style}]]
'';
styles = ["dark" "light" "dark_dimmed" "dark_default" "light_default" "dark_high_contrast" "light_high_contrast" "dark_colorblind" "light_colorblind" "dark_tritanopia" "light_tritanopia"];
};
}

View file

@ -24,12 +24,19 @@ in {
grammars = mkOption {
type = listOf package;
default = [];
example = literalExpression ''
pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
regex
kdl
];
'';
description = ''
List of treesitter grammars to install.
List of treesitter grammars to install. For grammars to be installed properly,
you must use grammars from `pkgs.vimPlugins.nvim-treesitter.builtGrammars`.
For languages already supported by nvf, you may
use the {option}`vim.language.<lang>.treesitter` options, which
will automatically add the required grammars to this.
For languages already supported by nvf, you may use
{option}`vim.language.<lang>.treesitter` options, which will automatically add
the required grammars to this.
'';
};

View file

@ -102,11 +102,7 @@ in {
setupOpts = mkPluginSetupOption "colorizer" {
filetypes = mkOption {
description = ''
Filetypes to enable on and their option overrides.
"*" means enable on all filetypes. Filetypes prefixed with "!" are disabled.
'';
type = attrsOf settingSubmodule;
default = {};
example = {
"*" = {};
@ -115,13 +111,21 @@ in {
AARRGGBB = false;
};
};
type = attrsOf settingSubmodule;
description = ''
Filetypes to enable on and their option overrides.
`"*"` means enable on all filetypes. Filetypes prefixed with `"!"` are disabled.
'';
};
user_default_options = mkOption {
description = "Default options";
default = {};
type = settingSubmodule;
default = {};
description = ''
`user_default_options` is the second parameter to nvim-colorizer's setup function.
Anything set here is the inverse of the previous setup configuration.
'';
};
};
};

View file

@ -11,7 +11,7 @@ in {
setupOpts = mkPluginSetupOption "vim-illuminate" {
filetypes_denylist = mkOption {
type = listOf str;
default = ["dirvish" "fugitive" "NvimTree" "TelescopePrompt"];
default = ["dirvish" "fugitive" "help" "neo-tree" "notify" "NvimTree" "TelescopePrompt"];
description = "Filetypes to not illuminate, this overrides `filetypes_allowlist`";
};
};

View file

@ -3,16 +3,22 @@
./binds
./ccc
./diffview
./direnv
./fzf-lua
./gestures
./harpoon
./icon-picker
./images
./leetcode-nvim
./mkdir
./motion
./multicursors
./new-file-template
./nix-develop
./oil-nvim
./outline
./preview
./snacks-nvim
./surround
./telescope
./wakatime

View file

@ -0,0 +1,13 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.utility.direnv;
in {
vim = mkIf cfg.enable {
startPlugins = ["direnv-vim"];
};
}

View file

@ -1,6 +1,6 @@
{
imports = [
./config.nix
./lsplines.nix
./direnv.nix
];
}

View file

@ -0,0 +1,5 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
in {
options.vim.utility.direnv.enable = mkEnableOption "syncing nvim shell environment with direnv's using `direnv.vim`";
}

View file

@ -1,15 +1,21 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib.types) nullOr enum;
inherit (lib.types) enum str;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.nvim.types) mkPluginSetupOption borderType;
in {
options.vim.fzf-lua = {
enable = mkEnableOption "fzf-lua";
setupOpts = mkPluginSetupOption "fzf-lua" {
fzf_bin = mkOption {
type = str;
default = "${lib.getExe pkgs.fzf}";
description = "Path to fzf executable";
};
winopts.border = mkOption {
type = borderType;
default = config.vim.ui.borders.globalStyle;

View file

@ -0,0 +1,41 @@
{
options,
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.binds) pushDownDefault mkKeymap;
cfg = config.vim.navigation.harpoon;
keys = cfg.mappings;
inherit (options.vim.navigation.harpoon) mappings;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["plenary-nvim"];
lazy.plugins.harpoon = {
package = "harpoon";
setupModule = "harpoon";
inherit (cfg) setupOpts;
cmd = ["Harpoon"];
keys = [
(mkKeymap "n" keys.markFile "<Cmd>lua require('harpoon'):list():add()<CR>" {desc = mappings.markFile.description;})
(mkKeymap "n" keys.listMarks "<Cmd>lua require('harpoon').ui:toggle_quick_menu(require('harpoon'):list())<CR>" {desc = mappings.listMarks.description;})
(mkKeymap "n" keys.file1 "<Cmd>lua require('harpoon'):list():select(1)<CR>" {desc = mappings.file1.description;})
(mkKeymap "n" keys.file2 "<Cmd>lua require('harpoon'):list():select(2)<CR>" {desc = mappings.file2.description;})
(mkKeymap "n" keys.file3 "<Cmd>lua require('harpoon'):list():select(3)<CR>" {desc = mappings.file3.description;})
(mkKeymap "n" keys.file4 "<Cmd>lua require('harpoon'):list():select(4)<CR>" {desc = mappings.file4.description;})
];
};
binds.whichKey.register = pushDownDefault {
"<leader>a" = "Harpoon Mark";
};
};
};
}

View file

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

View file

@ -0,0 +1,53 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) bool;
inherit (lib.nvim.binds) mkMappingOption;
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
inherit (lib.generators) mkLuaInline;
in {
options.vim.navigation.harpoon = {
mappings = {
markFile = mkMappingOption "Mark file [Harpoon]" "<leader>a";
listMarks = mkMappingOption "List marked files [Harpoon]" "<C-e>";
file1 = mkMappingOption "Go to marked file 1 [Harpoon]" "<C-j>";
file2 = mkMappingOption "Go to marked file 2 [Harpoon]" "<C-k>";
file3 = mkMappingOption "Go to marked file 3 [Harpoon]" "<C-l>";
file4 = mkMappingOption "Go to marked file 4 [Harpoon]" "<C-;>";
};
enable = mkEnableOption "Quick bookmarks on keybinds [Harpoon]";
setupOpts = mkPluginSetupOption "Harpoon" {
defaults = {
save_on_toggle = mkOption {
type = bool;
default = false;
description = ''
Any time the ui menu is closed then we will save the
state back to the backing list, not to the fs
'';
};
sync_on_ui_close = mkOption {
type = bool;
default = false;
description = ''
Any time the ui menu is closed then the state of the
list will be sync'd back to the fs
'';
};
key = mkOption {
type = luaInline;
default = mkLuaInline ''
function()
return vim.loop.cwd()
end
'';
description = ''
How the out list key is looked up. This can be useful
when using worktrees and using git remote instead of file path
'';
};
};
};
};
}

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