mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 02:11:33 +00:00
Merge branch 'main' into main
This commit is contained in:
commit
b6486a2aba
176 changed files with 4155 additions and 1832 deletions
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
|
||||
|
|
25
.github/README.md
vendored
25
.github/README.md
vendored
|
@ -200,8 +200,9 @@ fix.
|
|||
**Q**: What platforms are supported?
|
||||
|
||||
**A**: nvf actively supports **Linux and Darwin** platforms using standalone
|
||||
Nix, NixOS or Home-Manager. Please take a look at the [nvf manual] for available
|
||||
installation instructions.
|
||||
Nix, NixOS or Home-Manager. It has been reported that **Android** is also
|
||||
supported through the Home-Manager module, or using standalone package. Please
|
||||
take a look at the [nvf manual] for available installation instructions.
|
||||
|
||||
**Q**: Can you add _X_?
|
||||
|
||||
|
@ -246,14 +247,15 @@ Neovim's behaviour with Nix.
|
|||
|
||||
### Co-Maintainers
|
||||
|
||||
Alongside myself, nvf is developed by those talented folk:
|
||||
Alongside [myself](https://github.com/notashelf), nvf is developed by those
|
||||
talented folk. nvf would not be what it is today without their invaluable
|
||||
contributions.
|
||||
|
||||
- [**@horriblename**](https://github.com/horriblename)
|
||||
([Liberapay](https://liberapay.com/horriblename/))- For actively implementing
|
||||
planned features and quality of life updates.
|
||||
- [**@Diniamo**](https://github.com/Diniamo)
|
||||
([Liberapay](https://en.liberapay.com/diniamo/)) - For actively submitting
|
||||
pull requests, issues and assistance with maintenance of nvf.
|
||||
- [**@Soliprem**](https://github.com/soliprem) - For rigorously implementing
|
||||
missing features and excellent work on new language modules.
|
||||
|
||||
Please do remember to extend your thanks (financially or otherwise) if this
|
||||
project has been helpful to you.
|
||||
|
@ -270,14 +272,14 @@ heart-felt thanks to
|
|||
- [**@FlafyDev**](https://github.com/FlafyDev) - For getting Home-Manager module
|
||||
to work and Nix assistance.
|
||||
- [**@n3oney**](https://github.com/n3oney) - For making custom keybinds finally
|
||||
possible, and other module additions.
|
||||
possible, great ideas and module additions.
|
||||
- [**@Yavko**](https://github.com/Yavko) - For the amazing **nvf** logo
|
||||
- [**@FrothyMarrow**](https://github.com/FrothyMarrow) - For seeing mistakes
|
||||
that I could not.
|
||||
that I could not and contributing good ideas & code.
|
||||
- [**@Gerg-l**](https://github.com/gerg-l) 🐸 - For the modern Neovim wrapper,
|
||||
[mnw], and occasional code improvements.
|
||||
- [**@Soliprem**](https://github.com/soliprem) - Rigorously implementing missing
|
||||
features and excellent work on new language modules.
|
||||
[mnw], and occasional improvements to the codebase.
|
||||
- [**@Diniamo**](https://github.com/Diniamo) - For actively submitting pull
|
||||
requests, issues and assistance with co-maintenance of nvf.
|
||||
|
||||
and everyone who has submitted issues or pull requests!
|
||||
|
||||
|
@ -301,7 +303,6 @@ including:
|
|||
|
||||
I am grateful for their previous work and inspiration, and I wholeheartedly
|
||||
recommend checking their work out.
|
||||
<br/>
|
||||
|
||||
## License
|
||||
|
||||
|
|
55
.github/labels.yml
vendored
Normal file
55
.github/labels.yml
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
# This file is used by .github/workflows/labels.yml
|
||||
"topic: plugins":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- modules/plugins/**/*
|
||||
|
||||
"topic: modules":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- modules/**/*
|
||||
|
||||
"topic: dependencies":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- npins
|
||||
- flake.lock
|
||||
|
||||
"topic: CI":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- .github/workflows/*.yml
|
||||
- .github/typos.toml
|
||||
- .github/dependabot.yml
|
||||
|
||||
"topic: meta":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- .github/CODEOWNERS
|
||||
- LICENSE
|
||||
- .github/README.md
|
||||
- .github/funding.yml
|
||||
- .github/assets
|
||||
- .github/*_TEMPLATE
|
||||
- .gitignore
|
||||
- .editorconfig
|
||||
- release.json
|
||||
|
||||
"topic: documentation":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- docs/**/*
|
||||
- .github/CONTRIBUTING.md
|
||||
- .github/README.md
|
||||
"topic: packaging":
|
||||
- any:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- flake.nix
|
||||
- flake/packages.nix
|
33
.github/workflows/backport.yml
vendored
Normal file
33
.github/workflows/backport.yml
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
name: Backport PR on Label
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- labeled
|
||||
|
||||
# Permissions needed for the korthout/backport-action to create branches and PRs
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
backport:
|
||||
name: Create Backport PR
|
||||
runs-on: ubuntu-latest
|
||||
if: |
|
||||
github.event.pull_request.merged == true && startsWith(github.event.label.name, 'backport-')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
token: ${{ steps.app-token.outputs.token }}
|
||||
|
||||
- name: Backport Action
|
||||
uses: korthout/backport-action@v3
|
||||
with:
|
||||
# Regex pattern for labels that should trigger a backport AND extracts the target branch
|
||||
# from the name (e.g. v0.x or v0.x.y; we use zerover). This action will ONLY proceed if
|
||||
# the label that triggered the workflow fully matches this pattern.
|
||||
# Example matching labels: "backport-v0.1", "backport-v0.10.1"
|
||||
# Example non-matching labels: "backport-foo", "backport-v1.0"
|
||||
label_pattern: '^backport-(v0\.\d+(\.\d+)?)$'
|
2
.github/workflows/cachix.yml
vendored
2
.github/workflows/cachix.yml
vendored
|
@ -36,7 +36,7 @@ jobs:
|
|||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- uses: cachix/cachix-action@v15
|
||||
- uses: cachix/cachix-action@v16
|
||||
with:
|
||||
authToken: ${{ secrets.CACHIX_TOKEN }}
|
||||
extraPullNames: nix-community
|
||||
|
|
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:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
@ -6,13 +8,13 @@ on:
|
|||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- .github/**
|
||||
- assets/**
|
||||
- .gitignore
|
||||
|
||||
jobs:
|
||||
nix-flake-check:
|
||||
name: Validate Flake
|
||||
name: "Validate flake"
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
@ -24,8 +26,9 @@ jobs:
|
|||
run: nix flake check
|
||||
|
||||
format-with-alejandra:
|
||||
name: Formatting via Alejandra
|
||||
name: "Check formatting"
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
@ -33,4 +36,118 @@ jobs:
|
|||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- run: nix run nixpkgs#alejandra -- -c .
|
||||
- name: Check formatting via Alejandra
|
||||
run: nix run nixpkgs#alejandra -- --check . --exclude npins
|
||||
|
||||
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:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 4 1 * *" # 4AM on 1st of every month
|
||||
- cron: "0 4 15 * *" # 4AM on the 15th of every month
|
||||
|
||||
jobs:
|
||||
branches:
|
||||
name: Cleanup old branches
|
||||
|
@ -13,7 +17,7 @@ jobs:
|
|||
uses: actions/checkout@v4
|
||||
|
||||
- name: "Delete old branches"
|
||||
uses: beatlabs/delete-old-branches-action@v0.0.10
|
||||
uses: beatlabs/delete-old-branches-action@v0.0.11
|
||||
with:
|
||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
date: "1 months ago"
|
||||
|
|
4
.github/workflows/docs-preview.yml
vendored
4
.github/workflows/docs-preview.yml
vendored
|
@ -9,7 +9,7 @@ on:
|
|||
- "modules/**"
|
||||
- "docs/**"
|
||||
|
||||
# Defining permissions here passes it to all workflows.
|
||||
# Defining permissions here passes it to all jobs.
|
||||
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -34,7 +34,7 @@ jobs:
|
|||
run: git config --global init.defaultBranch main
|
||||
|
||||
- name: Build documentation packages
|
||||
run: nix build .#docs-html --print-build-logs
|
||||
run: nix build .#docs-html --print-build-logs || exit 1
|
||||
|
||||
- name: Deploy to GitHub Pages preview
|
||||
run: |
|
||||
|
|
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
|
21
.github/workflows/labeler.yml
vendored
Normal file
21
.github/workflows/labeler.yml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
name: "Label PR"
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [edited, opened, synchronize, reopened]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
labels:
|
||||
name: "Label PR"
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
steps:
|
||||
- uses: actions/labeler@v5
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
configuration-path: .github/labels.yml
|
||||
sync-labels: true
|
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
|
|
@ -18,14 +18,17 @@ isMaximal: {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
# This must be enabled for the language modules to hook into
|
||||
# the LSP API.
|
||||
enable = true;
|
||||
|
||||
formatOnSave = true;
|
||||
lspkind.enable = false;
|
||||
lightbulb.enable = true;
|
||||
lspsaga.enable = false;
|
||||
trouble.enable = true;
|
||||
lspSignature.enable = true;
|
||||
lspSignature.enable = !isMaximal; # conflicts with blink in maximal
|
||||
otter-nvim.enable = isMaximal;
|
||||
lsplines.enable = isMaximal;
|
||||
nvim-docs-view.enable = isMaximal;
|
||||
};
|
||||
|
||||
|
@ -39,8 +42,7 @@ isMaximal: {
|
|||
# This section does not include a comprehensive list of available language modules.
|
||||
# To list all available language module options, please visit the nvf manual.
|
||||
languages = {
|
||||
enableLSP = true;
|
||||
enableFormat = true;
|
||||
enableFormat = true; #
|
||||
enableTreesitter = true;
|
||||
enableExtraDiagnostics = true;
|
||||
|
||||
|
@ -82,6 +84,7 @@ isMaximal: {
|
|||
elixir.enable = false;
|
||||
haskell.enable = false;
|
||||
ruby.enable = false;
|
||||
fsharp.enable = false;
|
||||
|
||||
tailwind.enable = false;
|
||||
svelte.enable = false;
|
||||
|
@ -124,7 +127,15 @@ isMaximal: {
|
|||
|
||||
autopairs.nvim-autopairs.enable = true;
|
||||
|
||||
autocomplete.nvim-cmp.enable = true;
|
||||
# nvf provides various autocomplete options. The tried and tested nvim-cmp
|
||||
# is enabled in default package, because it does not trigger a build. We
|
||||
# enable blink-cmp in maximal because it needs to build its rust fuzzy
|
||||
# matcher library.
|
||||
autocomplete = {
|
||||
nvim-cmp.enable = !isMaximal;
|
||||
blink-cmp.enable = isMaximal;
|
||||
};
|
||||
|
||||
snippets.luasnip.enable = true;
|
||||
|
||||
filetree = {
|
||||
|
@ -142,6 +153,7 @@ isMaximal: {
|
|||
binds = {
|
||||
whichKey.enable = true;
|
||||
cheatsheet.enable = true;
|
||||
hardtime-nvim.enable = isMaximal;
|
||||
};
|
||||
|
||||
telescope.enable = true;
|
||||
|
@ -234,6 +246,7 @@ isMaximal: {
|
|||
enable = false;
|
||||
cmp.enable = isMaximal;
|
||||
};
|
||||
codecompanion-nvim.enable = false;
|
||||
};
|
||||
|
||||
session = {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
inherit
|
||||
(
|
||||
(lib.evalModules {
|
||||
specialArgs = {inherit inputs;};
|
||||
modules =
|
||||
import ../modules/modules.nix {
|
||||
inherit lib pkgs;
|
||||
|
@ -95,8 +96,6 @@
|
|||
inherit (nvimModuleDocs) optionsJSON;
|
||||
};
|
||||
in {
|
||||
inherit (inputs) nmd;
|
||||
|
||||
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
|
||||
# `nixosOptionsDoc` is more customizable.
|
||||
options.json =
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
# Configuring nvf {#ch-configuring}
|
||||
|
||||
[helpful tips section]: #ch-helpful-tips
|
||||
|
||||
nvf allows for _very_ extensive configuration in Neovim through the Nix module
|
||||
interface. The below chapters describe several of the options exposed in nvf for
|
||||
your convenience. You might also be interested in the [helpful tips section] for
|
||||
more advanced or unusual configuration options supported by nvf.
|
||||
|
||||
Note that this section does not cover module _options_. For an overview of all
|
||||
module options provided by nvf, please visit the [appendix](/options.html)
|
||||
|
||||
```{=include=} chapters
|
||||
configuring/custom-package.md
|
||||
configuring/custom-plugins.md
|
||||
|
@ -7,4 +17,5 @@ configuring/overriding-plugins.md
|
|||
configuring/languages.md
|
||||
configuring/dags.md
|
||||
configuring/dag-entries.md
|
||||
configuring/autocmds.md
|
||||
```
|
||||
|
|
119
docs/manual/configuring/autocmds.md
Normal file
119
docs/manual/configuring/autocmds.md
Normal file
|
@ -0,0 +1,119 @@
|
|||
# Autocommands and Autogroups {#ch-autocmds-augroups}
|
||||
|
||||
This module allows you to declaratively configure Neovim autocommands and
|
||||
autogroups within your Nix configuration.
|
||||
|
||||
## Autogroups (`vim.augroups`) {#sec-vim-augroups}
|
||||
|
||||
Autogroups (`augroup`) organize related autocommands. This allows them to be
|
||||
managed collectively, such as clearing them all at once to prevent duplicates.
|
||||
Each entry in the list is a submodule with the following options:
|
||||
|
||||
| Option | Type | Default | Description | Example |
|
||||
| :------- | :----- | :------ | :--------------------------------------------------------------------------------------------------- | :---------------- |
|
||||
| `enable` | `bool` | `true` | Enables or disables this autogroup definition. | `true` |
|
||||
| `name` | `str` | _None_ | **Required.** The unique name for the autogroup. | `"MyFormatGroup"` |
|
||||
| `clear` | `bool` | `true` | Clears any existing autocommands within this group before adding new ones defined in `vim.autocmds`. | `true` |
|
||||
|
||||
**Example:**
|
||||
|
||||
```nix
|
||||
{
|
||||
vim.augroups = [
|
||||
{
|
||||
name = "MyCustomAuGroup";
|
||||
clear = true; # Clear previous autocommands in this group on reload
|
||||
}
|
||||
{
|
||||
name = "Formatting";
|
||||
# clear defaults to true
|
||||
}
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
## Autocommands (`vim.autocmds`) {#sec-vim-autocmds}
|
||||
|
||||
Autocommands (`autocmd`) trigger actions based on events happening within Neovim
|
||||
(e.g., saving a file, entering a buffer). Each entry in the list is a submodule
|
||||
with the following options:
|
||||
|
||||
| Option | Type | Default | Description | Example |
|
||||
| :--------- | :-------------------- | :------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------- |
|
||||
| `enable` | `bool` | `true` | Enables or disables this autocommand definition. | `true` |
|
||||
| `event` | `nullOr (listOf str)` | `null` | **Required.** List of Neovim events that trigger this autocommand (e.g., `BufWritePre`, `FileType`). | `[ "BufWritePre" ]` |
|
||||
| `pattern` | `nullOr (listOf str)` | `null` | List of file patterns (globs) to match against (e.g., `*.py`, `*`). If `null`, matches all files for the given event. | `[ "*.lua", "*.nix" ]` |
|
||||
| `callback` | `nullOr luaInline` | `null` | A Lua function to execute when the event triggers. Use `lib.nvim.types.luaInline` or `lib.options.literalExpression "mkLuaInline '''...'''"`. **Cannot be used with `command`.** | `lib.nvim.types.luaInline "function() print('File saved!') end"` |
|
||||
| `command` | `nullOr str` | `null` | A Vimscript command to execute when the event triggers. **Cannot be used with `callback`.** | `"echo 'File saved!'"` |
|
||||
| `group` | `nullOr str` | `null` | The name of an `augroup` (defined in `vim.augroups`) to associate this autocommand with. | `"MyCustomAuGroup"` |
|
||||
| `desc` | `nullOr str` | `null` | A description for the autocommand (useful for introspection). | `"Format buffer on save"` |
|
||||
| `once` | `bool` | `false` | If `true`, the autocommand runs only once and then automatically removes itself. | `false` |
|
||||
| `nested` | `bool` | `false` | If `true`, allows this autocommand to trigger other autocommands. | `false` |
|
||||
|
||||
:::{.warning}
|
||||
|
||||
You cannot define both `callback` (for Lua functions) and `command` (for
|
||||
Vimscript) for the same autocommand. Choose one.
|
||||
|
||||
:::
|
||||
|
||||
**Examples:**
|
||||
|
||||
```nix
|
||||
{ lib, ... }:
|
||||
{
|
||||
vim.augroups = [ { name = "UserSetup"; } ];
|
||||
|
||||
vim.autocmds = [
|
||||
# Example 1: Using a Lua callback
|
||||
{
|
||||
event = [ "BufWritePost" ];
|
||||
pattern = [ "*.lua" ];
|
||||
group = "UserSetup";
|
||||
desc = "Notify after saving Lua file";
|
||||
callback = lib.nvim.types.luaInline ''
|
||||
function()
|
||||
vim.notify("Lua file saved!", vim.log.levels.INFO)
|
||||
end
|
||||
'';
|
||||
}
|
||||
|
||||
# Example 2: Using a Vim command
|
||||
{
|
||||
event = [ "FileType" ];
|
||||
pattern = [ "markdown" ];
|
||||
group = "UserSetup";
|
||||
desc = "Set spellcheck for Markdown";
|
||||
command = "setlocal spell";
|
||||
}
|
||||
|
||||
# Example 3: Autocommand without a specific group
|
||||
{
|
||||
event = [ "BufEnter" ];
|
||||
pattern = [ "*.log" ];
|
||||
desc = "Disable line numbers in log files";
|
||||
command = "setlocal nonumber";
|
||||
# No 'group' specified
|
||||
}
|
||||
|
||||
# Example 4: Using Lua for callback
|
||||
{
|
||||
event = [ "BufWinEnter" ];
|
||||
pattern = [ "*" ];
|
||||
desc = "Simple greeting on entering a buffer window";
|
||||
callback = lib.generators.mkLuaInline ''
|
||||
function(args)
|
||||
print("Entered buffer: " .. args.buf)
|
||||
end
|
||||
'';
|
||||
|
||||
# Run only once per session trigger
|
||||
once = true;
|
||||
}
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
These definitions are automatically translated into the necessary Lua code to
|
||||
configure `vim.api.nvim_create_augroup` and `vim.api.nvim_create_autocmd` when
|
||||
Neovim starts.
|
|
@ -1,12 +1,12 @@
|
|||
# Custom Neovim Package {#ch-custom-package}
|
||||
|
||||
As of v0.5, you may now specify the Neovim package that will be wrapped with
|
||||
your configuration. This is done with the `vim.package` option.
|
||||
your configuration. This is done with the [](#opt-vim.package) option.
|
||||
|
||||
```nix
|
||||
{inputs, pkgs, ...}: {
|
||||
# using the neovim-nightly overlay
|
||||
vim.package = inputs.neovim-overlay.packages.${pkgs.system}.neovim;
|
||||
vim.package = inputs.neovim-overlay.packages.${pkgs.stdenv.system}.neovim;
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -1,22 +1,33 @@
|
|||
# Custom Plugins {#ch-custom-plugins}
|
||||
|
||||
**nvf**, by default, exposes a wide variety of plugins as module options for
|
||||
your convenience and bundles necessary dependencies into **nvf**'s runtime. In
|
||||
case a plugin is not available in **nvf**, you may consider making a pull
|
||||
request to **nvf** to include it as a module or you may add it to your
|
||||
configuration locally.
|
||||
**nvf** exposes a very wide variety of plugins by default, which are consumed by
|
||||
module options. This is done for your convenience, and to bundle all necessary
|
||||
dependencies into **nvf**'s runtime with full control of versioning, testing and
|
||||
dependencies. In the case a plugin you need is _not_ available, you may consider
|
||||
making a pull request to add the package you're looking for, or you may add it
|
||||
to your configuration locally. The below section describes how new plugins may
|
||||
be added to the user's configuration.
|
||||
|
||||
## Adding Plugins {#ch-adding-plugins}
|
||||
|
||||
There are multiple ways of adding custom plugins to your **nvf** configuration.
|
||||
Per **nvf**'s design choices, there are several ways of adding custom plugins to
|
||||
your configuration as you need them. As we aim for extensive configuration, it
|
||||
is possible to add custom plugins (from nixpkgs, pinning tools, flake inputs,
|
||||
etc.) to your Neovim configuration before they are even implemented in **nvf**
|
||||
as a module.
|
||||
|
||||
You can use custom plugins, before they are implemented in the flake. To add a
|
||||
plugin to the runtime, you need to add it to the [](#opt-vim.startPlugins) list
|
||||
in your configuration.
|
||||
:::{.info}
|
||||
|
||||
Adding a plugin to `startPlugins` will not allow you to configure the plugin
|
||||
that you have added, but **nvf** provides multiple way of configuring any custom
|
||||
plugins that you might have added to your configuration.
|
||||
To add a plugin to your runtime, you will need to add it to
|
||||
[](#opt-vim.startPlugins) list in your configuration. This is akin to cloning a
|
||||
plugin to `~/.config/nvim`, but they are only ever placed in the Nix store and
|
||||
never exposed to the outside world for purity and full isolation.
|
||||
|
||||
:::
|
||||
|
||||
As you would configure a cloned plugin, you must configure the new plugins that
|
||||
you've added to `startPlugins.` **nvf** provides multiple ways of configuring
|
||||
any custom plugins that you might have added to your configuration.
|
||||
|
||||
```{=include=} sections
|
||||
custom-plugins/configuring.md
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
# Configuring {#sec-configuring-plugins}
|
||||
|
||||
Just making the plugin to your Neovim configuration available might not always
|
||||
be enough. In that case, you can write custom lua config using either
|
||||
`config.vim.lazy.plugins.*.setupOpts` `config.vim.extraPlugins.*.setup` or
|
||||
`config.vim.luaConfigRC`.
|
||||
be enough., for example, if the plugin requires a setup table. In that case, you
|
||||
can write custom Lua configuration using one of
|
||||
|
||||
The first option uses an extended version of `lz.n`'s PluginSpec. `setupModule`
|
||||
and `setupOpt` can be used if the plugin uses a `require('module').setup(...)`
|
||||
pattern. Otherwise, the `before` and `after` hooks should do what you need.
|
||||
- `config.vim.lazy.plugins.*.setupOpts`
|
||||
- `config.vim.extraPlugins.*.setup`
|
||||
- `config.vim.luaConfigRC`.
|
||||
|
||||
## Lazy Plugins {#ch-vim-lazy-plugins}
|
||||
|
||||
`config.vim.lazy.plugins.*.setupOpts` is useful for lazy-loading plugins, and
|
||||
uses an extended version of `lz.n's` `PluginSpec` to expose a familiar
|
||||
interface. `setupModule` and `setupOpt` can be used if the plugin uses a
|
||||
`require('module').setup(...)` pattern. Otherwise, the `before` and `after`
|
||||
hooks should do what you need.
|
||||
|
||||
```nix
|
||||
{
|
||||
|
@ -25,50 +32,61 @@ pattern. Otherwise, the `before` and `after` hooks should do what you need.
|
|||
}
|
||||
```
|
||||
|
||||
The second option uses an attribute set, which maps DAG section names to a
|
||||
## Standard API {#ch-vim-extra-plugins}
|
||||
|
||||
`vim.extraPlugins` uses an attribute set, which maps DAG section names to a
|
||||
custom type, which has the fields `package`, `after`, `setup`. They allow you to
|
||||
set the package of the plugin, the sections its setup code should be after (note
|
||||
that the `extraPlugins` option has its own DAG scope), and the its setup code
|
||||
respectively. For example:
|
||||
|
||||
```nix
|
||||
config.vim.extraPlugins = with pkgs.vimPlugins; {
|
||||
aerial = {
|
||||
package = aerial-nvim;
|
||||
setup = "require('aerial').setup {}";
|
||||
};
|
||||
{pkgs, ...}: {
|
||||
config.vim.extraPlugins = {
|
||||
aerial = {
|
||||
package = pkgs.vimPlugins.aerial-nvim;
|
||||
setup = "require('aerial').setup {}";
|
||||
};
|
||||
|
||||
harpoon = {
|
||||
package = harpoon;
|
||||
setup = "require('harpoon').setup {}";
|
||||
after = ["aerial"]; # place harpoon configuration after aerial
|
||||
harpoon = {
|
||||
package = pkgs.vimPlugins.harpoon;
|
||||
setup = "require('harpoon').setup {}";
|
||||
after = ["aerial"]; # place harpoon configuration after aerial
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
The third option also uses an attribute set, but this one is resolved as a DAG
|
||||
### Setup using luaConfigRC {#setup-using-luaconfigrc}
|
||||
|
||||
`vim.luaConfigRC` also uses an attribute set, but this one is resolved as a DAG
|
||||
directly. The attribute names denote the section names, and the values lua code.
|
||||
For example:
|
||||
|
||||
```nix
|
||||
{
|
||||
# this will create an "aquarium" section in your init.lua with the contents of your custom config
|
||||
# which will be *appended* to the rest of your configuration, inside your init.vim
|
||||
# This will create a section called "aquarium" in the 'init.lua' with the
|
||||
# contents of your custom configuration. By default 'entryAnywhere' is implied
|
||||
# in DAGs, so this will be inserted to an arbitrary position. In the case you
|
||||
# wish to control the position of this section with more precision, please
|
||||
# look into the DAGs section of the manual.
|
||||
config.vim.luaConfigRC.aquarium = "vim.cmd('colorscheme aquiarum')";
|
||||
}
|
||||
```
|
||||
|
||||
<!-- deno-fmt-ignore-start -->
|
||||
[DAG system]: #ch-using-dags
|
||||
[DAG section]: #ch-dag-entries
|
||||
|
||||
::: {.note}
|
||||
One of the greatest strengths of nvf is the ability to order
|
||||
snippets of configuration via the DAG system. It will allow specifying positions
|
||||
of individual sections of configuration as needed. nvf provides helper functions
|
||||
One of the **greatest strengths** of **nvf** is the ability to order
|
||||
configuration snippets precisely using the [DAG system]. DAGs
|
||||
are a very powerful mechanism that allows specifying positions
|
||||
of individual sections of configuration as needed. We provide helper functions
|
||||
in the extended library, usually under `inputs.nvf.lib.nvim.dag` that you may
|
||||
use.
|
||||
|
||||
Please refer to the [DAG section](/index.xhtml#ch-dag-entries) in the nvf manual
|
||||
Please refer to the [DAG section] in the nvf manual
|
||||
to find out more about the DAG system.
|
||||
:::
|
||||
|
||||
<!-- deno-fmt-ignore-end -->
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# Lazy Method {#sec-lazy-method}
|
||||
|
||||
As of version **0.7**, we exposed an API for configuring lazy-loaded plugins via
|
||||
`lz.n` and `lzn-auto-require`.
|
||||
As of version **0.7**, an API is exposed to allow configuring lazy-loaded
|
||||
plugins via `lz.n` and `lzn-auto-require`. Below is a comprehensive example of
|
||||
how it may be loaded to lazy-load an arbitrary plugin.
|
||||
|
||||
```nix
|
||||
{
|
||||
|
@ -38,3 +39,24 @@ As of version **0.7**, we exposed an API for configuring lazy-loaded plugins via
|
|||
};
|
||||
}
|
||||
```
|
||||
|
||||
## LazyFile event {#sec-lazyfile-event}
|
||||
|
||||
**nvf** re-implements `LazyFile` as a familiar 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 the `LazyFile` event as an alias to the combination of
|
||||
`"BufReadPost"`, `"BufNewFile"` and `"BufWritePre"`, i.e., a list containing all
|
||||
three of those events: `["BufReadPost" "BufNewFile" "BufWritePre"]`
|
||||
|
|
|
@ -1,26 +1,31 @@
|
|||
# Legacy Method {#sec-legacy-method}
|
||||
|
||||
Prior to version v0.5, the method of adding new plugins was adding the plugin
|
||||
package to `vim.startPlugins` and add its configuration as a DAG under one of
|
||||
`vim.configRC` or `vim.luaConfigRC`. Users who have not yet updated to 0.5, or
|
||||
prefer a more hands-on approach may use the old method where the load order of
|
||||
the plugins is determined by DAGs.
|
||||
Prior to version **0.5**, the method of adding new plugins was adding the plugin
|
||||
package to [](#opt-vim.startPlugins) and adding its configuration as a DAG under
|
||||
one of `vim.configRC` or [](#opt-vim.luaConfigRC). While `configRC` has been
|
||||
deprecated, users who have not yet updated to 0.5 or those who prefer a more
|
||||
hands-on approach may choose to use the old method where the load order of the
|
||||
plugins is explicitly determined by DAGs without internal abstractions.
|
||||
|
||||
## Adding plugins {#sec-adding-plugins}
|
||||
## Adding New Plugins {#sec-adding-new-plugins}
|
||||
|
||||
To add a plugin not available in nvf as a module to your configuration, you may
|
||||
add it to [](#opt-vim.startPlugins) in order to make it available to Neovim at
|
||||
runtime.
|
||||
To add a plugin not available in **nvf** as a module to your configuration using
|
||||
the legacy method, you must add it to [](#opt-vim.startPlugins) in order to make
|
||||
it available to Neovim at runtime.
|
||||
|
||||
```nix
|
||||
{pkgs, ...}: {
|
||||
# Add a Neovim plugin from Nixpkgs to the runtime.
|
||||
# This does not need to come explicitly from packages. 'vim.startPlugins'
|
||||
# takes a list of *string* (to load internal plugins) or *package* to load
|
||||
# a Neovim package from any source.
|
||||
vim.startPlugins = [pkgs.vimPlugins.aerial-nvim];
|
||||
}
|
||||
```
|
||||
|
||||
And to configure the added plugin, you can use the `luaConfigRC` option to
|
||||
provide configuration as a DAG using the **nvf** extended library.
|
||||
Once the package is available in Neovim's runtime, you may use the `luaConfigRC`
|
||||
option to provide configuration as a DAG using the **nvf** extended library in
|
||||
order to configure the added plugin,
|
||||
|
||||
```nix
|
||||
{inputs, ...}: let
|
||||
|
@ -29,6 +34,8 @@ provide configuration as a DAG using the **nvf** extended library.
|
|||
# to specialArgs, the 'inputs' prefix may be omitted.
|
||||
inherit (inputs.nvf.lib.nvim.dag) entryAnywhere;
|
||||
in {
|
||||
# luaConfigRC takes Lua configuration verbatim and inserts it at an arbitrary
|
||||
# position by default or if 'entryAnywhere' is used.
|
||||
vim.luaConfigRC.aerial-nvim= entryAnywhere ''
|
||||
require('aerial').setup {
|
||||
-- your configuration here
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
# Non-lazy Method {#sec-non-lazy-method}
|
||||
|
||||
As of version **0.5**, we have a more extensive API for configuring plugins,
|
||||
under `vim.extraPlugins`. Instead of using DAGs exposed by the library, you may
|
||||
use the extra plugin module as follows:
|
||||
As of version **0.5**, we have a more extensive API for configuring plugins that
|
||||
should be preferred over the legacy method. This API is available as
|
||||
[](#opt-vim.extraPlugins). Instead of using DAGs exposed by the library
|
||||
_directly_, you may use the extra plugin module as follows:
|
||||
|
||||
```nix
|
||||
{
|
||||
config.vim.extraPlugins = with pkgs.vimPlugins; {
|
||||
{pkgs, ...}: {
|
||||
config.vim.extraPlugins = {
|
||||
aerial = {
|
||||
package = aerial-nvim;
|
||||
package = pkgs.vimPlugins.aerial-nvim;
|
||||
setup = ''
|
||||
require('aerial').setup {
|
||||
-- some lua configuration here
|
||||
|
@ -17,10 +18,12 @@ use the extra plugin module as follows:
|
|||
};
|
||||
|
||||
harpoon = {
|
||||
package = harpoon;
|
||||
package = pkgs.vimPlugins.harpoon;
|
||||
setup = "require('harpoon').setup {}";
|
||||
after = ["aerial"];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
This provides a level of abstraction over the DAG system for faster iteration.
|
||||
|
|
|
@ -19,6 +19,7 @@ formatting to diagnostics. The following languages have sections under the
|
|||
- Go: [vim.languages.go.enable](#opt-vim.languages.go.enable)
|
||||
- Lua: [vim.languages.lua.enable](#opt-vim.languages.lua.enable)
|
||||
- PHP: [vim.languages.php.enable](#opt-vim.languages.php.enable)
|
||||
- F#: [vim.languages.fsharp.enable](#opt-vim.languages.fsharp.enable)
|
||||
|
||||
Adding support for more languages, and improving support for existing ones are
|
||||
great places where you can contribute with a PR.
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
# LSP Custom Packages/Command {#sec-languages-custom-lsp-packages}
|
||||
|
||||
In any of the `opt.languages.<language>.lsp.package` options you can provide
|
||||
your own LSP package, or provide the command to launch the language server, as a
|
||||
list of strings. You can use this to skip automatic installation of a language
|
||||
server, and instead use the one found in your `$PATH` during runtime, for
|
||||
example:
|
||||
One of the strengths of **nvf** is convenient aliases to quickly configure LSP
|
||||
servers through the Nix module system. By default the LSP packages for relevant
|
||||
language modules will be pulled into the closure. If this is not desirable, you
|
||||
may provide **a custom LSP package** (e.g., a Bash script that calls a command)
|
||||
or **a list of strings** to be interpreted as the command to launch the language
|
||||
server. By using a list of strings, you can use this to skip automatic
|
||||
installation of a language server, and instead use the one found in your `$PATH`
|
||||
during runtime, for example:
|
||||
|
||||
```nix
|
||||
vim.languages.java = {
|
||||
lsp = {
|
||||
enable = true;
|
||||
# this expects jdt-language-server to be in your PATH
|
||||
# or in `vim.extraPackages`
|
||||
|
||||
# This expects 'jdt-language-server' to be in your PATH or in
|
||||
# 'vim.extraPackages.' There are no additional checks performed to see
|
||||
# if the command provided is valid.
|
||||
package = ["jdt-language-server" "-data" "~/.cache/jdtls/workspace"];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
# Default Configs {#ch-default-configs}
|
||||
|
||||
While you can configure **nvf** yourself using the builder, you can also use the
|
||||
pre-built configs that are available. Here are a few default configurations you
|
||||
can use.
|
||||
|
||||
```{=include=} chapters
|
||||
default-configs/maximal.md
|
||||
default-configs/nix.md
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
# Maximal {#sec-default-maximal}
|
||||
|
||||
```bash
|
||||
$ nix shell github:notashelf/nvf#maximal test.nix
|
||||
```
|
||||
|
||||
It is the same fully configured Neovim as with the [Nix](#sec-default-nix)
|
||||
configuration, but with every supported language enabled.
|
||||
|
||||
::: {.note} Running the maximal config will download _a lot_ of packages as it
|
||||
is downloading language servers, formatters, and more. :::
|
|
@ -1,9 +0,0 @@
|
|||
# Nix {#sec-default-nix}
|
||||
|
||||
```bash
|
||||
$ nix run github:notashelf/nvf#nix test.nix
|
||||
```
|
||||
|
||||
Enables all the of Neovim plugins, with language support for specifically Nix.
|
||||
This lets you see what a fully configured neovim setup looks like without
|
||||
downloading a whole bunch of language servers and associated tools.
|
|
@ -39,7 +39,7 @@ An example flake that exposes your custom Neovim configuration might look like
|
|||
theme.enable = true;
|
||||
|
||||
# Enable Treesitter
|
||||
tree-sitter.enable = true;
|
||||
treesitter.enable = true;
|
||||
|
||||
# Other options will go here. Refer to the config
|
||||
# reference in Appendix B of the nvf manual.
|
||||
|
|
|
@ -8,7 +8,6 @@ try-it-out.md
|
|||
```
|
||||
|
||||
```{=include=} parts
|
||||
default-configs.md
|
||||
installation.md
|
||||
configuring.md
|
||||
tips.md
|
||||
|
|
|
@ -5,8 +5,8 @@ options will include useful comments, warnings or setup tips on how a module
|
|||
option is meant to be used as well as examples in complex cases.
|
||||
|
||||
An offline version of this page is bundled with nvf as a part of the manpages
|
||||
which you can access with `man 5 nvf`. Please us know if you believe any of the
|
||||
options below are missing useful examples.
|
||||
which you can access with `man 5 nvf`. Please let us know if you believe any of
|
||||
the options below are missing useful examples.
|
||||
|
||||
<!--
|
||||
In the manual, individual options may be referenced in Hyperlinks as follows:
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
# Helpful Tips {#ch-helpful-tips}
|
||||
|
||||
This section provides helpful tips that may be considered "unorthodox" or "too
|
||||
advanced" for some users. We will cover basic debugging steps, offline
|
||||
documentation, configuring **nvf** with pure Lua and using custom plugin sources
|
||||
in **nvf** in this section. For general configuration tips, please see previous
|
||||
chapters.
|
||||
|
||||
```{=include=} chapters
|
||||
tips/pure-lua-config.md
|
||||
tips/debugging-nvf.md
|
||||
tips/offline-docs.md
|
||||
tips/pure-lua-config.md
|
||||
tips/plugin-sources.md
|
||||
```
|
||||
|
|
131
docs/manual/tips/plugin-sources.md
Normal file
131
docs/manual/tips/plugin-sources.md
Normal file
|
@ -0,0 +1,131 @@
|
|||
# Adding Plugins From Different Sources {#sec-plugin-sources}
|
||||
|
||||
**nvf** attempts to avoid depending on Nixpkgs for Neovim plugins. For the most
|
||||
part, this is accomplished by defining each plugin's source and building them
|
||||
from source.
|
||||
|
||||
[npins]: https://github.com/andir/npins
|
||||
|
||||
To define plugin sources, we use [npins] and pin each plugin source using
|
||||
builtin fetchers. You are not bound by this restriction. In your own
|
||||
configuration, any kind of fetcher or plugin source is fine.
|
||||
|
||||
## Nixpkgs & Friends {#ch-plugins-from-nixpkgs}
|
||||
|
||||
`vim.startPlugins` and `vim.optPlugins` options take either a **string**, in
|
||||
which case a plugin from nvf's internal plugins registry will be used, or a
|
||||
**package**. If your plugin does not require any setup, or ordering for it s
|
||||
configuration, then it is possible to add it to `vim.startPlugins` to load it on
|
||||
startup.
|
||||
|
||||
```nix
|
||||
{pkgs, ...}: {
|
||||
# Aerial does require some setup. In the case you pass a plugin that *does*
|
||||
# require manual setup, then you must also call the setup function.
|
||||
vim.startPlugins = [pkgs.vimPlugins.aerial-nvim];
|
||||
}
|
||||
```
|
||||
|
||||
[`vim.extraPlugins`]: https://notashelf.github.io/nvf/options.html#opt-vim.extraPlugins
|
||||
|
||||
This will fetch aerial.nvim from nixpkgs, and add it to Neovim's runtime path to
|
||||
be loaded manually. Although for plugins that require manual setup, you are
|
||||
encouraged to use [`vim.extraPlugins`].
|
||||
|
||||
```nix
|
||||
{
|
||||
vim.extraPlugins = {
|
||||
aerial = {
|
||||
package = pkgs.vimPlugins.aerial-nvim;
|
||||
setup = "require('aerial').setup {}";
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
[custom plugins section]: https://notashelf.github.io/nvf/index.xhtml#ch-custom-plugins
|
||||
|
||||
More details on the extraPlugins API is documented in the
|
||||
[custom plugins section].
|
||||
|
||||
## Building Your Own Plugins {#ch-plugins-from-source}
|
||||
|
||||
In the case a plugin is not available in Nixpkgs, or the Nixpkgs package is
|
||||
outdated (or, more likely, broken) it is possible to build the plugins from
|
||||
source using a tool, such as [npins]. You may also use your _flake inputs_ as
|
||||
sources.
|
||||
|
||||
Example using plugin inputs:
|
||||
|
||||
```nix
|
||||
{
|
||||
# In your flake.nix
|
||||
inputs = {
|
||||
aerial-nvim = {
|
||||
url = "github:stevearc/aerial.nvim"
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
# Make sure that 'inputs' is properly propagated into Nvf, for example, through
|
||||
# specialArgs.
|
||||
outputs = { ... };
|
||||
}
|
||||
```
|
||||
|
||||
In the case, you may use the input directly for the plugin's source attribute in
|
||||
`buildVimPlugin`.
|
||||
|
||||
```nix
|
||||
# Make sure that 'inputs' is properly propagated! It will be missing otherwise
|
||||
# and the resulting errors might be too obscure.
|
||||
{inputs, ...}: let
|
||||
aerial-from-source = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "aerial-nvim";
|
||||
src = inputs.aerial-nvim;
|
||||
};
|
||||
in {
|
||||
vim.extraPlugins = {
|
||||
aerial = {
|
||||
package = aerial-from-source;
|
||||
setup = "require('aerial').setup {}";
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively, if you do not want to keep track of the source using flake inputs
|
||||
or npins, you may call `fetchFromGitHub` (or other fetchers) directly. An
|
||||
example would look like this.
|
||||
|
||||
```nix
|
||||
regexplainer = buildVimPlugin {
|
||||
name = "nvim-regexplainer";
|
||||
src = fetchFromGitHub {
|
||||
owner = "bennypowers";
|
||||
repo = "nvim-regexplainer";
|
||||
rev = "4250c8f3c1307876384e70eeedde5149249e154f";
|
||||
hash = "sha256-15DLbKtOgUPq4DcF71jFYu31faDn52k3P1x47GL3+b0=";
|
||||
};
|
||||
|
||||
# The 'buildVimPlugin' imposes some "require checks" on all plugins build from
|
||||
# source. Failing tests, if they are not relevant, can be disabled using the
|
||||
# 'nvimSkipModule' argument to the 'buildVimPlugin' function.
|
||||
nvimSkipModule = [
|
||||
"regexplainer"
|
||||
"regexplainer.buffers.init"
|
||||
"regexplainer.buffers.popup"
|
||||
"regexplainer.buffers.register"
|
||||
"regexplainer.buffers.shared"
|
||||
"regexplainer.buffers.split"
|
||||
"regexplainer.component.descriptions"
|
||||
"regexplainer.component.init"
|
||||
"regexplainer.renderers.narrative.init"
|
||||
"regexplainer.renderers.narrative.narrative"
|
||||
"regexplainer.renderers.init"
|
||||
"regexplainer.utils.defer"
|
||||
"regexplainer.utils.init"
|
||||
"regexplainer.utils.treesitter"
|
||||
];
|
||||
}
|
||||
```
|
|
@ -26,7 +26,12 @@ $ nix run github:notashelf/nvf#nix
|
|||
$ nix run github:notashelf/nvf#maximal
|
||||
```
|
||||
|
||||
### Available Configs {#sec-available-configs}
|
||||
### Available Configurations {#sec-available-configs}
|
||||
|
||||
:::{.info}
|
||||
|
||||
The below configurations are provided for demonstration purposes, and are
|
||||
**not** designed to be installed as is. You may
|
||||
|
||||
#### Nix {#sec-configs-nix}
|
||||
|
||||
|
@ -34,15 +39,32 @@ $ nix run github:notashelf/nvf#maximal
|
|||
a set of visual and functional plugins. By running `nix run .#`, which is the
|
||||
default package, you will build Neovim with this config.
|
||||
|
||||
```bash
|
||||
$ nix run github:notashelf/nvf#nix test.nix
|
||||
```
|
||||
|
||||
This command will start Neovim with some opinionated plugin configurations, and
|
||||
is designed specifically for Nix. the `nix` configuration lets you see how a
|
||||
fully configured Neovim setup _might_ look like without downloading too many
|
||||
packages or shell utilities.
|
||||
|
||||
#### Maximal {#sec-configs-maximal}
|
||||
|
||||
`Maximal` is the ultimate configuration that will enable support for more
|
||||
commonly used language as well as additional complementary plugins. Keep in
|
||||
mind, however, that this will pull a lot of dependencies.
|
||||
|
||||
::: {.tip}
|
||||
```bash
|
||||
$ nix run github:notashelf/nvf#maximal -- test.nix
|
||||
```
|
||||
|
||||
You are _strongly_ recommended to use the binary cache if you would like to try
|
||||
the Maximal configuration.
|
||||
It uses the same configuration template with the [Nix](#sec-configs-nix)
|
||||
configuration, but supports many more languages, and enables more utility,
|
||||
companion or fun plugins.
|
||||
|
||||
::: {.warning}
|
||||
|
||||
Running the maximal config will download _a lot_ of packages as it is
|
||||
downloading language servers, formatters, and more.
|
||||
|
||||
:::
|
||||
|
|
|
@ -50,9 +50,8 @@ soon.
|
|||
|
||||
- A new section has been added for language support: `vim.languages.<language>`.
|
||||
|
||||
- The options [](#opt-vim.languages.enableLSP),
|
||||
[](#opt-vim.languages.enableTreesitter), etc. will enable the respective
|
||||
section for all languages that have been enabled.
|
||||
- The options `enableLSP` [](#opt-vim.languages.enableTreesitter), etc. will
|
||||
enable the respective section for all languages that have been enabled.
|
||||
- All LSP languages have been moved here
|
||||
- `plantuml` and `markdown` have been moved here
|
||||
- A new section has been added for `html`. The old
|
||||
|
|
|
@ -91,7 +91,7 @@ Release notes for release 0.5
|
|||
- Updated indent-blankine.nvim to v3 - this comes with a few option changes,
|
||||
which will be migrated with `renamedOptionModule`
|
||||
|
||||
[jacekpoz](https://jacekpoz.pl):
|
||||
[poz](https://poz.pet):
|
||||
|
||||
- Fixed scrollOffset not being used
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap =
|
|||
|
||||
- Added rose-pine theme.
|
||||
|
||||
[jacekpoz](https://jacekpoz.pl):
|
||||
[poz](https://poz.pet):
|
||||
|
||||
- Added `vim.autocomplete.alwaysComplete`. Allows users to have the autocomplete
|
||||
window popup only when manually activated.
|
||||
|
|
|
@ -162,7 +162,7 @@ The changes are, in no particular order:
|
|||
- Add [lz.n] support and lazy-load some builtin plugins.
|
||||
- Add simpler helper functions for making keymaps
|
||||
|
||||
[jacekpoz](https://jacekpoz.pl):
|
||||
[poz](https://poz.pet):
|
||||
|
||||
[ocaml-lsp]: https://github.com/ocaml/ocaml-lsp
|
||||
[new-file-template.nvim]: https://github.com/otavioschwanck/new-file-template.nvim
|
||||
|
|
|
@ -2,17 +2,31 @@
|
|||
|
||||
## Breaking changes
|
||||
|
||||
[Lspsaga documentation]: https://nvimdev.github.io/lspsaga/
|
||||
|
||||
- `git-conflict` keybinds are now prefixed with `<leader>` to avoid conflicting
|
||||
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):
|
||||
|
||||
[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
|
||||
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
|
||||
[yanky.nvim]: https://github.com/gbprod/yanky.nvim
|
||||
[yazi.nvim]: https://github.com/mikavilpas/yazi.nvim
|
||||
[snacks.nvim]: https://github.com/folke/snacks.nvim
|
||||
[oil.nvim]: https://github.com/stevearc/oil.nvim
|
||||
|
||||
- Add [typst-preview.nvim] under
|
||||
`languages.typst.extensions.typst-preview-nvim`.
|
||||
|
@ -62,6 +76,21 @@
|
|||
|
||||
- Add [yazi.nvim] as a companion plugin for Yazi, the terminal file manager.
|
||||
|
||||
- Add [snacks.nvim] under `vim.utility.snacks-nvim` as a general-purpose utility
|
||||
plugin.
|
||||
|
||||
- Move LSPSaga to `setupOpts` format, allowing freeform configuration in
|
||||
`vim.lsp.lspsaga.setupOpts`.
|
||||
|
||||
- Lazyload Lspsaga and remove default keybindings for it.
|
||||
|
||||
- Add [oil.nvim] as an alternative file explorer. It will be available under
|
||||
`vim.utility.oil-nvim`.
|
||||
|
||||
- Add `vim.diagnostics` to interact with Neovim's diagnostics module. Available
|
||||
options for `vim.diagnostic.config()` can now be customized through the
|
||||
[](#opt-vim.diagnostics.config) in nvf.
|
||||
|
||||
[amadaluzia](https://github.com/amadaluzia):
|
||||
|
||||
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
||||
|
@ -72,7 +101,15 @@
|
|||
|
||||
[blink.cmp]: https://github.com/saghen/blink.cmp
|
||||
|
||||
- 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
|
||||
- Moved code setting `additionalRuntimePaths` and `enableLuaLoader` out of
|
||||
`luaConfigPre`'s default to prevent being overridden
|
||||
- Use conform over custom autocmds for LSP format on save
|
||||
|
||||
[diniamo](https://github.com/diniamo):
|
||||
|
||||
|
@ -81,14 +118,6 @@
|
|||
- Disable the built-in format-on-save feature of zls. Use `vim.lsp.formatOnSave`
|
||||
instead.
|
||||
|
||||
[horriblename](https://github.com/horriblename):
|
||||
|
||||
[aerial.nvim]: (https://github.com/stevearc/aerial.nvim)
|
||||
[nvim-ufo]: (https://github.com/kevinhwang91/nvim-ufo)
|
||||
|
||||
- Add [aerial.nvim].
|
||||
- Add [nvim-ufo].
|
||||
|
||||
[LilleAila](https://github.com/LilleAila):
|
||||
|
||||
- Remove `vim.notes.obsidian.setupOpts.dir`, which was set by default. Fixes
|
||||
|
@ -159,16 +188,21 @@
|
|||
[thamenato](https://github.com/thamenato):
|
||||
|
||||
[ruff]: (https://github.com/astral-sh/ruff)
|
||||
[cue]: (https://cuelang.org/)
|
||||
|
||||
- Add [ruff] as a formatter option in `vim.languages.python.format.type`.
|
||||
- Add [cue] support under `vim.languages.cue`.
|
||||
|
||||
[ARCIII](https://github.com/ArmandoCIII):
|
||||
|
||||
[leetcode.nvim]: https://github.com/kawre/leetcode.nvim
|
||||
[codecompanion-nvim]: https://github.com/olimorris/codecompanion.nvim
|
||||
|
||||
- Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. Code
|
||||
Inspiration from `vim.languages.clang.dap` implementation.
|
||||
- Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`.
|
||||
- Add [codecompanion.nvim] plugin under `vim.assistant.codecompanion-nvim`.
|
||||
- Fix [codecompanion-nvim] plugin: nvim-cmp error and setupOpts defaults.
|
||||
|
||||
[nezia1](https://github.com/nezia1):
|
||||
|
||||
|
@ -214,8 +248,9 @@
|
|||
|
||||
[alfarel](https://github.com/alfarelcynthesis):
|
||||
|
||||
- Add missing `yazi.nvim` dependency (`snacks.nvim`).
|
||||
[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
|
||||
|
@ -226,6 +261,9 @@
|
|||
- 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):
|
||||
|
||||
|
@ -242,3 +280,98 @@
|
|||
|
||||
- `alpha` is now configured with nix.
|
||||
- Add `markview-nvim` markdown renderer.
|
||||
|
||||
[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.
|
||||
- Fix an error where `eslint_d` fails to load.
|
||||
- Add required files support for linters under
|
||||
`vim.diagnostics.nvim-lint.linters.*.required_files`.
|
||||
- Add global function `nvf_lint` under
|
||||
`vim.diagnostics.nvim-lint.lint_function`.
|
||||
|
||||
[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`, `snacks.explorer` integrations to `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`.
|
||||
- Add `neo-tree`, `snacks.picker` extensions to `lualine`.
|
||||
- Add support for `vim.lsp.formatOnSave` and
|
||||
`vim.lsp.mappings.toggleFormatOnSave`
|
||||
|
||||
[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
|
||||
|
||||
[Noah765](https://github.com/Noah765):
|
||||
|
||||
[vim-sleuth]: https://github.com/tpope/vim-sleuth
|
||||
|
||||
- Add missing `flutter-tools.nvim` dependency `plenary.nvim`.
|
||||
- Add necessary dependency of `flutter-tools.nvim` on lsp.
|
||||
- Add the `vim.languages.dart.flutter-tools.flutterPackage` option.
|
||||
- Fix the type of the `highlight` color options.
|
||||
- Add [vim-sleuth] plugin under `vim.utility.sleuth`.
|
||||
|
||||
[howird](https://github.com/howird):
|
||||
|
||||
- Change python dap adapter name from `python` to commonly expected `debugpy`.
|
||||
|
||||
[aionoid](https://github.com/aionoid):
|
||||
|
||||
- Fix [render-markdown.nvim] file_types option type to list, to accept merging.
|
||||
|
||||
[poz](https://poz.pet):
|
||||
|
||||
- Fix gitsigns null-ls issue.
|
||||
|
||||
[Haskex](https://github.com/haskex):
|
||||
|
||||
[Hardtime.nvim]: https://github.com/m4xshen/hardtime.nvim
|
||||
|
||||
- Add Plugin [Hardtime.nvim] under `vim.binds.hardtime-nvim` with `enable` and
|
||||
`setupOpts` options
|
||||
|
||||
[taylrfnt](https://github.com/taylrfnt):
|
||||
|
||||
[nvim-tree](https://github.com/nvim-tree/nvim-tree.lua):
|
||||
|
||||
- Add missing `right_align` option for existing `renderer.icons` options.
|
||||
- Add missing `render.icons` options (`hidden_placement`,
|
||||
`diagnostics_placement`, and `bookmarks_placement`).
|
||||
|
|
62
flake.lock
generated
62
flake.lock
generated
|
@ -5,11 +5,11 @@
|
|||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1738453229,
|
||||
"narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
|
||||
"lastModified": 1743550720,
|
||||
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
|
||||
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -38,11 +38,11 @@
|
|||
},
|
||||
"mnw": {
|
||||
"locked": {
|
||||
"lastModified": 1738852285,
|
||||
"narHash": "sha256-8Y1uyE6gGHxdU0Vcx2CMg/dAmDSxJw19aAl3TKbbo54=",
|
||||
"lastModified": 1746338991,
|
||||
"narHash": "sha256-GbyoHjf14LOxZQc+0NFblI4xf/uwGrYo3W8lwE4HcwI=",
|
||||
"owner": "Gerg-L",
|
||||
"repo": "mnw",
|
||||
"rev": "6ae73dc9cb72cea17bcc2e3d4670825f483e80e8",
|
||||
"rev": "c65407ee9387ef75985dad3e30f58c822c766ec1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -62,11 +62,11 @@
|
|||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1732053863,
|
||||
"narHash": "sha256-DCIVdlb81Fct2uwzbtnawLBC/U03U2hqx8trqTJB7WA=",
|
||||
"lastModified": 1741118843,
|
||||
"narHash": "sha256-ggXU3RHv6NgWw+vc+HO4/9n0GPufhTIUjVuLci8Za8c=",
|
||||
"owner": "oxalica",
|
||||
"repo": "nil",
|
||||
"rev": "2e24c9834e3bb5aa2a3701d3713b43a6fb106362",
|
||||
"rev": "577d160da311cc7f5042038456a0713e9863d09e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -77,11 +77,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1740303746,
|
||||
"narHash": "sha256-XcdiWLEhjJkMxDLKQJ0CCivmYYCvA5MDxu9pMybM5kM=",
|
||||
"lastModified": 1746152631,
|
||||
"narHash": "sha256-zBuvmL6+CUsk2J8GINpyy8Hs1Zp4PP6iBWSmZ4SCQ/s=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2d068ae5c6516b2d04562de50a58c682540de9bf",
|
||||
"rev": "032bc6539bd5f14e9d0c51bd79cfe9a055b094c3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -93,30 +93,17 @@
|
|||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1738452942,
|
||||
"narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
|
||||
"lastModified": 1743296961,
|
||||
"narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
|
||||
}
|
||||
},
|
||||
"nmd": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1705050560,
|
||||
"narHash": "sha256-x3zzcdvhJpodsmdjqB4t5mkVW22V3wqHLOun0KRBzUI=",
|
||||
"owner": "~rycee",
|
||||
"repo": "nmd",
|
||||
"rev": "66d9334933119c36f91a78d565c152a4fdc8d3d3",
|
||||
"type": "sourcehut"
|
||||
},
|
||||
"original": {
|
||||
"owner": "~rycee",
|
||||
"repo": "nmd",
|
||||
"type": "sourcehut"
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
|
@ -126,7 +113,6 @@
|
|||
"mnw": "mnw",
|
||||
"nil": "nil",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nmd": "nmd",
|
||||
"systems": "systems_2"
|
||||
}
|
||||
},
|
||||
|
@ -138,11 +124,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731983527,
|
||||
"narHash": "sha256-JECaBgC0pQ91Hq3W4unH6K9to8s2Zl2sPNu7bLOv4ek=",
|
||||
"lastModified": 1741055476,
|
||||
"narHash": "sha256-52vwEV0oS2lCnx3c/alOFGglujZTLmObit7K8VblnS8=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "71287228d96e9568e1e70c6bbfa3f992d145947b",
|
||||
"rev": "aefb7017d710f150970299685e8d8b549d653649",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -18,10 +18,7 @@
|
|||
systems = import inputs.systems;
|
||||
imports = [
|
||||
./flake/templates
|
||||
|
||||
./flake/apps.nix
|
||||
./flake/legacyPackages.nix
|
||||
./flake/overlays.nix
|
||||
./flake/packages.nix
|
||||
./flake/develop.nix
|
||||
];
|
||||
|
@ -86,12 +83,6 @@
|
|||
# Alternate neovim-wrapper
|
||||
mnw.url = "github:Gerg-L/mnw";
|
||||
|
||||
# For generating documentation website
|
||||
nmd = {
|
||||
url = "sourcehut:~rycee/nmd";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Language servers (use master instead of nixpkgs)
|
||||
nil = {
|
||||
url = "github:oxalica/nil";
|
||||
|
|
31
flake/blink/default.nix
Normal file
31
flake/blink/default.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
writeShellScriptBin,
|
||||
}:
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "blink-cmp";
|
||||
version = "1.2.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Saghen";
|
||||
repo = "blink.cmp";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-bKe8SSg1HPWE7b4iRQJwiOVCrvvgttuHCOIa4U/38AY=";
|
||||
};
|
||||
|
||||
postInstall = ''
|
||||
cp -r {lua,plugin} "$out"
|
||||
mkdir -p "$out/target"
|
||||
mv "$out/lib" "$out/target/release"
|
||||
'';
|
||||
|
||||
cargoHash = "sha256-IDoDugtNWQovfSstbVMkKHLBXKa06lxRWmywu4zyS3M=";
|
||||
useFetchCargoVendor = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
(writeShellScriptBin "git" "exit 1")
|
||||
];
|
||||
|
||||
env.RUSTC_BOOTSTRAP = true;
|
||||
})
|
|
@ -3,13 +3,14 @@
|
|||
pkgs,
|
||||
config,
|
||||
self',
|
||||
inputs',
|
||||
...
|
||||
}: {
|
||||
devShells = {
|
||||
default = self'.devShells.lsp;
|
||||
nvim-nix = pkgs.mkShellNoCC {packages = [config.packages.nix];};
|
||||
lsp = pkgs.mkShellNoCC {
|
||||
packages = with pkgs; [nil statix deadnix alejandra npins];
|
||||
packages = with pkgs; [inputs'.nil.packages.default statix deadnix alejandra npins];
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
self,
|
||||
...
|
||||
}: {
|
||||
perSystem = {
|
||||
system,
|
||||
inputs',
|
||||
...
|
||||
}: {
|
||||
legacyPackages = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
inputs.self.overlays.default
|
||||
|
||||
(final: prev: {
|
||||
# Build nil from source to get most recent
|
||||
# features as they are added.
|
||||
nil = inputs'.nil.packages.default;
|
||||
blink-cmp = let
|
||||
pin = self.pins.blink-cmp;
|
||||
in
|
||||
final.callPackage ./legacyPackages/blink-cmp.nix {
|
||||
inherit (pin) version;
|
||||
src = prev.fetchFromGitHub {
|
||||
inherit (pin.repository) owner repo;
|
||||
rev = pin.revision;
|
||||
sha256 = pin.hash;
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
rustPlatform,
|
||||
hostPlatform,
|
||||
vimUtils,
|
||||
git,
|
||||
src,
|
||||
version,
|
||||
}: let
|
||||
blink-fuzzy-lib = rustPlatform.buildRustPackage {
|
||||
pname = "blink-fuzzy-lib";
|
||||
inherit version src;
|
||||
|
||||
# TODO: remove this if plugin stops using nightly rust
|
||||
env.RUSTC_BOOTSTRAP = true;
|
||||
|
||||
nativeBuildInputs = [git];
|
||||
cargoLock = {
|
||||
lockFile = "${src}/Cargo.lock";
|
||||
allowBuiltinFetchGit = true;
|
||||
};
|
||||
};
|
||||
|
||||
libExt =
|
||||
if hostPlatform.isDarwin
|
||||
then "dylib"
|
||||
else "so";
|
||||
in
|
||||
vimUtils.buildVimPlugin {
|
||||
pname = "blink-cmp";
|
||||
inherit version src;
|
||||
|
||||
# blink references a repro.lua which is placed outside the lua/ directory
|
||||
doCheck = false;
|
||||
preInstall = ''
|
||||
mkdir -p target/release
|
||||
ln -s ${blink-fuzzy-lib}/lib/libblink_cmp_fuzzy.${libExt} target/release/libblink_cmp_fuzzy.${libExt}
|
||||
'';
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.nvim) neovimConfiguration;
|
||||
|
||||
buildPkg = pkgs: modules: (neovimConfiguration {inherit pkgs modules;}).neovim;
|
||||
|
||||
nixConfig = import ../configuration.nix false;
|
||||
maximalConfig = import ../configuration.nix true;
|
||||
in {
|
||||
flake.overlays.default = final: _prev: {
|
||||
inherit neovimConfiguration;
|
||||
neovim-nix = buildPkg final [nixConfig];
|
||||
neovim-maximal = buildPkg final [maximalConfig];
|
||||
devPkg = buildPkg pkgs [nixConfig {config.vim.languages.html.enable = pkgs.lib.mkForce true;}];
|
||||
};
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
{inputs, ...}: {
|
||||
{inputs, ...} @ args: {
|
||||
perSystem = {
|
||||
config,
|
||||
pkgs,
|
||||
|
@ -6,8 +6,15 @@
|
|||
...
|
||||
}: let
|
||||
docs = import ../docs {inherit pkgs inputs lib;};
|
||||
buildPkg = maximal:
|
||||
(args.config.flake.lib.nvim.neovimConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [(import ../configuration.nix maximal)];
|
||||
}).neovim;
|
||||
in {
|
||||
packages = {
|
||||
blink-cmp = pkgs.callPackage ./blink {};
|
||||
|
||||
inherit (docs.manual) htmlOpenTool;
|
||||
# Documentation
|
||||
docs = docs.manual.html;
|
||||
|
@ -61,9 +68,9 @@
|
|||
'';
|
||||
|
||||
# Exposed neovim configurations
|
||||
nix = config.legacyPackages.neovim-nix;
|
||||
maximal = config.legacyPackages.neovim-maximal;
|
||||
default = config.legacyPackages.neovim-nix;
|
||||
nix = buildPkg false;
|
||||
maximal = buildPkg true;
|
||||
default = config.packages.nix;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -26,12 +26,22 @@
|
|||
config.vim = {
|
||||
theme.enable = true;
|
||||
|
||||
lsp = {
|
||||
# Enable LSP functionality globally. This is required for modules found
|
||||
# in `vim.languages` to enable relevant LSPs.
|
||||
enable = true;
|
||||
|
||||
# You may define your own LSP configurations using `vim.lsp.servers` in
|
||||
# nvf without ever needing lspconfig to do it. This will use the native
|
||||
# API provided by Neovim > 0.11
|
||||
servers = {};
|
||||
};
|
||||
|
||||
# Language support and automatic configuration of companion plugins.
|
||||
# Note that enabling, e.g., languages.<lang>.diagnostics will automatically
|
||||
# enable top-level options such as enableLSP or enableExtraDiagnostics as
|
||||
# they are needed.
|
||||
languages = {
|
||||
enableLSP = true;
|
||||
enableFormat = true;
|
||||
enableTreesitter = true;
|
||||
enableExtraDiagnostics = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
lib,
|
||||
...
|
||||
}: {
|
||||
types = import ./types {inherit lib;};
|
||||
types = import ./types {inherit lib self;};
|
||||
config = import ./config.nix {inherit lib;};
|
||||
binds = import ./binds.nix {inherit lib;};
|
||||
dag = import ./dag.nix {inherit lib;};
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix
|
||||
{lib}: let
|
||||
inherit (builtins) isString getAttr;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) bool;
|
||||
inherit (lib.types) listOf bool str submodule attrsOf anything either nullOr;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.types) luaInline;
|
||||
in {
|
||||
# TODO: remove
|
||||
diagnosticsToLua = {
|
||||
lang,
|
||||
config,
|
||||
|
@ -32,4 +33,48 @@ in {
|
|||
type = bool;
|
||||
description = "Turn on ${desc} for enabled languages by default";
|
||||
};
|
||||
|
||||
lspOptions = submodule {
|
||||
freeformType = attrsOf anything;
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether to enable this LSP server.";
|
||||
};
|
||||
|
||||
capabilities = mkOption {
|
||||
type = nullOr (either luaInline (attrsOf anything));
|
||||
default = null;
|
||||
description = "LSP capabilitiess to pass to lspconfig";
|
||||
};
|
||||
|
||||
on_attach = mkOption {
|
||||
type = nullOr luaInline;
|
||||
default = null;
|
||||
description = "Function to execute when an LSP server attaches to a buffer";
|
||||
};
|
||||
|
||||
filetypes = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
description = "Filetypes to auto-attach LSP in";
|
||||
};
|
||||
|
||||
cmd = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
description = "Command used to start the LSP server";
|
||||
};
|
||||
|
||||
root_markers = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
description = ''
|
||||
"root markers" used to determine the root directory of the workspace, and
|
||||
the filetypes associated with this LSP server.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{lib}: let
|
||||
{
|
||||
lib,
|
||||
self,
|
||||
}: let
|
||||
typesDag = import ./dag.nix {inherit lib;};
|
||||
typesPlugin = import ./plugins.nix {inherit lib;};
|
||||
typesPlugin = import ./plugins.nix {inherit lib self;};
|
||||
typesLanguage = import ./languages.nix {inherit lib;};
|
||||
customTypes = import ./custom.nix {inherit lib;};
|
||||
in {
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{lib}: let
|
||||
{
|
||||
lib,
|
||||
self,
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.attrsets) attrNames mapAttrs' filterAttrs nameValuePair;
|
||||
inherit (lib.strings) hasPrefix removePrefix;
|
||||
|
@ -12,7 +15,7 @@
|
|||
mapAttrs' (n: v: nameValuePair (removePrefix prefix n) {src = v;}) (filterAttrs (n: _: hasPrefix prefix n) inputs);
|
||||
|
||||
# Get the names of all npins
|
||||
pluginInputNames = attrNames (lib.importJSON ../../npins/sources.json).pins;
|
||||
pluginInputNames = ["blink-cmp"] ++ attrNames self.pins;
|
||||
|
||||
# You can either use the name of the plugin or a package.
|
||||
pluginType = nullOr (
|
||||
|
|
|
@ -104,6 +104,13 @@ in {
|
|||
their behaviour was abstract, and confusing. Please use 'vim.options' or 'vim.luaConfigRC'
|
||||
to replicate previous behaviour.
|
||||
'')
|
||||
|
||||
# 2025-04-04
|
||||
(mkRemovedOptionModule ["vim" "lsp" "lsplines"] ''
|
||||
lsplines module has been removed from nvf, as its functionality is now built into Neovim
|
||||
under the diagnostics module. Please consider using one of 'vim.diagnostics.config' or
|
||||
'vim.luaConfigRC' to configure LSP lines for Neovim through its own diagnostics API.
|
||||
'')
|
||||
]
|
||||
|
||||
# Migrated via batchRenameOptions. Further batch renames must be below this line.
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "Whether to enable this autocommand";
|
||||
description = "Whether to enable this autocommand.";
|
||||
};
|
||||
|
||||
event = mkOption {
|
||||
|
@ -31,7 +31,7 @@
|
|||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
example = ["*.lua" "*.vim"];
|
||||
description = "The file pattern(s) that determine when the autocommand applies).";
|
||||
description = "The file pattern(s) that determine when the autocommand applies.";
|
||||
};
|
||||
|
||||
callback = mkOption {
|
||||
|
@ -44,13 +44,16 @@
|
|||
end
|
||||
''''
|
||||
'';
|
||||
description = "The file pattern(s) that determine when the autocommand applies.";
|
||||
description = "Lua function to be called when the event(s) are triggered.";
|
||||
};
|
||||
|
||||
command = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Vim command string instead of a Lua function.";
|
||||
description = ''
|
||||
Vim command to be executed when the event(s) are triggered.
|
||||
Cannot be defined if the `callback` option is already defined.
|
||||
'';
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
|
@ -70,7 +73,7 @@
|
|||
once = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Whether autocommand run only once.";
|
||||
description = "Whether to run the autocommand only once.";
|
||||
};
|
||||
|
||||
nested = mkOption {
|
||||
|
@ -87,7 +90,7 @@
|
|||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "Whether to enable this autogroup";
|
||||
description = "Whether to enable this autocommand group.";
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
|
@ -118,8 +121,8 @@ in {
|
|||
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.
|
||||
Each autogroup consists of a name and a boolean indicating whether to clear
|
||||
existing autocommands.
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -129,8 +132,8 @@ in {
|
|||
description = ''
|
||||
A list of Neovim autocommands to be registered.
|
||||
|
||||
Each entry defines an autocommand, specifying events, patterns, optional
|
||||
callbacks, commands, groups, and execution settings.
|
||||
Each entry defines an autocommand, specifying events, patterns, a callback or Vim
|
||||
command, an optional group, a description, and execution settings.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
./autocmds.nix
|
||||
./basic.nix
|
||||
./debug.nix
|
||||
./diagnostics.nix
|
||||
./highlight.nix
|
||||
./lsp.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})
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -5,15 +5,14 @@
|
|||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) nullOr attrsOf listOf submodule bool ints str enum;
|
||||
inherit (lib.strings) hasPrefix concatLines;
|
||||
inherit (lib.strings) concatLines;
|
||||
inherit (lib.attrsets) mapAttrsToList;
|
||||
inherit (lib.nvim.dag) entryBetween;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.types) hexColor;
|
||||
|
||||
mkColorOption = target:
|
||||
mkOption {
|
||||
type = nullOr hexColor;
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "#ebdbb2";
|
||||
description = ''
|
||||
|
|
93
modules/neovim/init/lsp.nix
Normal file
93
modules/neovim/init/lsp.nix
Normal file
|
@ -0,0 +1,93 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) filter;
|
||||
inherit (lib.modules) mkIf mkMerge mkDefault;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) attrsOf;
|
||||
inherit (lib.strings) concatLines;
|
||||
inherit (lib.attrsets) mapAttrsToList attrNames filterAttrs;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.languages) lspOptions;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
|
||||
lspConfigurations =
|
||||
mapAttrsToList (
|
||||
name: value: ''
|
||||
vim.lsp.config["${name}"] = ${toLuaObject value}
|
||||
''
|
||||
)
|
||||
cfg.servers;
|
||||
|
||||
enabledServers = filterAttrs (_: u: u.enable) cfg.servers;
|
||||
in {
|
||||
options = {
|
||||
vim.lsp = {
|
||||
enable = mkEnableOption ''
|
||||
global LSP functionality for Neovim.
|
||||
|
||||
This option controls whether to enable LSP functionality within modules under
|
||||
{option}`vim.languages`. You do not need to set this to `true` for language
|
||||
servers defined in {option}`vim.lsp.servers` to take effect, since they are
|
||||
enabled automatically.
|
||||
'';
|
||||
|
||||
servers = mkOption {
|
||||
type = attrsOf lspOptions;
|
||||
default = {};
|
||||
example = ''
|
||||
{
|
||||
"*" = {
|
||||
root_markers = [".git"];
|
||||
capabilities = {
|
||||
textDocument = {
|
||||
semanticTokens = {
|
||||
multilineTokenSupport = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
"clangd" = {
|
||||
filetypes = ["c"];
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
LSP configurations that will be managed using `vim.lsp.config()` and related
|
||||
utilities added in Neovim 0.11. LSPs defined here will be added to the
|
||||
resulting {file}`init.lua` using `vim.lsp.config` and enabled through
|
||||
`vim.lsp.enable()` API from Neovim below the configuration table.
|
||||
|
||||
You may review the generated configuration by running {command}`nvf-print-config`
|
||||
in a shell. Please see {command}`:help lsp-config` for more details
|
||||
on the underlying API.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
{
|
||||
vim.lsp.servers."*" = {
|
||||
capabilities = mkDefault (mkLuaInline "capabilities");
|
||||
on_attach = mkDefault (mkLuaInline "default_on_attach");
|
||||
};
|
||||
}
|
||||
|
||||
(mkIf (cfg.servers != {}) {
|
||||
vim.luaConfigRC.lsp-servers = entryAnywhere ''
|
||||
-- Individual LSP configurations managed by nvf.
|
||||
${concatLines lspConfigurations}
|
||||
|
||||
-- Enable configured LSPs explicitly
|
||||
vim.lsp.enable(${toLuaObject (filter (name: name != "*") (attrNames enabledServers))})
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
|
@ -30,7 +30,16 @@
|
|||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["chatgpt-nvim"];
|
||||
startPlugins = [
|
||||
"chatgpt-nvim"
|
||||
|
||||
# Dependencies
|
||||
"nui-nvim"
|
||||
"plenary-nvim"
|
||||
];
|
||||
|
||||
# ChatGPT.nvim explicitly depends on Telescope.
|
||||
telescope.enable = true;
|
||||
|
||||
pluginRC.chagpt = entryAnywhere ''
|
||||
require("chatgpt").setup(${toLuaObject cfg.setupOpts})
|
||||
|
|
301
modules/plugins/assistant/codecompanion/codecompanion-nvim.nix
Normal file
301
modules/plugins/assistant/codecompanion/codecompanion-nvim.nix
Normal file
|
@ -0,0 +1,301 @@
|
|||
{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 ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable code 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 = ''
|
||||
Whether to enable 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 ""
|
||||
// {
|
||||
default = true;
|
||||
description = "Whether to enable 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 = ''
|
||||
Whether to enable references in the chat buffer.
|
||||
'';
|
||||
};
|
||||
|
||||
show_token_count =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable 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 = ''
|
||||
Whether to enable showing default
|
||||
actions in the action palette.
|
||||
'';
|
||||
};
|
||||
|
||||
show_default_prompt_library =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable 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.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
32
modules/plugins/assistant/codecompanion/config.nix
Normal file
32
modules/plugins/assistant/codecompanion/config.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
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;
|
||||
|
||||
autocomplete.nvim-cmp = {
|
||||
sources = {codecompanion-nvim = "[codecompanion]";};
|
||||
sourcePlugins = ["codecompanion-nvim"];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
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;
|
||||
after = mkIf cfg.cmp.enable "require('copilot_cmp').setup()";
|
||||
|
||||
event = [
|
||||
{
|
||||
event = "User";
|
||||
pattern = "LazyFile";
|
||||
}
|
||||
];
|
||||
cmd = ["Copilot" "CopilotAuth" "CopilotDetach" "CopilotPanel" "CopilotStop"];
|
||||
keys = [
|
||||
(mkLuaKeymap ["n"] cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion" {})
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
imports = [
|
||||
./chatgpt
|
||||
./copilot
|
||||
./codecompanion
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption literalMD;
|
||||
inherit (lib.types) listOf str either attrsOf submodule enum anything int nullOr;
|
||||
inherit (lib.types) bool listOf str either attrsOf submodule enum anything int nullOr;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline pluginType;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
|
@ -21,8 +21,9 @@
|
|||
freeformType = anything;
|
||||
options = {
|
||||
module = mkOption {
|
||||
type = str;
|
||||
description = "module of the provider";
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Provider module.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -40,20 +41,7 @@ in {
|
|||
providers = mkOption {
|
||||
type = attrsOf providerType;
|
||||
default = {};
|
||||
description = "Settings for completion providers";
|
||||
};
|
||||
|
||||
transform_items = mkOption {
|
||||
type = nullOr luaInline;
|
||||
default = mkLuaInline "function(_, items) return items end";
|
||||
defaultText = ''
|
||||
Our default does nothing. If you want blink.cmp's default, which
|
||||
lowers the score for snippets, set this option to null.
|
||||
'';
|
||||
description = ''
|
||||
Function to use when transforming the items before they're returned
|
||||
for all providers.
|
||||
'';
|
||||
description = "Settings for completion providers.";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -63,6 +51,12 @@ in {
|
|||
default = [];
|
||||
description = "List of sources to enable for cmdline. Null means use default source list.";
|
||||
};
|
||||
|
||||
keymap = mkOption {
|
||||
type = keymapType;
|
||||
default = {};
|
||||
description = "blink.cmp cmdline keymap";
|
||||
};
|
||||
};
|
||||
|
||||
completion = {
|
||||
|
@ -74,6 +68,16 @@ in {
|
|||
description = "Delay before auto show triggers";
|
||||
};
|
||||
};
|
||||
|
||||
menu.auto_show = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Manages the appearance of the completion menu. You may prevent the menu
|
||||
from automatically showing by this option to `false` and manually showing
|
||||
it with the show keymap command.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
keymap = mkOption {
|
||||
|
@ -103,7 +107,25 @@ in {
|
|||
fuzzy = {
|
||||
prebuilt_binaries = {
|
||||
download = mkBool false ''
|
||||
Auto-downloads prebuilt binaries. Do not enable, it doesn't work on nix
|
||||
Auto-downloads prebuilt binaries.
|
||||
|
||||
::: .{warning}
|
||||
Do not enable this option, as it does **not work** on Nix!
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
implementation = mkOption {
|
||||
type = enum ["lua" "prefer_rust" "rust" "prefer_rust_with_warning"];
|
||||
default = "prefer_rust";
|
||||
description = ''
|
||||
fuzzy matcher implementation for Blink.
|
||||
|
||||
* `"lua"`: slower, Lua native fuzzy matcher implementation
|
||||
* `"rust": use the SIMD fuzzy matcher, 'frizbee'
|
||||
* `"prefer_rust"`: use the rust implementation, but fall back to lua
|
||||
* `"prefer_rust_with_warning"`: use the rust implementation, and fall back to lua
|
||||
if it is not available after emitting a warning.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
@ -122,12 +144,14 @@ in {
|
|||
sourcePlugins = let
|
||||
sourcePluginType = submodule {
|
||||
options = {
|
||||
enable = mkEnableOption "this source";
|
||||
package = mkOption {
|
||||
type = pluginType;
|
||||
description = ''
|
||||
`blink-cmp` source plugin package.
|
||||
'';
|
||||
};
|
||||
|
||||
module = mkOption {
|
||||
type = str;
|
||||
description = ''
|
||||
|
@ -136,7 +160,6 @@ in {
|
|||
Should be present in the source's documentation.
|
||||
'';
|
||||
};
|
||||
enable = mkEnableOption "this source";
|
||||
};
|
||||
};
|
||||
in
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.attrsets) attrValues filterAttrs;
|
||||
inherit (lib.lists) map optional;
|
||||
inherit (lib.attrsets) attrValues filterAttrs mapAttrsToList;
|
||||
inherit (lib.lists) map optional elem;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
|
||||
|
||||
|
@ -24,7 +24,22 @@
|
|||
|
||||
enabledBlinkSources = filterAttrs (_source: definition: definition.enable) cfg.sourcePlugins;
|
||||
blinkSourcePlugins = map (definition: definition.package) (attrValues enabledBlinkSources);
|
||||
|
||||
blinkBuiltins = [
|
||||
"path"
|
||||
"lsp"
|
||||
"snippets"
|
||||
"buffer"
|
||||
"omni"
|
||||
];
|
||||
in {
|
||||
assertions =
|
||||
mapAttrsToList (provider: definition: {
|
||||
assertion = elem provider blinkBuiltins || definition.module != null;
|
||||
message = "`config.vim.autocomplete.blink-cmp.setupOpts.sources.providers.${provider}.module` is `null`: non-builtin providers must set `module`.";
|
||||
})
|
||||
cfg.setupOpts.sources.providers;
|
||||
|
||||
vim = mkIf cfg.enable {
|
||||
startPlugins = ["blink-compat"] ++ blinkSourcePlugins ++ (optional cfg.friendly-snippets.enable "friendly-snippets");
|
||||
lazy.plugins = {
|
||||
|
|
|
@ -60,12 +60,6 @@ in {
|
|||
enableSharedCmpSources = true;
|
||||
|
||||
nvim-cmp = {
|
||||
sources = {
|
||||
nvim-cmp = null;
|
||||
buffer = "[Buffer]";
|
||||
path = "[Path]";
|
||||
};
|
||||
|
||||
sourcePlugins = ["cmp-buffer" "cmp-path"];
|
||||
|
||||
setupOpts = {
|
||||
|
|
|
@ -98,14 +98,16 @@ in {
|
|||
|
||||
sources = mkOption {
|
||||
type = attrsOf (nullOr str);
|
||||
default = {};
|
||||
default = {
|
||||
nvim-cmp = null;
|
||||
buffer = "[Buffer]";
|
||||
path = "[Path]";
|
||||
};
|
||||
example = {
|
||||
nvim-cmp = null;
|
||||
buffer = "[Buffer]";
|
||||
};
|
||||
description = "The list of sources used by nvim-cmp";
|
||||
example = literalExpression ''
|
||||
{
|
||||
nvim-cmp = null;
|
||||
buffer = "[Buffer]";
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
sourcePlugins = mkOption {
|
||||
|
|
|
@ -3,18 +3,50 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.diagnostics.nvim-lint;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["nvim-lint"];
|
||||
pluginRC.nvim-lint = entryAnywhere ''
|
||||
require("lint").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
config = mkMerge [
|
||||
(mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["nvim-lint"];
|
||||
pluginRC.nvim-lint = entryAnywhere ''
|
||||
require("lint").linters_by_ft = ${toLuaObject cfg.linters_by_ft}
|
||||
|
||||
local linters = require("lint").linters
|
||||
local nvf_linters = ${toLuaObject cfg.linters}
|
||||
for linter, config in pairs(nvf_linters) do
|
||||
if linters[linter] == nil then
|
||||
linters[linter] = config
|
||||
else
|
||||
for key, val in pairs(config) do
|
||||
linters[linter][key] = val
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
nvf_lint = ${toLuaObject cfg.lint_function}
|
||||
'';
|
||||
};
|
||||
})
|
||||
(mkIf (cfg.enable && cfg.lint_after_save) {
|
||||
vim = {
|
||||
augroups = [{name = "nvf_nvim_lint";}];
|
||||
autocmds = [
|
||||
{
|
||||
event = ["BufWritePost"];
|
||||
callback = mkLuaInline ''
|
||||
function(args)
|
||||
nvf_lint(args.buf)
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,27 +1,187 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) attrsOf listOf str;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.diagnostics.nvim-lint = {
|
||||
enable = mkEnableOption "asynchronous linter plugin for Neovim [nvim-lint]";
|
||||
setupOpts = mkPluginSetupOption "nvim-lint" {
|
||||
linters_by_ft = mkOption {
|
||||
type = attrsOf (listOf str);
|
||||
default = {};
|
||||
example = {
|
||||
text = ["vale"];
|
||||
markdown = ["vale"];
|
||||
};
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.types) nullOr attrsOf listOf str either submodule bool enum;
|
||||
inherit (lib.nvim.types) luaInline;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
|
||||
linterType = submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Name of the linter";
|
||||
};
|
||||
|
||||
cmd = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Command of the linter";
|
||||
};
|
||||
|
||||
args = mkOption {
|
||||
type = nullOr (listOf (either str luaInline));
|
||||
default = null;
|
||||
description = "Arguments to pass";
|
||||
};
|
||||
|
||||
stdin = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Send content via stdin.";
|
||||
};
|
||||
|
||||
append_fname = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = ''
|
||||
Map of filetype to formatters. This option takes a set of
|
||||
`key = value` format where the `value` will be converted
|
||||
to its Lua equivalent. You are responsible for passing the
|
||||
correct Nix data types to generate a correct Lua value that
|
||||
conform is able to accept.
|
||||
Automatically add the current file name to the commands arguments. Only
|
||||
has an effect if stdin is false
|
||||
'';
|
||||
};
|
||||
|
||||
stream = mkOption {
|
||||
type = nullOr (enum ["stdout" "stderr" "both"]);
|
||||
default = null;
|
||||
description = "Result stream";
|
||||
};
|
||||
|
||||
ignore_exitcode = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = ''
|
||||
Declares if exit code != 1 should be ignored or result in a warning.
|
||||
'';
|
||||
};
|
||||
|
||||
env = mkOption {
|
||||
type = nullOr (attrsOf str);
|
||||
default = null;
|
||||
description = "Environment variables to use";
|
||||
};
|
||||
|
||||
cwd = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Working directory of the linter";
|
||||
};
|
||||
|
||||
parser = mkOption {
|
||||
type = nullOr luaInline;
|
||||
default = null;
|
||||
description = "Parser function";
|
||||
};
|
||||
|
||||
required_files = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
example = ["eslint.config.js"];
|
||||
description = ''
|
||||
Required files to lint. These files must exist relative to the cwd
|
||||
of the linter or else this linter will be skipped
|
||||
|
||||
::: {.note}
|
||||
This option is an nvf extension that only takes effect if you
|
||||
use the `nvf_lint()` lua function.
|
||||
|
||||
See {option}`vim.diagnostics.nvim-lint.lint_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;};
|
||||
|
||||
lint_function = mkOption {
|
||||
type = luaInline;
|
||||
default = mkLuaInline ''
|
||||
function(buf)
|
||||
local ft = vim.api.nvim_get_option_value("filetype", { buf = buf })
|
||||
local linters = require("lint").linters
|
||||
local linters_from_ft = require("lint").linters_by_ft[ft]
|
||||
|
||||
-- if no linter is configured for this filetype, stops linting
|
||||
if linters_from_ft == nil then return end
|
||||
|
||||
for _, name in ipairs(linters_from_ft) do
|
||||
local linter = linters[name]
|
||||
assert(linter, 'Linter with name `' .. name .. '` not available')
|
||||
|
||||
if type(linter) == "function" then
|
||||
linter = linter()
|
||||
end
|
||||
-- for require("lint").lint() to work, linter.name must be set
|
||||
linter.name = linter.name or name
|
||||
local cwd = linter.required_files
|
||||
|
||||
-- if no configuration files are configured, lint
|
||||
if cwd == nil then
|
||||
require("lint").lint(linter)
|
||||
else
|
||||
-- if configuration files are configured and present in the project, lint
|
||||
for _, fn in ipairs(cwd) do
|
||||
local path = vim.fs.joinpath(linter.cwd or vim.fn.getcwd(), fn);
|
||||
if vim.uv.fs_stat(path) then
|
||||
require("lint").lint(linter)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
'';
|
||||
example = literalExpression ''
|
||||
mkLuaInline '''
|
||||
function(buf)
|
||||
require("lint").try_lint()
|
||||
end
|
||||
'''
|
||||
'';
|
||||
description = "Define the global function nvf_lint which is used by nvf to lint.";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -683,15 +683,48 @@ in {
|
|||
};
|
||||
|
||||
git_placement = mkOption {
|
||||
type = enum ["before" "after" "signcolumn"];
|
||||
description = "Place where the git icons will be rendered. `signcolumn` requires `view.signcolumn` to be enabled.";
|
||||
type = enum ["before" "after" "signcolumn" "right_align"];
|
||||
default = "before";
|
||||
description = ''
|
||||
Place where the git icons will be rendered.
|
||||
`signcolumn` requires `view.signcolumn` to be enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
modified_placement = mkOption {
|
||||
type = enum ["before" "after" "signcolumn"];
|
||||
description = "Place where the modified icons will be rendered. `signcolumn` requires `view.signcolumn` to be enabled.";
|
||||
type = enum ["before" "after" "signcolumn" "right_align"];
|
||||
default = "after";
|
||||
description = ''
|
||||
Place where the modified icons will be rendered.
|
||||
`signcolumn` requires `view.signcolumn` to be enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
hidden_placement = mkOption {
|
||||
type = enum ["before" "after" "signcolumn" "right_align"];
|
||||
default = "after";
|
||||
description = ''
|
||||
Place where the hidden icons will be rendered.
|
||||
`signcolumn` requires `view.signcolumn` to be enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
diagnostics_placement = mkOption {
|
||||
type = enum ["before" "after" "signcolumn" "right_align"];
|
||||
default = "after";
|
||||
description = ''
|
||||
Place where the diagnostics icons will be rendered.
|
||||
`signcolumn` requires `view.signcolumn` to be enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
bookmarks_placement = mkOption {
|
||||
type = enum ["before" "after" "signcolumn" "right_align"];
|
||||
default = "after";
|
||||
description = ''
|
||||
Place where the bookmark icons will be rendered.
|
||||
`signcolumn` requires `view.signcolumn` to be enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
padding = mkOption {
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.types) attrs enum;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
inherit (lib.nvim.lua) mkLuaInline;
|
||||
{lib, ...}: let
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.options) mkOption mkEnableOption literalMD;
|
||||
inherit (lib.types) attrs either nullOr;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.types) luaInline mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.formatter.conform-nvim = {
|
||||
enable = mkEnableOption "lightweight yet powerful formatter plugin for Neovim [conform-nvim]";
|
||||
|
@ -31,26 +28,46 @@ in {
|
|||
};
|
||||
|
||||
format_on_save = mkOption {
|
||||
type = attrs;
|
||||
default = {
|
||||
lsp_format = "fallback";
|
||||
timeout_ms = 500;
|
||||
};
|
||||
type = nullOr (either attrs luaInline);
|
||||
default = mkLuaInline ''
|
||||
function()
|
||||
if not vim.g.formatsave or vim.b.disableFormatSave then
|
||||
return
|
||||
else
|
||||
return {lsp_format = "fallback", timeout_ms = 500}
|
||||
end
|
||||
end
|
||||
'';
|
||||
defaultText = literalMD ''
|
||||
enabled by default, and respects {option}`vim.lsp.formatOnSave` and
|
||||
{option}`vim.lsp.mappings.toggleFormatSave`
|
||||
'';
|
||||
description = ''
|
||||
Table that will be passed to `conform.format()`. If this
|
||||
is set, Conform will run the formatter on save.
|
||||
Attribute set or Lua function that will be passed to
|
||||
`conform.format()`. If this is set, Conform will run the formatter
|
||||
on save.
|
||||
'';
|
||||
};
|
||||
|
||||
format_after_save = mkOption {
|
||||
type = attrs;
|
||||
default = {lsp_format = "fallback";};
|
||||
description = ''
|
||||
Table that will be passed to `conform.format()`. If this
|
||||
is set, Conform will run the formatter asynchronously after
|
||||
save.
|
||||
'';
|
||||
};
|
||||
format_after_save = let
|
||||
defaultFormatAfterSaveOpts = {lsp_format = "fallback";};
|
||||
in
|
||||
mkOption {
|
||||
type = nullOr (either attrs luaInline);
|
||||
default = mkLuaInline ''
|
||||
function()
|
||||
if not vim.g.formatsave or vim.b.disableFormatSave then
|
||||
return
|
||||
else
|
||||
return ${toLuaObject defaultFormatAfterSaveOpts}
|
||||
end
|
||||
end
|
||||
'';
|
||||
description = ''
|
||||
Table or function(luainline) that will be passed to `conform.format()`. If this
|
||||
is set, Conform will run the formatter asynchronously after save.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ in {
|
|||
./gitsigns
|
||||
./vim-fugitive
|
||||
./git-conflict
|
||||
./gitlinker-nvim
|
||||
];
|
||||
|
||||
options.vim.git = {
|
||||
|
@ -15,6 +16,7 @@ in {
|
|||
* gitsigns
|
||||
* vim-fugitive
|
||||
* git-conflict
|
||||
* gitlinker-nvim
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
22
modules/plugins/git/gitlinker-nvim/config.nix
Normal file
22
modules/plugins/git/gitlinker-nvim/config.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.vim.git.gitlinker-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
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
|
||||
inherit (builtins) toJSON;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetExprBinding mkSetLuaBinding pushDownDefault;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
@ -32,6 +33,7 @@ in {
|
|||
return '<Ignore>'
|
||||
end
|
||||
'')
|
||||
|
||||
(mkSetExprBinding gsMappings.previousHunk ''
|
||||
function()
|
||||
if vim.wo.diff then return ${toJSON gsMappings.previousHunk.value} end
|
||||
|
@ -77,13 +79,14 @@ in {
|
|||
}
|
||||
|
||||
(mkIf cfg.codeActions.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.gitsigns-ca = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.code_actions.gitsigns
|
||||
)
|
||||
'';
|
||||
vim.lsp.null-ls = {
|
||||
enable = true;
|
||||
setupOpts.sources = [
|
||||
(mkLuaInline ''
|
||||
require("null-ls").builtins.code_actions.gitsigns
|
||||
'')
|
||||
];
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Assembly LSP support (asm-lsp)" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Assembly LSP support (asm-lsp)" // {default = config.vim.lsp.enable;};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
inherit (lib.lists) isList;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||
|
||||
cfg = config.vim.languages.astro;
|
||||
|
@ -22,7 +22,7 @@
|
|||
package = pkgs.astro-language-server;
|
||||
lspConfig = ''
|
||||
lspconfig.astro.setup {
|
||||
capabilities = capabilities;
|
||||
capabilities = capabilities,
|
||||
on_attach = attach_keymaps,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
|
@ -39,42 +39,35 @@
|
|||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.nodePackages.prettier;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
command = "${cfg.format.package}/bin/prettier",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
package = pkgs.prettierd;
|
||||
};
|
||||
|
||||
biome = {
|
||||
package = pkgs.biome;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.biome.with({
|
||||
command = "${cfg.format.package}/bin/biome",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: specify packages
|
||||
defaultDiagnosticsProvider = ["eslint_d"];
|
||||
diagnosticsProviders = {
|
||||
eslint_d = {
|
||||
package = pkgs.eslint_d;
|
||||
nullConfig = pkg: ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.diagnostics.eslint_d.with({
|
||||
command = "${getExe pkg}",
|
||||
})
|
||||
)
|
||||
'';
|
||||
eslint_d = let
|
||||
pkg = pkgs.eslint_d;
|
||||
in {
|
||||
package = pkg;
|
||||
config = {
|
||||
cmd = getExe pkg;
|
||||
required_files = [
|
||||
"eslint.config.js"
|
||||
"eslint.config.mjs"
|
||||
".eslintrc"
|
||||
".eslintrc.json"
|
||||
".eslintrc.js"
|
||||
".eslintrc.yml"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -88,19 +81,19 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Astro LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Astro LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Astro LSP server to use";
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
description = "Astro LSP server to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Astro LSP server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.astro-language-server "--minify" "--stdio"]'';
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
example = ''[lib.getExe pkgs.astro-language-server "--minify" "--stdio"]'';
|
||||
description = "Astro LSP server package, or the command to run as a list of strings";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -143,16 +136,22 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.astro-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.astro = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||
lang = "astro";
|
||||
config = cfg.extraDiagnostics.types;
|
||||
inherit diagnosticsProviders;
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.astro = cfg.extraDiagnostics.types;
|
||||
linters =
|
||||
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either package listOf str bool;
|
||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
|
||||
|
@ -37,14 +37,6 @@
|
|||
formats = {
|
||||
shfmt = {
|
||||
package = pkgs.shfmt;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.shfmt.with({
|
||||
command = "${pkgs.shfmt}/bin/shfmt",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -52,15 +44,6 @@
|
|||
diagnosticsProviders = {
|
||||
shellcheck = {
|
||||
package = pkgs.shellcheck;
|
||||
nullConfig = pkg: ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.diagnostics.shellcheck.with({
|
||||
command = "${pkg}/bin/shellcheck",
|
||||
diagnostics_format = "#{m} [#{c}]"
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -73,7 +56,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Enable Bash LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Enable Bash LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Bash LSP server to use";
|
||||
|
@ -130,16 +113,23 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.bash-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.sh = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||
lang = "bash";
|
||||
config = cfg.extraDiagnostics.types;
|
||||
inherit diagnosticsProviders;
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.sh = cfg.extraDiagnostics.types;
|
||||
linters = mkMerge (map (name: {
|
||||
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||
})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
@ -98,7 +98,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "clang LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "clang LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "The clang LSP server to use";
|
||||
|
|
|
@ -91,7 +91,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "C# LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "C# LSP support" // {default = config.vim.lsp.enable;};
|
||||
server = mkOption {
|
||||
description = "C# LSP server to use";
|
||||
type = enum (attrNames servers);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
|
@ -42,14 +43,6 @@
|
|||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.nodePackages.prettier;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
command = "${cfg.format.package}/bin/prettier",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
|
@ -87,7 +80,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "CSS LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "CSS LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "CSS LSP server to use";
|
||||
|
@ -132,8 +125,13 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.css-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.css = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
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.lsp.enable;};
|
||||
|
||||
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"},
|
||||
}
|
||||
'';
|
||||
})
|
||||
]);
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
|
||||
cfg = config.vim.languages.dart;
|
||||
ftcfg = cfg.flutter-tools;
|
||||
|
@ -77,20 +77,29 @@ in {
|
|||
flutter-tools = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = config.vim.languages.enableLSP;
|
||||
default = config.vim.lsp.enable;
|
||||
description = "Enable flutter-tools for flutter support";
|
||||
};
|
||||
|
||||
flutterPackage = mkOption {
|
||||
type = nullOr package;
|
||||
default = pkgs.flutter;
|
||||
description = "Flutter package, or null to detect the flutter path at runtime instead.";
|
||||
};
|
||||
|
||||
enableNoResolvePatch = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to patch flutter-tools so that it doesn't resolve
|
||||
symlinks when detecting flutter path.
|
||||
|
||||
This is required if you want to use a flutter package built with nix.
|
||||
If you are using a flutter SDK installed from a different source
|
||||
and encounter the error "`dart` missing from PATH", disable this option.
|
||||
::: {.note}
|
||||
This is required if `flutterPackage` is set to null and the flutter
|
||||
package in your `PATH` was built with Nix. If you are using a flutter
|
||||
SDK installed from a different source and encounter the error "`dart`
|
||||
missing from `PATH`", leave this option disabled.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -122,25 +131,30 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
config.vim = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
treesitter.enable = true;
|
||||
treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
lsp.lspconfig.enable = true;
|
||||
lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
|
||||
(mkIf ftcfg.enable {
|
||||
vim.startPlugins =
|
||||
if ftcfg.enableNoResolvePatch
|
||||
then ["flutter-tools-patched"]
|
||||
else ["flutter-tools-nvim"];
|
||||
startPlugins = [
|
||||
(
|
||||
if ftcfg.enableNoResolvePatch
|
||||
then "flutter-tools-patched"
|
||||
else "flutter-tools-nvim"
|
||||
)
|
||||
"plenary-nvim"
|
||||
];
|
||||
|
||||
vim.pluginRC.flutter-tools = entryAnywhere ''
|
||||
pluginRC.flutter-tools = entryAfter ["lsp-setup"] ''
|
||||
require('flutter-tools').setup {
|
||||
${optionalString (ftcfg.flutterPackage != null) "flutter_path = \"${ftcfg.flutterPackage}/bin/flutter\","}
|
||||
lsp = {
|
||||
color = { -- show the derived colours for dart variables
|
||||
enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
|
||||
|
@ -152,7 +166,6 @@ in {
|
|||
|
||||
capabilities = capabilities,
|
||||
on_attach = default_on_attach;
|
||||
flags = lsp_flags,
|
||||
},
|
||||
${optionalString cfg.dap.enable ''
|
||||
debugger = {
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.nvim.languages) mkEnable;
|
||||
in {
|
||||
imports = [
|
||||
./asm.nix
|
||||
./astro.nix
|
||||
./bash.nix
|
||||
./cue.nix
|
||||
./dart.nix
|
||||
./clang.nix
|
||||
./css.nix
|
||||
./elixir.nix
|
||||
./fsharp.nix
|
||||
./gleam.nix
|
||||
./go.nix
|
||||
./hcl.nix
|
||||
./helm.nix
|
||||
./kotlin.nix
|
||||
./html.nix
|
||||
./haskell.nix
|
||||
|
@ -41,10 +45,13 @@ in {
|
|||
./wgsl.nix
|
||||
./yaml.nix
|
||||
./ruby.nix
|
||||
|
||||
# This is now a hard deprecation.
|
||||
(mkRenamedOptionModule ["vim" "languages" "enableLSP"] ["vim" "lsp" "enable"])
|
||||
];
|
||||
|
||||
options.vim.languages = {
|
||||
enableLSP = mkEnable "LSP";
|
||||
# Those are still managed by plugins, and should be enabled here.
|
||||
enableDAP = mkEnable "Debug Adapter";
|
||||
enableTreesitter = mkEnable "Treesitter";
|
||||
enableFormat = mkEnable "Formatting";
|
||||
|
|
|
@ -38,14 +38,9 @@
|
|||
formats = {
|
||||
mix = {
|
||||
package = pkgs.elixir;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.mix.with({
|
||||
command = "${cfg.format.package}/bin/mix",
|
||||
})
|
||||
)
|
||||
'';
|
||||
config = {
|
||||
command = "${cfg.format.package}/bin/mix";
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -58,7 +53,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Elixir LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Elixir LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Elixir LSP server to use";
|
||||
|
@ -107,8 +102,12 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.elixir-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.elixir = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} =
|
||||
formats.${cfg.format.type}.config;
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.elixir-tools.enable {
|
||||
|
|
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.lsp.enable;};
|
||||
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;
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
|
@ -41,7 +41,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Gleam LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Gleam LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
type = enum (attrNames servers);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.options) mkEnableOption mkOption literalMD;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.lists) isList;
|
||||
|
@ -38,36 +38,15 @@
|
|||
formats = {
|
||||
gofmt = {
|
||||
package = pkgs.go;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.gofmt.with({
|
||||
command = "${cfg.format.package}/bin/gofmt",
|
||||
})
|
||||
)
|
||||
'';
|
||||
config.command = "${cfg.format.package}/bin/gofmt";
|
||||
};
|
||||
gofumpt = {
|
||||
package = pkgs.gofumpt;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.gofumpt.with({
|
||||
command = "${cfg.format.package}/bin/gofumpt",
|
||||
})
|
||||
)
|
||||
'';
|
||||
config.command = getExe cfg.format.package;
|
||||
};
|
||||
golines = {
|
||||
package = pkgs.golines;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.golines.with({
|
||||
command = "${cfg.format.package}/bin/golines",
|
||||
})
|
||||
)
|
||||
'';
|
||||
config.command = "${cfg.format.package}/bin/golines";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -88,7 +67,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Go LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Go LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Go LSP server to use";
|
||||
|
@ -105,7 +84,14 @@ in {
|
|||
};
|
||||
|
||||
format = {
|
||||
enable = mkEnableOption "Go formatting" // {default = config.vim.languages.enableFormat;};
|
||||
enable =
|
||||
mkEnableOption "Go formatting"
|
||||
// {
|
||||
default = !cfg.lsp.enable && config.vim.languages.enableFormat;
|
||||
defaultText = literalMD ''
|
||||
disabled if Go LSP is enabled, otherwise follows {option}`vim.languages.enableFormat`
|
||||
'';
|
||||
};
|
||||
|
||||
type = mkOption {
|
||||
description = "Go formatter to use";
|
||||
|
@ -153,8 +139,11 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.go-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.go = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.dap.enable {
|
||||
|
|
|
@ -25,7 +25,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "LSP support for Haskell" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "LSP support for Haskell" // {default = config.vim.lsp.enable;};
|
||||
package = mkOption {
|
||||
description = "Haskell LSP package or command to run the Haskell LSP";
|
||||
example = ''[ (lib.getExe pkgs.haskellPackages.haskell-language-server) "--debug" ]'';
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) package bool enum;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
@ -30,14 +31,6 @@
|
|||
formats = {
|
||||
hclfmt = {
|
||||
package = pkgs.hclfmt;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.hclfmt.with({
|
||||
command = "${lib.getExe cfg.format.package}",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -50,7 +43,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "HCL LSP support (terraform-ls)" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "HCL LSP support (terraform-ls)" // {default = config.vim.lsp.enable;};
|
||||
# TODO: (maybe, is it better?) it would be cooler to use vscode-extensions.hashicorp.hcl probably, shouldn't be too hard
|
||||
package = mkOption {
|
||||
type = package;
|
||||
|
@ -110,8 +103,13 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.hcl-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.hcl = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
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.lsp.enable;};
|
||||
|
||||
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];
|
||||
}
|
||||
]);
|
||||
}
|
|
@ -23,7 +23,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Java LSP support (java-language-server)" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Java LSP support (java-language-server)" // {default = config.vim.lsp.enable;};
|
||||
package = mkOption {
|
||||
description = "java language server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
|
||||
|
|
|
@ -78,7 +78,7 @@ in {
|
|||
lsp = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = config.vim.languages.enableLSP;
|
||||
default = config.vim.lsp.enable;
|
||||
description = ''
|
||||
Whether to enable Julia LSP support.
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||
inherit (lib.types) either package listOf str;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||
inherit (lib.lists) isList;
|
||||
|
@ -19,14 +18,6 @@
|
|||
diagnosticsProviders = {
|
||||
ktlint = {
|
||||
package = pkgs.ktlint;
|
||||
nullConfig = pkg: ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.diagnostics.ktlint.with({
|
||||
command = "${getExe pkg}",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -39,7 +30,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Kotlin LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Kotlin LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
package = mkOption {
|
||||
description = "kotlin_language_server package with Kotlin runtime";
|
||||
|
@ -76,11 +67,13 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||
lang = "kotlin";
|
||||
config = cfg.extraDiagnostics.types;
|
||||
inherit diagnosticsProviders;
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.kotlin = cfg.extraDiagnostics.types;
|
||||
linters = mkMerge (map (name: {
|
||||
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||
})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
@ -4,16 +4,30 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) either listOf package str;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.types) bool either enum listOf package str;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.dag) entryBefore;
|
||||
|
||||
cfg = config.vim.languages.lua;
|
||||
defaultFormat = "stylua";
|
||||
formats = {
|
||||
stylua = {
|
||||
package = pkgs.stylua;
|
||||
};
|
||||
};
|
||||
|
||||
defaultDiagnosticsProvider = ["luacheck"];
|
||||
diagnosticsProviders = {
|
||||
luacheck = {
|
||||
package = pkgs.luajitPackages.luacheck;
|
||||
};
|
||||
};
|
||||
in {
|
||||
imports = [
|
||||
(lib.mkRemovedOptionModule ["vim" "languages" "lua" "lsp" "neodev"] ''
|
||||
|
@ -29,7 +43,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Lua LSP support via LuaLS" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Lua LSP support via LuaLS" // {default = config.vim.lsp.enable;};
|
||||
|
||||
package = mkOption {
|
||||
description = "LuaLS package, or the command to run as a list of strings";
|
||||
|
@ -39,6 +53,34 @@ in {
|
|||
|
||||
lazydev.enable = mkEnableOption "lazydev.nvim integration, useful for neovim plugin developers";
|
||||
};
|
||||
|
||||
format = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = config.vim.languages.enableFormat;
|
||||
description = "Enable Lua formatting";
|
||||
};
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
description = "Lua formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "Lua formatter package";
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
enable = mkEnableOption "extra Lua diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||
types = diagnostics {
|
||||
langDesc = "Lua";
|
||||
inherit diagnosticsProviders;
|
||||
inherit defaultDiagnosticsProvider;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
|
@ -74,6 +116,27 @@ in {
|
|||
})
|
||||
'';
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.lua = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.lua = cfg.extraDiagnostics.types;
|
||||
linters = mkMerge (map (name: {
|
||||
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||
})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]))
|
||||
];
|
||||
}
|
||||
|
|
|
@ -5,12 +5,13 @@
|
|||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.lists) isList concatLists;
|
||||
inherit (lib.types) bool enum either package listOf str;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) bool enum either package listOf str nullOr;
|
||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption mkPluginSetupOption;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.languages.markdown;
|
||||
|
@ -32,31 +33,23 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "denofmt";
|
||||
defaultFormat = "deno_fmt";
|
||||
formats = {
|
||||
# for backwards compatibility
|
||||
denofmt = {
|
||||
package = pkgs.deno;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.deno_fmt.with({
|
||||
filetypes = ${expToLua (concatLists [cfg.format.extraFiletypes ["markdown"]])},
|
||||
command = "${cfg.format.package}/bin/deno",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
deno_fmt = {
|
||||
package = pkgs.deno;
|
||||
};
|
||||
prettierd = {
|
||||
package = pkgs.prettierd;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.prettierd.with({
|
||||
filetypes = ${expToLua (concatLists [cfg.format.extraFiletypes ["markdown"]])},
|
||||
command = "${cfg.format.package}/bin/prettierd",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
defaultDiagnosticsProvider = ["markdownlint-cli2"];
|
||||
diagnosticsProviders = {
|
||||
markdownlint-cli2 = {
|
||||
package = pkgs.markdownlint-cli2;
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -74,7 +67,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Enable Markdown LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Enable Markdown LSP support" // {default = config.vim.lsp.enable;};
|
||||
|
||||
server = mkOption {
|
||||
type = enum (attrNames servers);
|
||||
|
@ -96,7 +89,7 @@ in {
|
|||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
description = "Markdown formatter to use";
|
||||
description = "Markdown formatter to use. `denofmt` is deprecated and currently aliased to deno_fmt.";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
|
@ -121,15 +114,19 @@ in {
|
|||
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
|
||||
|
||||
Inline Markdown rendering with [render-markdown.nvim]
|
||||
|
||||
'';
|
||||
};
|
||||
|
||||
setupOpts = mkPluginSetupOption "render-markdown" {
|
||||
auto_override_publish_diagnostics = mkOption {
|
||||
description = "Automatically override the publish_diagnostics handler";
|
||||
type = bool;
|
||||
default = true;
|
||||
file_types = lib.mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
description = ''
|
||||
List of buffer filetypes to enable this plugin in.
|
||||
|
||||
This will cause the plugin to attach to new buffers who
|
||||
have any of these filetypes.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -146,6 +143,15 @@ in {
|
|||
setupOpts = mkPluginSetupOption "markview-nvim" {};
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
enable = mkEnableOption "extra Markdown diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||
types = diagnostics {
|
||||
langDesc = "Markdown";
|
||||
inherit diagnosticsProviders;
|
||||
inherit defaultDiagnosticsProvider;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
|
@ -160,8 +166,17 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.markdown-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.markdown = [cfg.format.type];
|
||||
setupOpts.formatters.${
|
||||
if cfg.format.type == "denofmt"
|
||||
then "deno_fmt"
|
||||
else cfg.format.type
|
||||
} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
# Extensions
|
||||
|
@ -178,5 +193,16 @@ in {
|
|||
require("markview").setup(${toLuaObject cfg.extensions.markview-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
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
|
@ -38,14 +39,9 @@
|
|||
formats = {
|
||||
nimpretty = {
|
||||
package = pkgs.nim;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.nimpretty.with({
|
||||
command = "${pkgs.nim}/bin/nimpretty",
|
||||
})
|
||||
)
|
||||
'';
|
||||
config = {
|
||||
command = "${cfg.format.package}/bin/nimpretty";
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -58,7 +54,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Nim LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Nim LSP support" // {default = config.vim.lsp.enable;};
|
||||
server = mkOption {
|
||||
description = "Nim LSP server to use";
|
||||
type = str;
|
||||
|
@ -110,8 +106,11 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.nim-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.nim = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) concatStringsSep;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
|
@ -13,7 +15,6 @@
|
|||
inherit (lib.types) anything attrsOf enum either listOf nullOr package str;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||
|
||||
cfg = config.vim.languages.nix;
|
||||
|
||||
|
@ -27,7 +28,7 @@
|
|||
else ''{"${package}/bin/${defaultCmd}"}'';
|
||||
servers = {
|
||||
nil = {
|
||||
package = pkgs.nil;
|
||||
package = inputs.nil.packages.${pkgs.stdenv.system}.nil;
|
||||
internalFormatter = true;
|
||||
lspConfig = ''
|
||||
lspconfig.nil_ls.setup{
|
||||
|
@ -100,26 +101,10 @@
|
|||
formats = {
|
||||
alejandra = {
|
||||
package = pkgs.alejandra;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.alejandra.with({
|
||||
command = "${cfg.format.package}/bin/alejandra"
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
nixfmt = {
|
||||
package = pkgs.nixfmt-rfc-style;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.nixfmt.with({
|
||||
command = "${cfg.format.package}/bin/nixfmt"
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -159,7 +144,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Nix LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Nix LSP support" // {default = config.vim.lsp.enable;};
|
||||
server = mkOption {
|
||||
description = "Nix LSP server to use";
|
||||
type = enum (attrNames servers);
|
||||
|
@ -237,17 +222,24 @@ in {
|
|||
vim.lsp.lspconfig.sources.nix-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
|
||||
(mkIf (cfg.format.enable && !servers.${cfg.lsp.server}.internalFormatter) {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.nix-format = formats.${cfg.format.type}.nullConfig;
|
||||
(mkIf (cfg.format.enable && (!cfg.lsp.enable || !servers.${cfg.lsp.server}.internalFormatter)) {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.nix = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
||||
lang = "nix";
|
||||
config = cfg.extraDiagnostics.types;
|
||||
inherit diagnosticsProviders;
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.nix = cfg.extraDiagnostics.types;
|
||||
linters = mkMerge (map (name: {
|
||||
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||
})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
@ -40,7 +40,7 @@ in {
|
|||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Nu LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
enable = mkEnableOption "Nu LSP support" // {default = config.vim.lsp.enable;};
|
||||
server = mkOption {
|
||||
type = str;
|
||||
default = defaultServer;
|
||||
|
|
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