mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-14 22:47:48 +00:00
Merge branch 'main' into feat-languages-qml
This commit is contained in:
commit
115f3aa594
127 changed files with 3625 additions and 1580 deletions
|
|
@ -14,7 +14,7 @@ indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
[*.{js,json,nix,yml,yaml}]
|
[*.{js,json,nix,yml,yaml,toml}]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
tab_width = 2
|
tab_width = 2
|
||||||
|
|
|
||||||
6
.github/CODEOWNERS
vendored
6
.github/CODEOWNERS
vendored
|
|
@ -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
27
.github/README.md
vendored
|
|
@ -200,8 +200,9 @@ fix.
|
||||||
**Q**: What platforms are supported?
|
**Q**: What platforms are supported?
|
||||||
|
|
||||||
**A**: nvf actively supports **Linux and Darwin** platforms using standalone
|
**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
|
Nix, NixOS or Home-Manager. It has been reported that **Android** is also
|
||||||
installation instructions.
|
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_?
|
**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
|
an imperative path (e.g., `~/.config/nvim`) for my Neovim configuration instead
|
||||||
of a configuration generated from Nix?
|
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
|
any plugins you want to load to `vim.startPlugins`. This will load your
|
||||||
configuration from `~/.config/nvim`. You may still use `vim.*` to modify
|
configuration from `~/.config/nvim`. You may still use `vim.*` to modify
|
||||||
Neovim's behaviour with Nix.
|
Neovim's behaviour with Nix.
|
||||||
|
|
@ -246,14 +247,15 @@ Neovim's behaviour with Nix.
|
||||||
|
|
||||||
### Co-Maintainers
|
### 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)
|
- [**@horriblename**](https://github.com/horriblename)
|
||||||
([Liberapay](https://liberapay.com/horriblename/))- For actively implementing
|
([Liberapay](https://liberapay.com/horriblename/))- For actively implementing
|
||||||
planned features and quality of life updates.
|
planned features and quality of life updates.
|
||||||
- [**@Diniamo**](https://github.com/Diniamo)
|
- [**@Soliprem**](https://github.com/soliprem) - For rigorously implementing
|
||||||
([Liberapay](https://en.liberapay.com/diniamo/)) - For actively submitting
|
missing features and excellent work on new language modules.
|
||||||
pull requests, issues and assistance with maintenance of nvf.
|
|
||||||
|
|
||||||
Please do remember to extend your thanks (financially or otherwise) if this
|
Please do remember to extend your thanks (financially or otherwise) if this
|
||||||
project has been helpful to you.
|
project has been helpful to you.
|
||||||
|
|
@ -270,14 +272,14 @@ heart-felt thanks to
|
||||||
- [**@FlafyDev**](https://github.com/FlafyDev) - For getting Home-Manager module
|
- [**@FlafyDev**](https://github.com/FlafyDev) - For getting Home-Manager module
|
||||||
to work and Nix assistance.
|
to work and Nix assistance.
|
||||||
- [**@n3oney**](https://github.com/n3oney) - For making custom keybinds finally
|
- [**@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
|
- [**@Yavko**](https://github.com/Yavko) - For the amazing **nvf** logo
|
||||||
- [**@FrothyMarrow**](https://github.com/FrothyMarrow) - For seeing mistakes
|
- [**@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,
|
- [**@Gerg-l**](https://github.com/gerg-l) 🐸 - For the modern Neovim wrapper,
|
||||||
[mnw], and occasional code improvements.
|
[mnw], and occasional improvements to the codebase.
|
||||||
- [**@Soliprem**](https://github.com/soliprem) - Rigorously implementing missing
|
- [**@Diniamo**](https://github.com/Diniamo) - For actively submitting pull
|
||||||
features and excellent work on new language modules.
|
requests, issues and assistance with co-maintenance of nvf.
|
||||||
|
|
||||||
and everyone who has submitted issues or pull requests!
|
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
|
I am grateful for their previous work and inspiration, and I wholeheartedly
|
||||||
recommend checking their work out.
|
recommend checking their work out.
|
||||||
<br/>
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
||||||
11
.github/typos.toml
vendored
11
.github/typos.toml
vendored
|
|
@ -1,5 +1,10 @@
|
||||||
|
|
||||||
default.extend-ignore-words-re = ["(?i)(noice)", "befores", "annote", "viw"]
|
files.extend-exclude = ["npins/sources.json"]
|
||||||
files.extend-exclude = [
|
default.extend-ignore-words-re = [
|
||||||
"npins/sources.json"
|
"(?i)(noice)",
|
||||||
|
"befores",
|
||||||
|
"annote",
|
||||||
|
"viw",
|
||||||
|
"BA", # somehow "BANanaD3V" is valid, but BA is not...
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
2
.github/workflows/cachix.yml
vendored
2
.github/workflows/cachix.yml
vendored
|
|
@ -36,7 +36,7 @@ jobs:
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
- uses: cachix/cachix-action@v15
|
- uses: cachix/cachix-action@v16
|
||||||
with:
|
with:
|
||||||
authToken: ${{ secrets.CACHIX_TOKEN }}
|
authToken: ${{ secrets.CACHIX_TOKEN }}
|
||||||
extraPullNames: nix-community
|
extraPullNames: nix-community
|
||||||
|
|
|
||||||
56
.github/workflows/check-docs.yml
vendored
56
.github/workflows/check-docs.yml
vendored
|
|
@ -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
|
|
||||||
129
.github/workflows/check.yml
vendored
129
.github/workflows/check.yml
vendored
|
|
@ -1,4 +1,6 @@
|
||||||
name: "Validate flake & check formatting"
|
name: "Treewide Checks"
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
@ -6,13 +8,13 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- .github/**
|
|
||||||
- assets/**
|
- assets/**
|
||||||
- .gitignore
|
|
||||||
jobs:
|
jobs:
|
||||||
nix-flake-check:
|
nix-flake-check:
|
||||||
name: Validate Flake
|
name: "Validate flake"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -24,8 +26,9 @@ jobs:
|
||||||
run: nix flake check
|
run: nix flake check
|
||||||
|
|
||||||
format-with-alejandra:
|
format-with-alejandra:
|
||||||
name: Formatting via Alejandra
|
name: "Check formatting"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -33,4 +36,118 @@ jobs:
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
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
|
||||||
|
|
|
||||||
8
.github/workflows/cleanup.yml
vendored
8
.github/workflows/cleanup.yml
vendored
|
|
@ -1,9 +1,13 @@
|
||||||
name: Cleanup
|
name: Delete Stale Branches
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 4 1 * *" # 4AM on 1st of every month
|
- cron: "0 4 1 * *" # 4AM on 1st of every month
|
||||||
- cron: "0 4 15 * *" # 4AM on the 15th of every month
|
- cron: "0 4 15 * *" # 4AM on the 15th of every month
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
branches:
|
branches:
|
||||||
name: Cleanup old branches
|
name: Cleanup old branches
|
||||||
|
|
@ -13,7 +17,7 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: "Delete old branches"
|
- name: "Delete old branches"
|
||||||
uses: beatlabs/delete-old-branches-action@v0.0.10
|
uses: beatlabs/delete-old-branches-action@v0.0.11
|
||||||
with:
|
with:
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
date: "1 months ago"
|
date: "1 months ago"
|
||||||
|
|
|
||||||
4
.github/workflows/docs-preview.yml
vendored
4
.github/workflows/docs-preview.yml
vendored
|
|
@ -9,7 +9,7 @@ on:
|
||||||
- "modules/**"
|
- "modules/**"
|
||||||
- "docs/**"
|
- "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
|
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
@ -34,7 +34,7 @@ jobs:
|
||||||
run: git config --global init.defaultBranch main
|
run: git config --global init.defaultBranch main
|
||||||
|
|
||||||
- name: Build documentation packages
|
- 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
|
- name: Deploy to GitHub Pages preview
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
46
.github/workflows/editorconfig.yml
vendored
46
.github/workflows/editorconfig.yml
vendored
|
|
@ -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
|
|
||||||
30
.github/workflows/typos.yml
vendored
30
.github/workflows/typos.yml
vendored
|
|
@ -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
|
|
||||||
|
|
@ -25,7 +25,6 @@ isMaximal: {
|
||||||
trouble.enable = true;
|
trouble.enable = true;
|
||||||
lspSignature.enable = true;
|
lspSignature.enable = true;
|
||||||
otter-nvim.enable = isMaximal;
|
otter-nvim.enable = isMaximal;
|
||||||
lsplines.enable = isMaximal;
|
|
||||||
nvim-docs-view.enable = isMaximal;
|
nvim-docs-view.enable = isMaximal;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -83,6 +82,7 @@ isMaximal: {
|
||||||
elixir.enable = false;
|
elixir.enable = false;
|
||||||
haskell.enable = false;
|
haskell.enable = false;
|
||||||
ruby.enable = false;
|
ruby.enable = false;
|
||||||
|
fsharp.enable = false;
|
||||||
|
|
||||||
tailwind.enable = false;
|
tailwind.enable = false;
|
||||||
svelte.enable = false;
|
svelte.enable = false;
|
||||||
|
|
@ -235,6 +235,7 @@ isMaximal: {
|
||||||
enable = false;
|
enable = false;
|
||||||
cmp.enable = isMaximal;
|
cmp.enable = isMaximal;
|
||||||
};
|
};
|
||||||
|
codecompanion-nvim.enable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
session = {
|
session = {
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,6 @@
|
||||||
inherit (nvimModuleDocs) optionsJSON;
|
inherit (nvimModuleDocs) optionsJSON;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
inherit (inputs) nmd;
|
|
||||||
|
|
||||||
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
|
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
|
||||||
# `nixosOptionsDoc` is more customizable.
|
# `nixosOptionsDoc` is more customizable.
|
||||||
options.json =
|
options.json =
|
||||||
|
|
|
||||||
|
|
@ -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
|
in the extended library, usually under `inputs.nvf.lib.nvim.dag` that you may
|
||||||
use.
|
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.
|
to find out more about the DAG system.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"]`
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ formatting to diagnostics. The following languages have sections under the
|
||||||
- Go: [vim.languages.go.enable](#opt-vim.languages.go.enable)
|
- Go: [vim.languages.go.enable](#opt-vim.languages.go.enable)
|
||||||
- Lua: [vim.languages.lua.enable](#opt-vim.languages.lua.enable)
|
- Lua: [vim.languages.lua.enable](#opt-vim.languages.lua.enable)
|
||||||
- PHP: [vim.languages.php.enable](#opt-vim.languages.php.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
|
Adding support for more languages, and improving support for existing ones are
|
||||||
great places where you can contribute with a PR.
|
great places where you can contribute with a PR.
|
||||||
|
|
|
||||||
|
|
@ -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.
|
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
|
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
|
which you can access with `man 5 nvf`. Please let us know if you believe any of
|
||||||
options below are missing useful examples.
|
the options below are missing useful examples.
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
In the manual, individual options may be referenced in Hyperlinks as follows:
|
In the manual, individual options may be referenced in Hyperlinks as follows:
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,22 @@
|
||||||
|
|
||||||
## Breaking changes
|
## Breaking changes
|
||||||
|
|
||||||
|
[Lspsaga documentation]: https://nvimdev.github.io/lspsaga/
|
||||||
|
|
||||||
- `git-conflict` keybinds are now prefixed with `<leader>` to avoid conflicting
|
- `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):
|
[NotAShelf](https://github.com/notashelf):
|
||||||
|
|
||||||
|
|
@ -11,6 +25,8 @@
|
||||||
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
|
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
|
||||||
[yanky.nvim]: https://github.com/gbprod/yanky.nvim
|
[yanky.nvim]: https://github.com/gbprod/yanky.nvim
|
||||||
[yazi.nvim]: https://github.com/mikavilpas/yazi.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
|
- Add [typst-preview.nvim] under
|
||||||
`languages.typst.extensions.typst-preview-nvim`.
|
`languages.typst.extensions.typst-preview-nvim`.
|
||||||
|
|
@ -18,7 +34,7 @@
|
||||||
- Add a search widget to the options page in the nvf manual.
|
- Add a search widget to the options page in the nvf manual.
|
||||||
|
|
||||||
- Add [render-markdown.nvim] under
|
- 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
|
- Implement [](#opt-vim.git.gitsigns.setupOpts) for user-specified setup table
|
||||||
in gitsigns configuration.
|
in gitsigns configuration.
|
||||||
|
|
@ -52,6 +68,29 @@
|
||||||
|
|
||||||
- Add [yazi.nvim] as a companion plugin for Yazi, the terminal file manager.
|
- 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):
|
[amadaluzia](https://github.com/amadaluzia):
|
||||||
|
|
||||||
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
||||||
|
|
@ -62,7 +101,12 @@
|
||||||
|
|
||||||
[blink.cmp]: https://github.com/saghen/blink.cmp
|
[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):
|
[diniamo](https://github.com/diniamo):
|
||||||
|
|
||||||
|
|
@ -71,14 +115,6 @@
|
||||||
- Disable the built-in format-on-save feature of zls. Use `vim.lsp.formatOnSave`
|
- Disable the built-in format-on-save feature of zls. Use `vim.lsp.formatOnSave`
|
||||||
instead.
|
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):
|
[LilleAila](https://github.com/LilleAila):
|
||||||
|
|
||||||
- Remove `vim.notes.obsidian.setupOpts.dir`, which was set by default. Fixes
|
- Remove `vim.notes.obsidian.setupOpts.dir`, which was set by default. Fixes
|
||||||
|
|
@ -149,18 +185,22 @@
|
||||||
[thamenato](https://github.com/thamenato):
|
[thamenato](https://github.com/thamenato):
|
||||||
|
|
||||||
[ruff]: (https://github.com/astral-sh/ruff)
|
[ruff]: (https://github.com/astral-sh/ruff)
|
||||||
|
[cue]: (https://cuelang.org/)
|
||||||
|
|
||||||
- Add [ruff] as a formatter option in `vim.languages.python.format.type`.
|
- Add [ruff] as a formatter option in `vim.languages.python.format.type`.
|
||||||
|
- Add [cue] support under `vim.languages.cue`.
|
||||||
|
|
||||||
[ARCIII](https://github.com/ArmandoCIII):
|
[ARCIII](https://github.com/ArmandoCIII):
|
||||||
|
|
||||||
[leetcode.nvim]: https://github.com/kawre/leetcode.nvim
|
[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
|
- Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. Code
|
||||||
Inspiration from `vim.languages.clang.dap` implementation.
|
Inspiration from `vim.languages.clang.dap` implementation.
|
||||||
- Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`.
|
- 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.
|
- Add support for [nixd](https://github.com/nix-community/nixd) language server.
|
||||||
|
|
||||||
|
|
@ -170,33 +210,127 @@
|
||||||
available plugins, under `vim.utility.multicursors`.
|
available plugins, under `vim.utility.multicursors`.
|
||||||
- Add [hydra.nvim](https://github.com/nvimtools/hydra.nvim) as dependency for
|
- Add [hydra.nvim](https://github.com/nvimtools/hydra.nvim) as dependency for
|
||||||
`multicursors.nvim` and lazy loads by default.
|
`multicursors.nvim` and lazy loads by default.
|
||||||
[folospior](https://github.com/folospior)
|
|
||||||
|
[folospior](https://github.com/folospior):
|
||||||
|
|
||||||
- Fix plugin name for lsp/lspkind.
|
- Fix plugin name for lsp/lspkind.
|
||||||
|
|
||||||
- Move `vim-illuminate` to `setupOpts format`
|
- 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)
|
- Add lsp options support for [nixd](https://github.com/nix-community/nixd)
|
||||||
language server.
|
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
|
- 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),
|
- Add formatters for go: [gofmt](https://go.dev/blog/gofmt),
|
||||||
[golines](https://github.com/segmentio/golines) and
|
[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
|
[qmlls]: https://doc.qt.io/qt-6/qtqml-tooling-qmlls.html
|
||||||
[qmlformat]: https://doc.qt.io/qt-6/qtqml-tooling-qmlformat.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
|
- Add QML LSP and formatter support under `vim.languages.qml` using [qmlls] and
|
||||||
[qmlformat].
|
[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
62
flake.lock
generated
|
|
@ -5,11 +5,11 @@
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1738453229,
|
"lastModified": 1741352980,
|
||||||
"narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
|
"narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
|
"rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -38,11 +38,11 @@
|
||||||
},
|
},
|
||||||
"mnw": {
|
"mnw": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1738852285,
|
"lastModified": 1742255973,
|
||||||
"narHash": "sha256-8Y1uyE6gGHxdU0Vcx2CMg/dAmDSxJw19aAl3TKbbo54=",
|
"narHash": "sha256-XfEGVKatTgEMMOVb4SNp1LYLQOSzzrFTDMVDTZFyMVE=",
|
||||||
"owner": "Gerg-L",
|
"owner": "Gerg-L",
|
||||||
"repo": "mnw",
|
"repo": "mnw",
|
||||||
"rev": "6ae73dc9cb72cea17bcc2e3d4670825f483e80e8",
|
"rev": "b982dbd5e6d55d4438832b3567c09bc2a129649d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -62,11 +62,11 @@
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1732053863,
|
"lastModified": 1741118843,
|
||||||
"narHash": "sha256-DCIVdlb81Fct2uwzbtnawLBC/U03U2hqx8trqTJB7WA=",
|
"narHash": "sha256-ggXU3RHv6NgWw+vc+HO4/9n0GPufhTIUjVuLci8Za8c=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "nil",
|
"repo": "nil",
|
||||||
"rev": "2e24c9834e3bb5aa2a3701d3713b43a6fb106362",
|
"rev": "577d160da311cc7f5042038456a0713e9863d09e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -77,11 +77,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1740303746,
|
"lastModified": 1743076231,
|
||||||
"narHash": "sha256-XcdiWLEhjJkMxDLKQJ0CCivmYYCvA5MDxu9pMybM5kM=",
|
"narHash": "sha256-yQugdVfi316qUfqzN8JMaA2vixl+45GxNm4oUfXlbgw=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "2d068ae5c6516b2d04562de50a58c682540de9bf",
|
"rev": "6c5963357f3c1c840201eda129a99d455074db04",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -93,30 +93,17 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
"nixpkgs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1738452942,
|
"lastModified": 1740877520,
|
||||||
"narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=",
|
"narHash": "sha256-oiwv/ZK/2FhGxrCkQkB83i7GnWXPPLzoqFHpDD3uYpk=",
|
||||||
"type": "tarball",
|
"owner": "nix-community",
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
|
"repo": "nixpkgs.lib",
|
||||||
|
"rev": "147dee35aab2193b174e4c0868bd80ead5ce755c",
|
||||||
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"owner": "nix-community",
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
|
"repo": "nixpkgs.lib",
|
||||||
}
|
"type": "github"
|
||||||
},
|
|
||||||
"nmd": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1705050560,
|
|
||||||
"narHash": "sha256-x3zzcdvhJpodsmdjqB4t5mkVW22V3wqHLOun0KRBzUI=",
|
|
||||||
"owner": "~rycee",
|
|
||||||
"repo": "nmd",
|
|
||||||
"rev": "66d9334933119c36f91a78d565c152a4fdc8d3d3",
|
|
||||||
"type": "sourcehut"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "~rycee",
|
|
||||||
"repo": "nmd",
|
|
||||||
"type": "sourcehut"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
|
|
@ -126,7 +113,6 @@
|
||||||
"mnw": "mnw",
|
"mnw": "mnw",
|
||||||
"nil": "nil",
|
"nil": "nil",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nmd": "nmd",
|
|
||||||
"systems": "systems_2"
|
"systems": "systems_2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -138,11 +124,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731983527,
|
"lastModified": 1741055476,
|
||||||
"narHash": "sha256-JECaBgC0pQ91Hq3W4unH6K9to8s2Zl2sPNu7bLOv4ek=",
|
"narHash": "sha256-52vwEV0oS2lCnx3c/alOFGglujZTLmObit7K8VblnS8=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "71287228d96e9568e1e70c6bbfa3f992d145947b",
|
"rev": "aefb7017d710f150970299685e8d8b549d653649",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
|
|
@ -86,12 +86,6 @@
|
||||||
# Alternate neovim-wrapper
|
# Alternate neovim-wrapper
|
||||||
mnw.url = "github:Gerg-L/mnw";
|
mnw.url = "github:Gerg-L/mnw";
|
||||||
|
|
||||||
# For generating documentation website
|
|
||||||
nmd = {
|
|
||||||
url = "sourcehut:~rycee/nmd";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Language servers (use master instead of nixpkgs)
|
# Language servers (use master instead of nixpkgs)
|
||||||
nil = {
|
nil = {
|
||||||
url = "github:oxalica/nil";
|
url = "github:oxalica/nil";
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
|
stdenv,
|
||||||
rustPlatform,
|
rustPlatform,
|
||||||
hostPlatform,
|
|
||||||
vimUtils,
|
vimUtils,
|
||||||
git,
|
gitMinimal,
|
||||||
src,
|
src,
|
||||||
version,
|
version,
|
||||||
}: let
|
}: let
|
||||||
|
|
@ -13,17 +13,11 @@
|
||||||
# TODO: remove this if plugin stops using nightly rust
|
# TODO: remove this if plugin stops using nightly rust
|
||||||
env.RUSTC_BOOTSTRAP = true;
|
env.RUSTC_BOOTSTRAP = true;
|
||||||
|
|
||||||
nativeBuildInputs = [git];
|
useFetchCargoVendor = true;
|
||||||
cargoLock = {
|
cargoHash = "sha256-F1wh/TjYoiIbDY3J/prVF367MKk3vwM7LqOpRobOs7I=";
|
||||||
lockFile = "${src}/Cargo.lock";
|
|
||||||
allowBuiltinFetchGit = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
libExt =
|
nativeBuildInputs = [gitMinimal];
|
||||||
if hostPlatform.isDarwin
|
};
|
||||||
then "dylib"
|
|
||||||
else "so";
|
|
||||||
in
|
in
|
||||||
vimUtils.buildVimPlugin {
|
vimUtils.buildVimPlugin {
|
||||||
pname = "blink-cmp";
|
pname = "blink-cmp";
|
||||||
|
|
@ -31,8 +25,13 @@ in
|
||||||
|
|
||||||
# blink references a repro.lua which is placed outside the lua/ directory
|
# blink references a repro.lua which is placed outside the lua/ directory
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
preInstall = ''
|
preInstall = let
|
||||||
|
ext = stdenv.hostPlatform.extensions.sharedLibrary;
|
||||||
|
in ''
|
||||||
mkdir -p target/release
|
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"];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,13 @@ in {
|
||||||
their behaviour was abstract, and confusing. Please use 'vim.options' or 'vim.luaConfigRC'
|
their behaviour was abstract, and confusing. Please use 'vim.options' or 'vim.luaConfigRC'
|
||||||
to replicate previous behaviour.
|
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.
|
# Migrated via batchRenameOptions. Further batch renames must be below this line.
|
||||||
|
|
|
||||||
185
modules/neovim/init/autocmds.nix
Normal file
185
modules/neovim/init/autocmds.nix
Normal 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.";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
./autocmds.nix
|
||||||
./basic.nix
|
./basic.nix
|
||||||
./debug.nix
|
./debug.nix
|
||||||
|
./diagnostics.nix
|
||||||
./highlight.nix
|
./highlight.nix
|
||||||
./spellcheck.nix
|
./spellcheck.nix
|
||||||
];
|
];
|
||||||
|
|
|
||||||
109
modules/neovim/init/diagnostics.nix
Normal file
109
modules/neovim/init/diagnostics.nix
Normal 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})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
278
modules/plugins/assistant/codecompanion/codecompanion-nvim.nix
Normal file
278
modules/plugins/assistant/codecompanion/codecompanion-nvim.nix
Normal 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.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
27
modules/plugins/assistant/codecompanion/config.nix
Normal file
27
modules/plugins/assistant/codecompanion/config.nix
Normal 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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/plugins/assistant/codecompanion/default.nix
Normal file
6
modules/plugins/assistant/codecompanion/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./codecompanion-nvim.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -37,6 +37,12 @@ in {
|
||||||
inherit (cfg) setupOpts;
|
inherit (cfg) setupOpts;
|
||||||
after = mkIf cfg.cmp.enable "require('copilot_cmp').setup()";
|
after = mkIf cfg.cmp.enable "require('copilot_cmp').setup()";
|
||||||
|
|
||||||
|
event = [
|
||||||
|
{
|
||||||
|
event = "User";
|
||||||
|
pattern = "LazyFile";
|
||||||
|
}
|
||||||
|
];
|
||||||
cmd = ["Copilot" "CopilotAuth" "CopilotDetach" "CopilotPanel" "CopilotStop"];
|
cmd = ["Copilot" "CopilotAuth" "CopilotDetach" "CopilotPanel" "CopilotStop"];
|
||||||
keys = [
|
keys = [
|
||||||
(mkLuaKeymap ["n"] cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion" {})
|
(mkLuaKeymap ["n"] cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion" {})
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,6 @@
|
||||||
imports = [
|
imports = [
|
||||||
./chatgpt
|
./chatgpt
|
||||||
./copilot
|
./copilot
|
||||||
|
./codecompanion
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption literalMD;
|
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.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline pluginType;
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
inherit (lib.nvim.config) mkBool;
|
inherit (lib.nvim.config) mkBool;
|
||||||
|
|
||||||
|
|
@ -21,8 +21,9 @@
|
||||||
freeformType = anything;
|
freeformType = anything;
|
||||||
options = {
|
options = {
|
||||||
module = mkOption {
|
module = mkOption {
|
||||||
type = str;
|
type = nullOr str;
|
||||||
description = "module of the provider";
|
default = null;
|
||||||
|
description = "Provider module.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -40,20 +41,7 @@ in {
|
||||||
providers = mkOption {
|
providers = mkOption {
|
||||||
type = attrsOf providerType;
|
type = attrsOf providerType;
|
||||||
default = {};
|
default = {};
|
||||||
description = "Settings for completion providers";
|
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.
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -63,6 +51,12 @@ in {
|
||||||
default = [];
|
default = [];
|
||||||
description = "List of sources to enable for cmdline. Null means use default source list.";
|
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 = {
|
completion = {
|
||||||
|
|
@ -74,6 +68,16 @@ in {
|
||||||
description = "Delay before auto show triggers";
|
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 {
|
keymap = mkOption {
|
||||||
|
|
@ -103,7 +107,25 @@ in {
|
||||||
fuzzy = {
|
fuzzy = {
|
||||||
prebuilt_binaries = {
|
prebuilt_binaries = {
|
||||||
download = mkBool false ''
|
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>";
|
scrollDocsUp = mkMappingOption "Scroll docs up [blink.cmp]" "<C-d>";
|
||||||
scrollDocsDown = mkMappingOption "Scroll docs down [blink.cmp]" "<C-f>";
|
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";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
inherit (lib.attrsets) attrValues filterAttrs mapAttrsToList;
|
||||||
|
inherit (lib.lists) map optional elem;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
|
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
|
||||||
|
|
||||||
|
|
@ -19,9 +21,27 @@
|
||||||
else if (plugin ? pname && (tryEval plugin.pname).success)
|
else if (plugin ? pname && (tryEval plugin.pname).success)
|
||||||
then plugin.pname
|
then plugin.pname
|
||||||
else plugin.name;
|
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 {
|
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 {
|
vim = mkIf cfg.enable {
|
||||||
startPlugins = ["blink-compat"];
|
startPlugins = ["blink-compat"] ++ blinkSourcePlugins ++ (optional cfg.friendly-snippets.enable "friendly-snippets");
|
||||||
lazy.plugins = {
|
lazy.plugins = {
|
||||||
blink-cmp = {
|
blink-cmp = {
|
||||||
package = "blink-cmp";
|
package = "blink-cmp";
|
||||||
|
|
@ -32,12 +52,14 @@ in {
|
||||||
#
|
#
|
||||||
# event = ["InsertEnter" "CmdlineEnter"];
|
# event = ["InsertEnter" "CmdlineEnter"];
|
||||||
|
|
||||||
after = ''
|
after =
|
||||||
${optionalString config.vim.lazy.enable
|
# lua
|
||||||
(concatStringsSep "\n" (map
|
''
|
||||||
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
|
${optionalString config.vim.lazy.enable
|
||||||
cmpCfg.sourcePlugins))}
|
(concatStringsSep "\n" (map
|
||||||
'';
|
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
|
||||||
|
cmpCfg.sourcePlugins))}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -45,13 +67,26 @@ in {
|
||||||
enableSharedCmpSources = true;
|
enableSharedCmpSources = true;
|
||||||
blink-cmp.setupOpts = {
|
blink-cmp.setupOpts = {
|
||||||
sources = {
|
sources = {
|
||||||
default = ["lsp" "path" "snippets" "buffer"] ++ (attrNames cmpCfg.sources);
|
default =
|
||||||
|
[
|
||||||
|
"lsp"
|
||||||
|
"path"
|
||||||
|
"snippets"
|
||||||
|
"buffer"
|
||||||
|
]
|
||||||
|
++ (attrNames cmpCfg.sources)
|
||||||
|
++ (attrNames enabledBlinkSources);
|
||||||
providers =
|
providers =
|
||||||
mapAttrs (name: _: {
|
mapAttrs (name: _: {
|
||||||
inherit name;
|
inherit name;
|
||||||
module = "blink.compat.source";
|
module = "blink.compat.source";
|
||||||
})
|
})
|
||||||
cmpCfg.sources;
|
cmpCfg.sources
|
||||||
|
// (mapAttrs (name: definition: {
|
||||||
|
inherit name;
|
||||||
|
inherit (definition) module;
|
||||||
|
})
|
||||||
|
enabledBlinkSources);
|
||||||
};
|
};
|
||||||
snippets = mkIf config.vim.snippets.luasnip.enable {
|
snippets = mkIf config.vim.snippets.luasnip.enable {
|
||||||
preset = "luasnip";
|
preset = "luasnip";
|
||||||
|
|
@ -67,16 +102,18 @@ in {
|
||||||
${mappings.next} = [
|
${mappings.next} = [
|
||||||
"select_next"
|
"select_next"
|
||||||
"snippet_forward"
|
"snippet_forward"
|
||||||
(mkLuaInline ''
|
(mkLuaInline
|
||||||
function(cmp)
|
# lua
|
||||||
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
|
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
|
if has_words_before then
|
||||||
return cmp.show()
|
return cmp.show()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
'')
|
||||||
'')
|
|
||||||
"fallback"
|
"fallback"
|
||||||
];
|
];
|
||||||
${mappings.previous} = [
|
${mappings.previous} = [
|
||||||
|
|
|
||||||
|
|
@ -60,12 +60,6 @@ in {
|
||||||
enableSharedCmpSources = true;
|
enableSharedCmpSources = true;
|
||||||
|
|
||||||
nvim-cmp = {
|
nvim-cmp = {
|
||||||
sources = {
|
|
||||||
nvim-cmp = null;
|
|
||||||
buffer = "[Buffer]";
|
|
||||||
path = "[Path]";
|
|
||||||
};
|
|
||||||
|
|
||||||
sourcePlugins = ["cmp-buffer" "cmp-path"];
|
sourcePlugins = ["cmp-buffer" "cmp-path"];
|
||||||
|
|
||||||
setupOpts = {
|
setupOpts = {
|
||||||
|
|
|
||||||
|
|
@ -98,14 +98,16 @@ in {
|
||||||
|
|
||||||
sources = mkOption {
|
sources = mkOption {
|
||||||
type = attrsOf (nullOr str);
|
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";
|
description = "The list of sources used by nvim-cmp";
|
||||||
example = literalExpression ''
|
|
||||||
{
|
|
||||||
nvim-cmp = null;
|
|
||||||
buffer = "[Buffer]";
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sourcePlugins = mkOption {
|
sourcePlugins = mkOption {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,23 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) listOf attrsOf anything nullOr enum;
|
||||||
in {
|
in {
|
||||||
options.vim.dashboard.alpha = {
|
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";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,11 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.dashboard.alpha;
|
cfg = config.vim.dashboard.alpha;
|
||||||
|
themeDefined = cfg.theme != null;
|
||||||
|
layoutDefined = cfg.layout != [];
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim.startPlugins = [
|
||||||
|
|
@ -14,207 +17,30 @@ in {
|
||||||
"nvim-web-devicons"
|
"nvim-web-devicons"
|
||||||
];
|
];
|
||||||
|
|
||||||
# the entire credit for this dashboard configuration to https://github.com/Rishabh672003
|
vim.pluginRC.alpha = let
|
||||||
# honestly, excellent work
|
setupOpts =
|
||||||
vim.pluginRC.alpha = entryAnywhere ''
|
if themeDefined
|
||||||
local alpha = require("alpha")
|
then lib.generators.mkLuaInline "require'alpha.themes.${cfg.theme}'.config"
|
||||||
local plenary_path = require("plenary.path")
|
else {
|
||||||
local dashboard = require("alpha.themes.dashboard")
|
inherit (cfg) layout opts;
|
||||||
local cdir = vim.fn.getcwd()
|
};
|
||||||
local if_nil = vim.F.if_nil
|
in ''
|
||||||
|
require('alpha').setup(${toLuaObject setupOpts})
|
||||||
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)
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
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.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,48 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.diagnostics.nvim-lint;
|
cfg = config.vim.diagnostics.nvim-lint;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkMerge [
|
||||||
vim = {
|
(mkIf cfg.enable {
|
||||||
startPlugins = ["nvim-lint"];
|
vim = {
|
||||||
pluginRC.nvim-lint = entryAnywhere ''
|
startPlugins = ["nvim-lint"];
|
||||||
require("lint").setup(${toLuaObject cfg.setupOpts})
|
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
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,121 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) attrsOf listOf str;
|
inherit (lib.types) nullOr attrsOf listOf str either submodule bool enum;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) luaInline;
|
||||||
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"];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
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 = ''
|
description = ''
|
||||||
Map of filetype to formatters. This option takes a set of
|
Automatically add the current file name to the commands arguments. Only
|
||||||
`key = value` format where the `value` will be converted
|
has an effect if stdin is false
|
||||||
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.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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;};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
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.types) mkPluginSetupOption;
|
||||||
inherit (lib.nvim.lua) mkLuaInline;
|
inherit (lib.nvim.lua) mkLuaInline;
|
||||||
in {
|
in {
|
||||||
|
|
@ -31,7 +31,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
format_on_save = mkOption {
|
format_on_save = mkOption {
|
||||||
type = attrs;
|
type = nullOr attrs;
|
||||||
default = {
|
default = {
|
||||||
lsp_format = "fallback";
|
lsp_format = "fallback";
|
||||||
timeout_ms = 500;
|
timeout_ms = 500;
|
||||||
|
|
@ -43,7 +43,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
format_after_save = mkOption {
|
format_after_save = mkOption {
|
||||||
type = attrs;
|
type = nullOr attrs;
|
||||||
default = {lsp_format = "fallback";};
|
default = {lsp_format = "fallback";};
|
||||||
description = ''
|
description = ''
|
||||||
Table that will be passed to `conform.format()`. If this
|
Table that will be passed to `conform.format()`. If this
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ in {
|
||||||
./gitsigns
|
./gitsigns
|
||||||
./vim-fugitive
|
./vim-fugitive
|
||||||
./git-conflict
|
./git-conflict
|
||||||
|
./gitlinker-nvim
|
||||||
];
|
];
|
||||||
|
|
||||||
options.vim.git = {
|
options.vim.git = {
|
||||||
|
|
@ -15,6 +16,7 @@ in {
|
||||||
* gitsigns
|
* gitsigns
|
||||||
* vim-fugitive
|
* vim-fugitive
|
||||||
* git-conflict
|
* git-conflict
|
||||||
|
* gitlinker-nvim
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
23
modules/plugins/git/gitlinker-nvim/config.nix
Normal file
23
modules/plugins/git/gitlinker-nvim/config.nix
Normal 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"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/plugins/git/gitlinker-nvim/default.nix
Normal file
6
modules/plugins/git/gitlinker-nvim/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./gitlinker-nvim.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
13
modules/plugins/git/gitlinker-nvim/gitlinker-nvim.nix
Normal file
13
modules/plugins/git/gitlinker-nvim/gitlinker-nvim.nix
Normal 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" {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) toJSON;
|
inherit (builtins) toJSON;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetExprBinding mkSetLuaBinding pushDownDefault;
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetExprBinding mkSetLuaBinding pushDownDefault;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
@ -32,6 +33,7 @@ in {
|
||||||
return '<Ignore>'
|
return '<Ignore>'
|
||||||
end
|
end
|
||||||
'')
|
'')
|
||||||
|
|
||||||
(mkSetExprBinding gsMappings.previousHunk ''
|
(mkSetExprBinding gsMappings.previousHunk ''
|
||||||
function()
|
function()
|
||||||
if vim.wo.diff then return ${toJSON gsMappings.previousHunk.value} end
|
if vim.wo.diff then return ${toJSON gsMappings.previousHunk.value} end
|
||||||
|
|
@ -77,13 +79,12 @@ in {
|
||||||
}
|
}
|
||||||
|
|
||||||
(mkIf cfg.codeActions.enable {
|
(mkIf cfg.codeActions.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.lsp.null-ls = {
|
||||||
vim.lsp.null-ls.sources.gitsigns-ca = ''
|
enable = true;
|
||||||
table.insert(
|
setupOpts.sources.gitsigns-ca = mkLuaInline ''
|
||||||
ls_sources,
|
require("null-ls").builtins.code_actions.gitsigns
|
||||||
null_ls.builtins.code_actions.gitsigns
|
'';
|
||||||
)
|
};
|
||||||
'';
|
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.types) enum either listOf package str;
|
inherit (lib.types) enum either listOf package str;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
|
|
||||||
cfg = config.vim.languages.astro;
|
cfg = config.vim.languages.astro;
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
package = pkgs.astro-language-server;
|
package = pkgs.astro-language-server;
|
||||||
lspConfig = ''
|
lspConfig = ''
|
||||||
lspconfig.astro.setup {
|
lspconfig.astro.setup {
|
||||||
capabilities = capabilities;
|
capabilities = capabilities,
|
||||||
on_attach = attach_keymaps,
|
on_attach = attach_keymaps,
|
||||||
cmd = ${
|
cmd = ${
|
||||||
if isList cfg.lsp.package
|
if isList cfg.lsp.package
|
||||||
|
|
@ -39,26 +39,14 @@
|
||||||
formats = {
|
formats = {
|
||||||
prettier = {
|
prettier = {
|
||||||
package = pkgs.nodePackages.prettier;
|
package = pkgs.nodePackages.prettier;
|
||||||
nullConfig = ''
|
};
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
prettierd = {
|
||||||
null_ls.builtins.formatting.prettier.with({
|
package = pkgs.prettierd;
|
||||||
command = "${cfg.format.package}/bin/prettier",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
biome = {
|
biome = {
|
||||||
package = pkgs.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 = {
|
diagnosticsProviders = {
|
||||||
eslint_d = {
|
eslint_d = {
|
||||||
package = pkgs.eslint_d;
|
package = pkgs.eslint_d;
|
||||||
nullConfig = pkg: ''
|
config = {
|
||||||
table.insert(
|
# HACK: change if nvim-lint gets a dynamic enable thing
|
||||||
ls_sources,
|
parser = mkLuaInline ''
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
function(output, bufnr, cwd)
|
||||||
command = "${getExe pkg}",
|
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 {
|
in {
|
||||||
|
|
@ -91,16 +88,16 @@ in {
|
||||||
enable = mkEnableOption "Astro LSP support" // {default = config.vim.languages.enableLSP;};
|
enable = mkEnableOption "Astro LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
|
||||||
server = mkOption {
|
server = mkOption {
|
||||||
description = "Astro LSP server to use";
|
|
||||||
type = enum (attrNames servers);
|
type = enum (attrNames servers);
|
||||||
default = defaultServer;
|
default = defaultServer;
|
||||||
|
description = "Astro LSP server to use";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkOption {
|
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);
|
type = either package (listOf str);
|
||||||
default = servers.${cfg.lsp.server}.package;
|
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 {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.astro-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.astro = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "astro";
|
linters_by_ft.astro = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters = mkMerge (map (
|
||||||
inherit diagnosticsProviders;
|
name: {
|
||||||
|
${name} =
|
||||||
|
diagnosticsProviders.${name}.config
|
||||||
|
// {
|
||||||
|
cmd = getExe diagnosticsProviders.${name}.package;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) enum either package listOf str bool;
|
inherit (lib.types) enum either package listOf str bool;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
inherit (lib.nvim.types) diagnostics mkGrammarOption;
|
inherit (lib.nvim.types) diagnostics mkGrammarOption;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
|
||||||
|
|
@ -37,14 +37,6 @@
|
||||||
formats = {
|
formats = {
|
||||||
shfmt = {
|
shfmt = {
|
||||||
package = pkgs.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 = {
|
diagnosticsProviders = {
|
||||||
shellcheck = {
|
shellcheck = {
|
||||||
package = pkgs.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 {
|
in {
|
||||||
|
|
@ -130,16 +113,23 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.bash-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.sh = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "bash";
|
linters_by_ft.sh = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters = mkMerge (map (name: {
|
||||||
inherit diagnosticsProviders;
|
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||||
|
})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) enum either listOf package str;
|
inherit (lib.types) enum either listOf package str;
|
||||||
|
|
@ -42,14 +43,6 @@
|
||||||
formats = {
|
formats = {
|
||||||
prettier = {
|
prettier = {
|
||||||
package = pkgs.nodePackages.prettier;
|
package = pkgs.nodePackages.prettier;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.prettier.with({
|
|
||||||
command = "${cfg.format.package}/bin/prettier",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
prettierd = {
|
prettierd = {
|
||||||
|
|
@ -132,8 +125,13 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.css-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.css = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
51
modules/plugins/languages/cue.nix
Normal file
51
modules/plugins/languages/cue.nix
Normal 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"},
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
@ -5,13 +5,16 @@ in {
|
||||||
./asm.nix
|
./asm.nix
|
||||||
./astro.nix
|
./astro.nix
|
||||||
./bash.nix
|
./bash.nix
|
||||||
|
./cue.nix
|
||||||
./dart.nix
|
./dart.nix
|
||||||
./clang.nix
|
./clang.nix
|
||||||
./css.nix
|
./css.nix
|
||||||
./elixir.nix
|
./elixir.nix
|
||||||
|
./fsharp.nix
|
||||||
./gleam.nix
|
./gleam.nix
|
||||||
./go.nix
|
./go.nix
|
||||||
./hcl.nix
|
./hcl.nix
|
||||||
|
./helm.nix
|
||||||
./kotlin.nix
|
./kotlin.nix
|
||||||
./html.nix
|
./html.nix
|
||||||
./haskell.nix
|
./haskell.nix
|
||||||
|
|
@ -40,6 +43,7 @@ in {
|
||||||
./nu.nix
|
./nu.nix
|
||||||
./odin.nix
|
./odin.nix
|
||||||
./wgsl.nix
|
./wgsl.nix
|
||||||
|
./yaml.nix
|
||||||
./ruby.nix
|
./ruby.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,9 @@
|
||||||
formats = {
|
formats = {
|
||||||
mix = {
|
mix = {
|
||||||
package = pkgs.elixir;
|
package = pkgs.elixir;
|
||||||
nullConfig = ''
|
config = {
|
||||||
table.insert(
|
command = "${cfg.format.package}/bin/mix";
|
||||||
ls_sources,
|
};
|
||||||
null_ls.builtins.formatting.mix.with({
|
|
||||||
command = "${cfg.format.package}/bin/mix",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -107,8 +102,12 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.elixir-format = formats.${cfg.format.type}.nullConfig;
|
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 {
|
(mkIf cfg.elixir-tools.enable {
|
||||||
|
|
|
||||||
107
modules/plugins/languages/fsharp.nix
Normal file
107
modules/plugins/languages/fsharp.nix
Normal 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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
@ -38,36 +38,15 @@
|
||||||
formats = {
|
formats = {
|
||||||
gofmt = {
|
gofmt = {
|
||||||
package = pkgs.go;
|
package = pkgs.go;
|
||||||
nullConfig = ''
|
config.command = "${cfg.format.package}/bin/gofmt";
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.gofmt.with({
|
|
||||||
command = "${cfg.format.package}/bin/gofmt",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
gofumpt = {
|
gofumpt = {
|
||||||
package = pkgs.gofumpt;
|
package = pkgs.gofumpt;
|
||||||
nullConfig = ''
|
config.command = getExe cfg.format.package;
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.gofumpt.with({
|
|
||||||
command = "${cfg.format.package}/bin/gofumpt",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
golines = {
|
golines = {
|
||||||
package = pkgs.golines;
|
package = pkgs.golines;
|
||||||
nullConfig = ''
|
config.command = "${cfg.format.package}/bin/golines";
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.golines.with({
|
|
||||||
command = "${cfg.format.package}/bin/golines",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -153,8 +132,11 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.go-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.go = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.dap.enable {
|
(mkIf cfg.dap.enable {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.types) package bool enum;
|
inherit (lib.types) package bool enum;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
|
@ -30,14 +31,6 @@
|
||||||
formats = {
|
formats = {
|
||||||
hclfmt = {
|
hclfmt = {
|
||||||
package = pkgs.hclfmt;
|
package = pkgs.hclfmt;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.hclfmt.with({
|
|
||||||
command = "${lib.getExe cfg.format.package}",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -110,8 +103,13 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.hcl-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.hcl = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
89
modules/plugins/languages/helm.nix
Normal file
89
modules/plugins/languages/helm.nix
Normal 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];
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
inherit (lib.types) either package listOf str;
|
inherit (lib.types) either package listOf str;
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
|
|
@ -19,14 +18,6 @@
|
||||||
diagnosticsProviders = {
|
diagnosticsProviders = {
|
||||||
ktlint = {
|
ktlint = {
|
||||||
package = pkgs.ktlint;
|
package = pkgs.ktlint;
|
||||||
nullConfig = pkg: ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.diagnostics.ktlint.with({
|
|
||||||
command = "${getExe pkg}",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -76,11 +67,13 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "kotlin";
|
linters_by_ft.kotlin = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters = mkMerge (map (name: {
|
||||||
inherit diagnosticsProviders;
|
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||||
|
})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,30 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) either listOf package str;
|
inherit (lib.types) bool either enum listOf package str;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) diagnostics mkGrammarOption;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
inherit (lib.nvim.dag) entryBefore;
|
inherit (lib.nvim.dag) entryBefore;
|
||||||
|
|
||||||
cfg = config.vim.languages.lua;
|
cfg = config.vim.languages.lua;
|
||||||
|
defaultFormat = "stylua";
|
||||||
|
formats = {
|
||||||
|
stylua = {
|
||||||
|
package = pkgs.stylua;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultDiagnosticsProvider = ["luacheck"];
|
||||||
|
diagnosticsProviders = {
|
||||||
|
luacheck = {
|
||||||
|
package = pkgs.luajitPackages.luacheck;
|
||||||
|
};
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
(lib.mkRemovedOptionModule ["vim" "languages" "lua" "lsp" "neodev"] ''
|
(lib.mkRemovedOptionModule ["vim" "languages" "lua" "lsp" "neodev"] ''
|
||||||
|
|
@ -39,6 +53,34 @@ in {
|
||||||
|
|
||||||
lazydev.enable = mkEnableOption "lazydev.nvim integration, useful for neovim plugin developers";
|
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 [
|
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);
|
||||||
|
};
|
||||||
|
})
|
||||||
]))
|
]))
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,13 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
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.types) bool enum either package listOf str;
|
||||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||||
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
inherit (lib.nvim.types) diagnostics mkGrammarOption mkPluginSetupOption;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
||||||
cfg = config.vim.languages.markdown;
|
cfg = config.vim.languages.markdown;
|
||||||
|
|
@ -32,31 +33,23 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultFormat = "denofmt";
|
defaultFormat = "deno_fmt";
|
||||||
formats = {
|
formats = {
|
||||||
|
# for backwards compatibility
|
||||||
denofmt = {
|
denofmt = {
|
||||||
package = pkgs.deno;
|
package = pkgs.deno;
|
||||||
nullConfig = ''
|
};
|
||||||
table.insert(
|
deno_fmt = {
|
||||||
ls_sources,
|
package = pkgs.deno;
|
||||||
null_ls.builtins.formatting.deno_fmt.with({
|
|
||||||
filetypes = ${expToLua (concatLists [cfg.format.extraFiletypes ["markdown"]])},
|
|
||||||
command = "${cfg.format.package}/bin/deno",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
prettierd = {
|
prettierd = {
|
||||||
package = pkgs.prettierd;
|
package = pkgs.prettierd;
|
||||||
nullConfig = ''
|
};
|
||||||
table.insert(
|
};
|
||||||
ls_sources,
|
defaultDiagnosticsProvider = ["markdownlint-cli2"];
|
||||||
null_ls.builtins.formatting.prettierd.with({
|
diagnosticsProviders = {
|
||||||
filetypes = ${expToLua (concatLists [cfg.format.extraFiletypes ["markdown"]])},
|
markdownlint-cli2 = {
|
||||||
command = "${cfg.format.package}/bin/prettierd",
|
package = pkgs.markdownlint-cli2;
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -96,7 +89,7 @@ in {
|
||||||
type = mkOption {
|
type = mkOption {
|
||||||
type = enum (attrNames formats);
|
type = enum (attrNames formats);
|
||||||
default = defaultFormat;
|
default = defaultFormat;
|
||||||
description = "Markdown formatter to use";
|
description = "Markdown formatter to use. `denofmt` is deprecated and currently aliased to deno_fmt.";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
|
|
@ -121,17 +114,19 @@ in {
|
||||||
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
|
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
|
||||||
|
|
||||||
Inline Markdown rendering with [render-markdown.nvim]
|
Inline Markdown rendering with [render-markdown.nvim]
|
||||||
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
setupOpts = mkPluginSetupOption "render-markdown" {
|
setupOpts = mkPluginSetupOption "render-markdown" {};
|
||||||
auto_override_publish_diagnostics = mkOption {
|
};
|
||||||
description = "Automatically override the publish_diagnostics handler";
|
};
|
||||||
type = bool;
|
|
||||||
default = true;
|
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 {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.markdown-format = formats.${cfg.format.type}.nullConfig;
|
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
|
# Extensions
|
||||||
|
|
@ -159,5 +163,16 @@ in {
|
||||||
require("render-markdown").setup(${toLuaObject cfg.extensions.render-markdown-nvim.setupOpts})
|
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);
|
||||||
|
};
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) enum either listOf package str;
|
inherit (lib.types) enum either listOf package str;
|
||||||
|
|
@ -38,14 +39,9 @@
|
||||||
formats = {
|
formats = {
|
||||||
nimpretty = {
|
nimpretty = {
|
||||||
package = pkgs.nim;
|
package = pkgs.nim;
|
||||||
nullConfig = ''
|
config = {
|
||||||
table.insert(
|
command = "${cfg.format.package}/bin/nimpretty";
|
||||||
ls_sources,
|
};
|
||||||
null_ls.builtins.formatting.nimpretty.with({
|
|
||||||
command = "${pkgs.nim}/bin/nimpretty",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -110,8 +106,11 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.nim-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.nim = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||||
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib) concatStringsSep;
|
inherit (lib) concatStringsSep;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
|
|
@ -13,7 +14,6 @@
|
||||||
inherit (lib.types) anything attrsOf enum either listOf nullOr package str;
|
inherit (lib.types) anything attrsOf enum either listOf nullOr package str;
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
|
|
||||||
cfg = config.vim.languages.nix;
|
cfg = config.vim.languages.nix;
|
||||||
|
|
||||||
|
|
@ -100,29 +100,11 @@
|
||||||
formats = {
|
formats = {
|
||||||
alejandra = {
|
alejandra = {
|
||||||
package = pkgs.alejandra;
|
package = pkgs.alejandra;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.alejandra.with({
|
|
||||||
command = "${cfg.format.package}/bin/alejandra"
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nixfmt = {
|
nixfmt = {
|
||||||
package = pkgs.nixfmt-rfc-style;
|
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"];
|
defaultDiagnosticsProvider = ["statix" "deadnix"];
|
||||||
|
|
@ -219,7 +201,6 @@ in {
|
||||||
${concatStringsSep ", " (attrNames formats)}
|
${concatStringsSep ", " (attrNames formats)}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
assertion = cfg.lsp.server != "rnix";
|
assertion = cfg.lsp.server != "rnix";
|
||||||
message = ''
|
message = ''
|
||||||
|
|
@ -240,17 +221,24 @@ in {
|
||||||
vim.lsp.lspconfig.sources.nix-lsp = servers.${cfg.lsp.server}.lspConfig;
|
vim.lsp.lspconfig.sources.nix-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf (cfg.format.enable && !servers.${cfg.lsp.server}.internalFormatter) {
|
(mkIf (cfg.format.enable && (!cfg.lsp.enable || !servers.${cfg.lsp.server}.internalFormatter)) {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.nix-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.nix = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "nix";
|
linters_by_ft.nix = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters = mkMerge (map (name: {
|
||||||
inherit diagnosticsProviders;
|
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||||
|
})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -37,14 +37,6 @@
|
||||||
formats = {
|
formats = {
|
||||||
ocamlformat = {
|
ocamlformat = {
|
||||||
package = pkgs.ocamlPackages.ocamlformat;
|
package = pkgs.ocamlPackages.ocamlformat;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.ocamlformat.with({
|
|
||||||
command = "${cfg.format.package}/bin/ocamlformat",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -97,9 +89,13 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.ocamlformat = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
vim.extraPackages = [formats.${cfg.format.type}.package];
|
setupOpts.formatters_by_ft.ocaml = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
in {
|
||||||
options.vim.languages.php = {
|
options.vim.languages.php = {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
python-lsp-server = {
|
python-lsp-server = {
|
||||||
package = pkgs.python-lsp-server;
|
package = pkgs.python3Packages.python-lsp-server;
|
||||||
lspConfig = ''
|
lspConfig = ''
|
||||||
lspconfig.pylsp.setup{
|
lspconfig.pylsp.setup{
|
||||||
capabilities = capabilities;
|
capabilities = capabilities;
|
||||||
|
|
@ -66,26 +66,10 @@
|
||||||
formats = {
|
formats = {
|
||||||
black = {
|
black = {
|
||||||
package = pkgs.black;
|
package = pkgs.black;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.black.with({
|
|
||||||
command = "${cfg.format.package}/bin/black",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
isort = {
|
isort = {
|
||||||
package = pkgs.isort;
|
package = pkgs.isort;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.isort.with({
|
|
||||||
command = "${cfg.format.package}/bin/isort",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
black-and-isort = {
|
black-and-isort = {
|
||||||
|
|
@ -96,15 +80,6 @@
|
||||||
black --quiet - "$@" | isort --profile black -
|
black --quiet - "$@" | isort --profile black -
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.black.with({
|
|
||||||
command = "${cfg.format.package}/bin/black",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ruff = {
|
ruff = {
|
||||||
|
|
@ -115,14 +90,6 @@
|
||||||
ruff format -
|
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 {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.python-format = formats.${cfg.format.type}.nullConfig;
|
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 {
|
(mkIf cfg.dap.enable {
|
||||||
|
|
|
||||||
|
|
@ -24,28 +24,29 @@
|
||||||
package = pkgs.rWrapper.override {
|
package = pkgs.rWrapper.override {
|
||||||
packages = [pkgs.rPackages.styler];
|
packages = [pkgs.rPackages.styler];
|
||||||
};
|
};
|
||||||
nullConfig = ''
|
config = {
|
||||||
table.insert(
|
command = "${cfg.format.package}/bin/R";
|
||||||
ls_sources,
|
};
|
||||||
null_ls.builtins.formatting.styler.with({
|
|
||||||
command = "${cfg.format.package}/bin/R",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
format_r = {
|
format_r = {
|
||||||
package = pkgs.rWrapper.override {
|
package = pkgs.rWrapper.override {
|
||||||
packages = [pkgs.rPackages.formatR];
|
packages = [pkgs.rPackages.formatR];
|
||||||
};
|
};
|
||||||
nullConfig = ''
|
config = {
|
||||||
table.insert(
|
command = "${cfg.format.package}/bin/R";
|
||||||
ls_sources,
|
stdin = true;
|
||||||
null_ls.builtins.formatting.format_r.with({
|
args = [
|
||||||
command = "${cfg.format.package}/bin/R",
|
"--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 {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.r-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.r = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.lsp.enable {
|
(mkIf cfg.lsp.enable {
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
inherit (lib.types) either listOf package str enum;
|
inherit (lib.types) either listOf package str enum;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
|
|
||||||
cfg = config.vim.languages.ruby;
|
cfg = config.vim.languages.ruby;
|
||||||
|
|
||||||
|
|
@ -35,24 +35,8 @@
|
||||||
defaultFormat = "rubocop";
|
defaultFormat = "rubocop";
|
||||||
formats = {
|
formats = {
|
||||||
rubocop = {
|
rubocop = {
|
||||||
|
# TODO: is this right?
|
||||||
package = pkgs.rubyPackages.rubocop;
|
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 = {
|
diagnosticsProviders = {
|
||||||
rubocop = {
|
rubocop = {
|
||||||
package = pkgs.rubyPackages.rubocop;
|
package = pkgs.rubyPackages.rubocop;
|
||||||
nullConfig = pkg: ''
|
config.command = getExe cfg.format.package;
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.diagnostics.rubocop.with({
|
|
||||||
command = "${lib.getExe pkg}",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -136,16 +113,23 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.ruby-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.ruby = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "ruby";
|
linters_by_ft.ruby = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters = mkMerge (map (name: {
|
||||||
inherit diagnosticsProviders;
|
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||||
|
})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
|
|
@ -21,14 +22,6 @@
|
||||||
formats = {
|
formats = {
|
||||||
rustfmt = {
|
rustfmt = {
|
||||||
package = pkgs.rustfmt;
|
package = pkgs.rustfmt;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.rustfmt.with({
|
|
||||||
command = "${cfg.format.package}/bin/rustfmt",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -62,6 +55,15 @@ in {
|
||||||
description = "Options to pass to rust analyzer";
|
description = "Options to pass to rust analyzer";
|
||||||
type = str;
|
type = str;
|
||||||
default = "";
|
default = "";
|
||||||
|
example = ''
|
||||||
|
['rust-analyzer'] = {
|
||||||
|
cargo = {allFeature = true},
|
||||||
|
checkOnSave = true,
|
||||||
|
procMacro = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -119,8 +121,13 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.rust-format = formats.${cfg.format.type}.nullConfig;
|
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) {
|
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
|
||||||
|
|
@ -142,6 +149,9 @@ in {
|
||||||
then expToLua cfg.lsp.package
|
then expToLua cfg.lsp.package
|
||||||
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
||||||
},
|
},
|
||||||
|
default_settings = {
|
||||||
|
${cfg.lsp.opts}
|
||||||
|
},
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
default_on_attach(client, bufnr)
|
default_on_attach(client, bufnr)
|
||||||
local opts = { noremap=true, silent=true, buffer = bufnr }
|
local opts = { noremap=true, silent=true, buffer = bufnr }
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,11 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) enum either listOf package str;
|
inherit (lib.types) enum either listOf package str;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
inherit (lib.nvim.types) diagnostics;
|
inherit (lib.nvim.types) diagnostics;
|
||||||
|
|
||||||
cfg = config.vim.languages.sql;
|
cfg = config.vim.languages.sql;
|
||||||
|
|
@ -41,15 +41,10 @@
|
||||||
formats = {
|
formats = {
|
||||||
sqlfluff = {
|
sqlfluff = {
|
||||||
package = sqlfluffDefault;
|
package = sqlfluffDefault;
|
||||||
nullConfig = ''
|
config = {
|
||||||
table.insert(
|
command = getExe cfg.format.package;
|
||||||
ls_sources,
|
append_args = ["--dialect=${cfg.dialect}"];
|
||||||
null_ls.builtins.formatting.sqlfluff.with({
|
};
|
||||||
command = "${cfg.format.package}/bin/sqlfluff",
|
|
||||||
extra_args = {"--dialect", "${cfg.dialect}"}
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -57,15 +52,10 @@
|
||||||
diagnosticsProviders = {
|
diagnosticsProviders = {
|
||||||
sqlfluff = {
|
sqlfluff = {
|
||||||
package = sqlfluffDefault;
|
package = sqlfluffDefault;
|
||||||
nullConfig = pkg: ''
|
config = {
|
||||||
table.insert(
|
cmd = getExe sqlfluffDefault;
|
||||||
ls_sources,
|
args = ["lint" "--format=json" "--dialect=${cfg.dialect}"];
|
||||||
null_ls.builtins.diagnostics.sqlfluff.with({
|
};
|
||||||
command = "${pkg}/bin/sqlfluff",
|
|
||||||
extra_args = {"--dialect", "${cfg.dialect}"}
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -150,16 +140,20 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources."sql-format" = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.sql = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "sql";
|
linters_by_ft.sql = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters =
|
||||||
inherit diagnosticsProviders;
|
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.types) enum either listOf package str;
|
inherit (lib.types) enum either listOf package str;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
|
|
||||||
cfg = config.vim.languages.svelte;
|
cfg = config.vim.languages.svelte;
|
||||||
|
|
@ -39,42 +39,38 @@
|
||||||
formats = {
|
formats = {
|
||||||
prettier = {
|
prettier = {
|
||||||
package = pkgs.nodePackages.prettier;
|
package = pkgs.nodePackages.prettier;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.prettier.with({
|
|
||||||
command = "${cfg.format.package}/bin/prettier",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
biome = {
|
biome = {
|
||||||
package = pkgs.biome;
|
package = pkgs.biome;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.biome.with({
|
|
||||||
command = "${cfg.format.package}/bin/biome",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: specify packages
|
# TODO: specify packages
|
||||||
defaultDiagnosticsProvider = ["eslint_d"];
|
defaultDiagnosticsProvider = ["eslint_d"];
|
||||||
diagnosticsProviders = {
|
diagnosticsProviders = {
|
||||||
eslint_d = {
|
eslint_d = let
|
||||||
package = pkgs.eslint_d;
|
pkg = pkgs.eslint_d;
|
||||||
nullConfig = pkg: ''
|
in {
|
||||||
table.insert(
|
package = pkg;
|
||||||
ls_sources,
|
config = {
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
cmd = getExe pkg;
|
||||||
command = "${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 {
|
in {
|
||||||
|
|
@ -143,16 +139,22 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.svelte-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.svelte = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "svelte";
|
linters_by_ft.svelte = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters =
|
||||||
inherit diagnosticsProviders;
|
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.types) enum either listOf package str bool;
|
inherit (lib.types) enum either listOf package str bool;
|
||||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics mkPluginSetupOption;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics mkPluginSetupOption;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
||||||
cfg = config.vim.languages.ts;
|
cfg = config.vim.languages.ts;
|
||||||
|
|
@ -77,39 +77,14 @@
|
||||||
formats = {
|
formats = {
|
||||||
prettier = {
|
prettier = {
|
||||||
package = pkgs.nodePackages.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 = {
|
prettierd = {
|
||||||
package = pkgs.prettierd;
|
package = pkgs.prettierd;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.prettier.with({
|
|
||||||
command = "${cfg.format.package}/bin/prettierd",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
biome = {
|
biome = {
|
||||||
package = pkgs.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 = {
|
diagnosticsProviders = {
|
||||||
eslint_d = {
|
eslint_d = {
|
||||||
package = pkgs.eslint_d;
|
package = pkgs.eslint_d;
|
||||||
nullConfig = pkg: ''
|
config = let
|
||||||
table.insert(
|
pkg = pkgs.eslint_d;
|
||||||
ls_sources,
|
in {
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
cmd = getExe pkg;
|
||||||
command = "${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 {
|
in {
|
||||||
|
|
@ -215,16 +202,29 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.ts-format = formats.${cfg.format.type}.nullConfig;
|
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 {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "ts";
|
linters_by_ft.typescript = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters_by_ft.typescriptreact = cfg.extraDiagnostics.types;
|
||||||
inherit diagnosticsProviders;
|
|
||||||
|
linters = mkMerge (map (name: {
|
||||||
|
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||||
|
})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) nullOr enum either attrsOf listOf package str;
|
inherit (lib.types) nullOr enum either attrsOf listOf package str;
|
||||||
inherit (lib.attrsets) attrNames;
|
inherit (lib.attrsets) attrNames;
|
||||||
inherit (lib.generators) mkLuaInline;
|
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||||
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
||||||
|
|
@ -61,26 +60,10 @@
|
||||||
formats = {
|
formats = {
|
||||||
typstfmt = {
|
typstfmt = {
|
||||||
package = pkgs.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
|
# https://github.com/Enter-tainer/typstyle
|
||||||
typstyle = {
|
typstyle = {
|
||||||
package = pkgs.typstyle;
|
package = pkgs.typstyle;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.typstfmt.with({
|
|
||||||
command = "${cfg.format.package}/bin/typstyle",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -176,8 +159,13 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.typst-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.typst = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.lsp.enable {
|
(mkIf cfg.lsp.enable {
|
||||||
|
|
|
||||||
85
modules/plugins/languages/yaml.nix
Normal file
85
modules/plugins/languages/yaml.nix
Normal 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;
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.trivial) boolToString;
|
inherit (lib.trivial) boolToString;
|
||||||
|
|
@ -28,6 +29,25 @@ in {
|
||||||
sourcePlugins = ["cmp-nvim-lsp"];
|
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 = ''
|
pluginRC.lsp-setup = ''
|
||||||
vim.g.formatsave = ${boolToString cfg.formatOnSave};
|
vim.g.formatsave = ${boolToString cfg.formatOnSave};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
./lightbulb
|
./lightbulb
|
||||||
./otter
|
./otter
|
||||||
./lspkind
|
./lspkind
|
||||||
./lsplines
|
|
||||||
./nvim-docs-view
|
./nvim-docs-view
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,
|
|
||||||
})
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -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]
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -3,51 +3,24 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkDefault;
|
||||||
inherit (lib.strings) optionalString;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding;
|
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp;
|
||||||
self = import ./lspsaga.nix {inherit lib;};
|
|
||||||
|
|
||||||
mappingDefinitions = self.options.vim.lsp.lspsaga.mappings;
|
|
||||||
mappings = addDescriptionsToMappings cfg.lspsaga.mappings mappingDefinitions;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable && cfg.lspsaga.enable) {
|
config = mkIf (cfg.enable && cfg.lspsaga.enable) {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["lspsaga-nvim"];
|
lazy.plugins.lspsaga-nvim = {
|
||||||
|
package = "lspsaga-nvim";
|
||||||
|
setupModule = "lspsaga";
|
||||||
|
inherit (cfg.lspsaga) setupOpts;
|
||||||
|
|
||||||
maps = {
|
event = ["LspAttach"];
|
||||||
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"))
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pluginRC.lspsaga = entryAnywhere ''
|
# Optional dependencies, pretty useful to enhance default functionality of
|
||||||
require('lspsaga').init_lsp_saga({
|
# Lspsaga.
|
||||||
${optionalString config.vim.ui.borders.plugins.lspsaga.enable ''
|
treesitter.enable = mkDefault true;
|
||||||
border_style = '${config.vim.ui.borders.plugins.lspsaga.style}',
|
visuals.nvim-web-devicons.enable = mkDefault true;
|
||||||
''}
|
|
||||||
})
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,47 @@
|
||||||
{lib, ...}: let
|
{
|
||||||
inherit (lib.options) mkEnableOption;
|
config,
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
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 {
|
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 = {
|
options.vim.lsp.lspsaga = {
|
||||||
enable = mkEnableOption "LSP Saga";
|
enable = mkEnableOption "LSP Saga";
|
||||||
|
|
||||||
mappings = {
|
setupOpts =
|
||||||
lspFinder = mkMappingOption "LSP Finder [LSPSaga]" "<leader>lf";
|
mkPluginSetupOption "lspsaga" {
|
||||||
renderHoveredDoc = mkMappingOption "Rendered hovered docs [LSPSaga]" "<leader>lh";
|
border_style = mkOption {
|
||||||
|
type = borderType;
|
||||||
smartScrollUp = mkMappingOption "Smart scroll up [LSPSaga]" "<C-f>";
|
default = config.vim.ui.borders.globalStyle;
|
||||||
smartScrollDown = mkMappingOption "Smart scroll up [LSPSaga]" "<C-b>";
|
description = "Border type, see {command}`:help nvim_open_win`";
|
||||||
|
};
|
||||||
rename = mkMappingOption "Rename [LSPSaga]" "<leader>lr";
|
}
|
||||||
previewDefinition = mkMappingOption "Preview definition [LSPSaga]" "<leader>ld";
|
// uiKindSetupOpts;
|
||||||
|
|
||||||
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";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ in {
|
||||||
options.vim.lsp = {
|
options.vim.lsp = {
|
||||||
enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options";
|
enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options";
|
||||||
formatOnSave = mkEnableOption "format on save";
|
formatOnSave = mkEnableOption "format on save";
|
||||||
|
inlayHints = {
|
||||||
|
enable = mkEnableOption "inlay hints";
|
||||||
|
};
|
||||||
mappings = {
|
mappings = {
|
||||||
goToDefinition =
|
goToDefinition =
|
||||||
mkMappingOption "Go to definition"
|
mkMappingOption "Go to definition"
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,12 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.attrsets) mapAttrs;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.trivial) boolToString;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
inherit (lib.nvim.dag) entryAnywhere entryAfter entryBetween;
|
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp.null-ls;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.null-ls.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
{
|
{
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = [
|
startPlugins = [
|
||||||
|
|
@ -18,35 +17,14 @@ in {
|
||||||
"plenary-nvim"
|
"plenary-nvim"
|
||||||
];
|
];
|
||||||
|
|
||||||
# null-ls implies LSP already being set up
|
# null-ls implies that LSP is already being set up
|
||||||
# since it will hook into LSPs to receive information
|
# as it will hook into LSPs to receive information.
|
||||||
lsp.enable = true;
|
lsp.enable = true;
|
||||||
|
|
||||||
pluginRC = {
|
pluginRC.null_ls = entryAfter ["lsp-setup"] ''
|
||||||
# early setup for null-ls
|
require('null-ls').setup(${toLuaObject cfg.setupOpts})
|
||||||
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
|
|
||||||
})
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
{
|
|
||||||
vim.pluginRC = mapAttrs (_: v: (entryBetween ["null_ls"] ["null_ls-setup"] v)) cfg.null-ls.sources;
|
|
||||||
}
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,87 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) attrsOf str int;
|
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 {
|
in {
|
||||||
|
imports = renamedSetupOpts;
|
||||||
|
|
||||||
options.vim.lsp.null-ls = {
|
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 {
|
Displays all possible log messages and writes them to the null-ls log,
|
||||||
type = str;
|
which you can view with the command `:NullLsLog`
|
||||||
default = "[#{m}] #{s} (#{c})";
|
'';
|
||||||
description = "Diagnostic output format for null-ls";
|
|
||||||
};
|
|
||||||
|
|
||||||
debounce = mkOption {
|
diagnostics_format = mkOption {
|
||||||
type = int;
|
type = str;
|
||||||
default = 250;
|
default = "[#{m}] #{s} (#{c})";
|
||||||
description = "Default debounce";
|
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 {
|
* `#{m}`: message
|
||||||
type = int;
|
* `#{s}`: source name (defaults to null-ls if not specified)
|
||||||
default = 5000;
|
* `#{c}`: code (if available)
|
||||||
description = "Default timeout value, in milliseconds";
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
sources = mkOption {
|
debounce = mkOption {
|
||||||
description = "null-ls sources";
|
type = int;
|
||||||
type = attrsOf str;
|
default = 250;
|
||||||
default = {};
|
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.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,8 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
mappings = {
|
mappings = {
|
||||||
viewToggle = mkMappingOption "Open or close the docs view panel" "lvt";
|
viewToggle = mkMappingOption "Open or close the docs view panel" "<leader>lvt";
|
||||||
viewUpdate = mkMappingOption "Manually update the docs view panel" "lvu";
|
viewUpdate = mkMappingOption "Manually update the docs view panel" "<leader>lvu";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,12 @@
|
||||||
mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions;
|
mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions;
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable && cfg.otter-nvim.enable) {
|
config = mkIf (cfg.enable && cfg.otter-nvim.enable) {
|
||||||
assertions = [
|
warnings = [
|
||||||
{
|
# TODO: remove warning when we update to nvim 0.11
|
||||||
assertion = !config.vim.utility.ccc.enable;
|
(mkIf config.vim.utility.ccc.enable ''
|
||||||
message = ''
|
ccc and otter occasionally have small conflicts that will disappear with nvim 0.11.
|
||||||
ccc and otter have a breaking conflict. It's been reported upstream. Until it's fixed, disable one of them
|
In the meantime, otter handles it by throwing a warning, but both plugins will work.
|
||||||
'';
|
'')
|
||||||
}
|
|
||||||
];
|
];
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["otter-nvim"];
|
startPlugins = ["otter-nvim"];
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
@ -10,6 +11,21 @@
|
||||||
cfg = config.vim.mini.indentscope;
|
cfg = config.vim.mini.indentscope;
|
||||||
in {
|
in {
|
||||||
vim = mkIf cfg.enable {
|
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"];
|
startPlugins = ["mini-indentscope"];
|
||||||
|
|
||||||
pluginRC.mini-indentscope = entryAnywhere ''
|
pluginRC.mini-indentscope = entryAnywhere ''
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,16 @@
|
||||||
{
|
{lib, ...}: let
|
||||||
config,
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.options) mkEnableOption;
|
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
inherit (lib.types) str listOf;
|
||||||
in {
|
in {
|
||||||
options.vim.mini.indentscope = {
|
options.vim.mini.indentscope = {
|
||||||
enable = mkEnableOption "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";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,13 @@
|
||||||
cfg = config.vim.minimap.minimap-vim;
|
cfg = config.vim.minimap.minimap-vim;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim = {
|
||||||
pkgs.code-minimap
|
startPlugins = ["minimap-vim"];
|
||||||
"minimap-vim"
|
extraPackages = [pkgs.code-minimap];
|
||||||
];
|
|
||||||
|
|
||||||
vim.binds.whichKey.register = pushDownDefault {
|
binds.whichKey.register = pushDownDefault {
|
||||||
"<leader>m" = "+Minimap";
|
"<leader>m" = "+Minimap";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.types) nullOr str bool;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule;
|
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 {
|
in {
|
||||||
imports = let
|
imports = let
|
||||||
renameSetupOpt = oldPath: newPath:
|
renameSetupOpt = oldPath: newPath:
|
||||||
|
|
@ -50,68 +54,100 @@ in {
|
||||||
usePicker = mkOption {
|
usePicker = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
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 {
|
path_replacer = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
default = "__";
|
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 {
|
colon_replacer = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
default = "++";
|
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 {
|
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";
|
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 {
|
max_path_length = mkOption {
|
||||||
type = types.nullOr types.int;
|
type = nullOr int;
|
||||||
default = 80;
|
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 {
|
autosave_last_session = mkOption {
|
||||||
type = types.bool;
|
type = bool;
|
||||||
default = true;
|
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 {
|
autosave_ignore_not_normal = mkOption {
|
||||||
type = types.bool;
|
type = bool;
|
||||||
default = true;
|
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 {
|
autosave_ignore_dirs = mkOption {
|
||||||
type = types.listOf types.str;
|
type = listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
description = "A list of directories where the session will not be autosaved";
|
description = "A list of directories where the session will not be autosaved";
|
||||||
};
|
};
|
||||||
|
|
||||||
autosave_ignore_filetypes = mkOption {
|
autosave_ignore_filetypes = mkOption {
|
||||||
type = types.listOf types.str;
|
type = listOf str;
|
||||||
default = ["gitcommit"];
|
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 {
|
autosave_ignore_buftypes = mkOption {
|
||||||
type = types.listOf types.str;
|
type = listOf str;
|
||||||
default = [];
|
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 {
|
autosave_only_in_session = mkOption {
|
||||||
type = types.bool;
|
type = bool;
|
||||||
default = false;
|
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
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,17 @@
|
||||||
"codedark"
|
"codedark"
|
||||||
"dracula"
|
"dracula"
|
||||||
"everforest"
|
"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"
|
||||||
"gruvbox_dark"
|
"gruvbox_dark"
|
||||||
"gruvbox_light"
|
"gruvbox_light"
|
||||||
|
|
@ -113,8 +124,6 @@ in {
|
||||||
mkOption {
|
mkOption {
|
||||||
type = enum themesConcatted;
|
type = enum themesConcatted;
|
||||||
default = "auto";
|
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"'';
|
defaultText = ''`config.vim.theme.name` if theme supports lualine else "auto"'';
|
||||||
description = "Theme for lualine";
|
description = "Theme for lualine";
|
||||||
};
|
};
|
||||||
|
|
@ -230,35 +239,26 @@ in {
|
||||||
{
|
{
|
||||||
-- Lsp server name
|
-- Lsp server name
|
||||||
function()
|
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
|
if excluded_buf_ft[buf_ft] then
|
||||||
local excluded_buf_ft = {"toggleterm", "NvimTree", "neo-tree", "TelescopePrompt"}
|
return ""
|
||||||
|
|
||||||
-- 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 ""
|
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
-- Get the name of the LSP server active in the current buffer
|
local active_clients = {}
|
||||||
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
|
|
||||||
|
|
||||||
for _, client in ipairs(clients) do
|
for _, client in ipairs(clients) do
|
||||||
local filetypes = client.config.filetypes
|
table.insert(active_clients, client.name)
|
||||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
|
||||||
return client.name
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return msg
|
return table.concat(active_clients, ", ")
|
||||||
end,
|
end,
|
||||||
icon = ' ',
|
icon = ' ',
|
||||||
separator = {left = ''},
|
separator = {left = ''},
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.tabline.nvimBufferline;
|
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;
|
inherit (self.options.vim.tabline.nvimBufferline) mappings;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
{lib, ...}: let
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.types) enum bool either nullOr str int listOf attrs;
|
inherit (lib.types) enum bool either nullOr str int listOf attrs;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
|
@ -23,7 +27,14 @@ in {
|
||||||
setupOpts = mkPluginSetupOption "Bufferline-nvim" {
|
setupOpts = mkPluginSetupOption "Bufferline-nvim" {
|
||||||
highlights = mkOption {
|
highlights = mkOption {
|
||||||
type = either attrs luaInline;
|
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 = ''
|
description = ''
|
||||||
Overrides the highlight groups of bufferline.
|
Overrides the highlight groups of bufferline.
|
||||||
|
|
||||||
|
|
@ -268,6 +279,12 @@ in {
|
||||||
highlight = "Directory";
|
highlight = "Directory";
|
||||||
separator = true;
|
separator = true;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
filetype = "neo-tree";
|
||||||
|
text = "File Explorer";
|
||||||
|
highlight = "Directory";
|
||||||
|
separator = true;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
description = "The windows to offset bufferline above, see `:help bufferline-offset`";
|
description = "The windows to offset bufferline above, see `:help bufferline-offset`";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -66,21 +66,22 @@ in {
|
||||||
transparent_background = ${boolToString transparent},
|
transparent_background = ${boolToString transparent},
|
||||||
term_colors = true,
|
term_colors = true,
|
||||||
integrations = {
|
integrations = {
|
||||||
nvimtree = {
|
nvimtree = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
transparent_panel = ${boolToString transparent},
|
transparent_panel = ${boolToString transparent},
|
||||||
show_root = true,
|
show_root = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
hop = true,
|
hop = true,
|
||||||
gitsigns = true,
|
gitsigns = true,
|
||||||
telescope = true,
|
telescope = true,
|
||||||
treesitter = true,
|
treesitter = true,
|
||||||
treesitter_context = true,
|
treesitter_context = true,
|
||||||
ts_rainbow = true,
|
ts_rainbow = true,
|
||||||
fidget = true,
|
fidget = true,
|
||||||
alpha = true,
|
alpha = true,
|
||||||
leap = true,
|
leap = true,
|
||||||
|
lsp_saga = true,
|
||||||
markdown = true,
|
markdown = true,
|
||||||
noice = true,
|
noice = true,
|
||||||
notify = true, -- nvim-notify
|
notify = true, -- nvim-notify
|
||||||
|
|
@ -106,9 +107,9 @@ in {
|
||||||
style' =
|
style' =
|
||||||
warnIf (style == "light") "oxocarbon: light theme is not well-supported" style;
|
warnIf (style == "light") "oxocarbon: light theme is not well-supported" style;
|
||||||
in ''
|
in ''
|
||||||
require('oxocarbon')
|
require('oxocarbon')
|
||||||
vim.opt.background = "${style'}"
|
vim.opt.background = "${style'}"
|
||||||
vim.cmd.colorscheme = "oxocarbon"
|
vim.cmd.colorscheme = "oxocarbon"
|
||||||
${optionalString transparent ''
|
${optionalString transparent ''
|
||||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||||
|
|
@ -195,4 +196,20 @@ in {
|
||||||
vim.cmd.colorscheme("nord")
|
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"];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,19 @@ in {
|
||||||
grammars = mkOption {
|
grammars = mkOption {
|
||||||
type = listOf package;
|
type = listOf package;
|
||||||
default = [];
|
default = [];
|
||||||
|
example = literalExpression ''
|
||||||
|
pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
||||||
|
regex
|
||||||
|
kdl
|
||||||
|
];
|
||||||
|
'';
|
||||||
description = ''
|
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
|
For languages already supported by nvf, you may use
|
||||||
use the {option}`vim.language.<lang>.treesitter` options, which
|
{option}`vim.language.<lang>.treesitter` options, which will automatically add
|
||||||
will automatically add the required grammars to this.
|
the required grammars to this.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,11 +102,7 @@ in {
|
||||||
|
|
||||||
setupOpts = mkPluginSetupOption "colorizer" {
|
setupOpts = mkPluginSetupOption "colorizer" {
|
||||||
filetypes = mkOption {
|
filetypes = mkOption {
|
||||||
description = ''
|
type = attrsOf settingSubmodule;
|
||||||
Filetypes to enable on and their option overrides.
|
|
||||||
|
|
||||||
"*" means enable on all filetypes. Filetypes prefixed with "!" are disabled.
|
|
||||||
'';
|
|
||||||
default = {};
|
default = {};
|
||||||
example = {
|
example = {
|
||||||
"*" = {};
|
"*" = {};
|
||||||
|
|
@ -115,13 +111,21 @@ in {
|
||||||
AARRGGBB = false;
|
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 {
|
user_default_options = mkOption {
|
||||||
description = "Default options";
|
|
||||||
default = {};
|
|
||||||
type = settingSubmodule;
|
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.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ in {
|
||||||
setupOpts = mkPluginSetupOption "vim-illuminate" {
|
setupOpts = mkPluginSetupOption "vim-illuminate" {
|
||||||
filetypes_denylist = mkOption {
|
filetypes_denylist = mkOption {
|
||||||
type = listOf str;
|
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`";
|
description = "Filetypes to not illuminate, this overrides `filetypes_allowlist`";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,22 @@
|
||||||
./binds
|
./binds
|
||||||
./ccc
|
./ccc
|
||||||
./diffview
|
./diffview
|
||||||
|
./direnv
|
||||||
./fzf-lua
|
./fzf-lua
|
||||||
./gestures
|
./gestures
|
||||||
|
./harpoon
|
||||||
./icon-picker
|
./icon-picker
|
||||||
./images
|
./images
|
||||||
./leetcode-nvim
|
./leetcode-nvim
|
||||||
|
./mkdir
|
||||||
./motion
|
./motion
|
||||||
./multicursors
|
./multicursors
|
||||||
./new-file-template
|
./new-file-template
|
||||||
|
./nix-develop
|
||||||
|
./oil-nvim
|
||||||
./outline
|
./outline
|
||||||
./preview
|
./preview
|
||||||
|
./snacks-nvim
|
||||||
./surround
|
./surround
|
||||||
./telescope
|
./telescope
|
||||||
./wakatime
|
./wakatime
|
||||||
|
|
|
||||||
13
modules/plugins/utility/direnv/config.nix
Normal file
13
modules/plugins/utility/direnv/config.nix
Normal 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"];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./config.nix
|
./config.nix
|
||||||
./lsplines.nix
|
./direnv.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
5
modules/plugins/utility/direnv/direnv.nix
Normal file
5
modules/plugins/utility/direnv/direnv.nix
Normal 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`";
|
||||||
|
}
|
||||||
|
|
@ -1,15 +1,21 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.types) nullOr enum;
|
inherit (lib.types) enum str;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption borderType;
|
inherit (lib.nvim.types) mkPluginSetupOption borderType;
|
||||||
in {
|
in {
|
||||||
options.vim.fzf-lua = {
|
options.vim.fzf-lua = {
|
||||||
enable = mkEnableOption "fzf-lua";
|
enable = mkEnableOption "fzf-lua";
|
||||||
setupOpts = mkPluginSetupOption "fzf-lua" {
|
setupOpts = mkPluginSetupOption "fzf-lua" {
|
||||||
|
fzf_bin = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "${lib.getExe pkgs.fzf}";
|
||||||
|
description = "Path to fzf executable";
|
||||||
|
};
|
||||||
winopts.border = mkOption {
|
winopts.border = mkOption {
|
||||||
type = borderType;
|
type = borderType;
|
||||||
default = config.vim.ui.borders.globalStyle;
|
default = config.vim.ui.borders.globalStyle;
|
||||||
|
|
|
||||||
41
modules/plugins/utility/harpoon/config.nix
Normal file
41
modules/plugins/utility/harpoon/config.nix
Normal 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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/plugins/utility/harpoon/default.nix
Normal file
6
modules/plugins/utility/harpoon/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./harpoon.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
53
modules/plugins/utility/harpoon/harpoon.nix
Normal file
53
modules/plugins/utility/harpoon/harpoon.nix
Normal 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
Loading…
Add table
Add a link
Reference in a new issue