mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-12-14 08:01:02 +00:00
Merge branch 'main' into telescope-ext
This commit is contained in:
commit
062ae94787
92 changed files with 2970 additions and 1102 deletions
|
|
@ -14,7 +14,7 @@ indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
[*.{js,json,nix,yml,yaml}]
|
[*.{js,json,nix,yml,yaml,toml}]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
tab_width = 2
|
tab_width = 2
|
||||||
|
|
|
||||||
6
.github/CODEOWNERS
vendored
6
.github/CODEOWNERS
vendored
|
|
@ -1 +1,5 @@
|
||||||
* @NotAShelf
|
# Codeowners should be used to distinguish the maintainers of the project
|
||||||
|
# and not contributors of specific modules to nvf. While adding a new module
|
||||||
|
# please consider adding yourself to 'meta.maintainers' in the module instead
|
||||||
|
# of CODEOWNERS here.
|
||||||
|
* @NotAShelf @horriblename @Soliprem
|
||||||
|
|
|
||||||
22
.github/README.md
vendored
22
.github/README.md
vendored
|
|
@ -237,7 +237,7 @@ customizability of plugin inputs, which is one of our primary features.
|
||||||
an imperative path (e.g., `~/.config/nvim`) for my Neovim configuration instead
|
an imperative path (e.g., `~/.config/nvim`) for my Neovim configuration instead
|
||||||
of a configuration generated from Nix?
|
of a configuration generated from Nix?
|
||||||
|
|
||||||
**A**: Yes! Add `"~/.config.nvim"` to `vim.additionalRuntimePaths = [ ... ]` and
|
**A**: Yes! Add `"~/.config/nvim"` to `vim.additionalRuntimePaths = [ ... ]` and
|
||||||
any plugins you want to load to `vim.startPlugins`. This will load your
|
any plugins you want to load to `vim.startPlugins`. This will load your
|
||||||
configuration from `~/.config/nvim`. You may still use `vim.*` to modify
|
configuration from `~/.config/nvim`. You may still use `vim.*` to modify
|
||||||
Neovim's behaviour with Nix.
|
Neovim's behaviour with Nix.
|
||||||
|
|
@ -246,14 +246,15 @@ Neovim's behaviour with Nix.
|
||||||
|
|
||||||
### Co-Maintainers
|
### Co-Maintainers
|
||||||
|
|
||||||
Alongside myself, nvf is developed by those talented folk:
|
Alongside [myself](https://github.com/notashelf), nvf is developed by those
|
||||||
|
talented folk. nvf would not be what it is today without their invaluable
|
||||||
|
contributions.
|
||||||
|
|
||||||
- [**@horriblename**](https://github.com/horriblename)
|
- [**@horriblename**](https://github.com/horriblename)
|
||||||
([Liberapay](https://liberapay.com/horriblename/))- For actively implementing
|
([Liberapay](https://liberapay.com/horriblename/))- For actively implementing
|
||||||
planned features and quality of life updates.
|
planned features and quality of life updates.
|
||||||
- [**@Diniamo**](https://github.com/Diniamo)
|
- [**@Soliprem**](https://github.com/soliprem) - For rigorously implementing
|
||||||
([Liberapay](https://en.liberapay.com/diniamo/)) - For actively submitting
|
missing features and excellent work on new language modules.
|
||||||
pull requests, issues and assistance with maintenance of nvf.
|
|
||||||
|
|
||||||
Please do remember to extend your thanks (financially or otherwise) if this
|
Please do remember to extend your thanks (financially or otherwise) if this
|
||||||
project has been helpful to you.
|
project has been helpful to you.
|
||||||
|
|
@ -270,14 +271,14 @@ heart-felt thanks to
|
||||||
- [**@FlafyDev**](https://github.com/FlafyDev) - For getting Home-Manager module
|
- [**@FlafyDev**](https://github.com/FlafyDev) - For getting Home-Manager module
|
||||||
to work and Nix assistance.
|
to work and Nix assistance.
|
||||||
- [**@n3oney**](https://github.com/n3oney) - For making custom keybinds finally
|
- [**@n3oney**](https://github.com/n3oney) - For making custom keybinds finally
|
||||||
possible, and other module additions.
|
possible, great ideas and module additions.
|
||||||
- [**@Yavko**](https://github.com/Yavko) - For the amazing **nvf** logo
|
- [**@Yavko**](https://github.com/Yavko) - For the amazing **nvf** logo
|
||||||
- [**@FrothyMarrow**](https://github.com/FrothyMarrow) - For seeing mistakes
|
- [**@FrothyMarrow**](https://github.com/FrothyMarrow) - For seeing mistakes
|
||||||
that I could not.
|
that I could not and contributing good ideas & code.
|
||||||
- [**@Gerg-l**](https://github.com/gerg-l) 🐸 - For the modern Neovim wrapper,
|
- [**@Gerg-l**](https://github.com/gerg-l) 🐸 - For the modern Neovim wrapper,
|
||||||
[mnw], and occasional code improvements.
|
[mnw], and occasional improvements to the codebase.
|
||||||
- [**@Soliprem**](https://github.com/soliprem) - Rigorously implementing missing
|
- [**@Diniamo**](https://github.com/Diniamo) - For actively submitting pull
|
||||||
features and excellent work on new language modules.
|
requests, issues and assistance with co-maintenance of nvf.
|
||||||
|
|
||||||
and everyone who has submitted issues or pull requests!
|
and everyone who has submitted issues or pull requests!
|
||||||
|
|
||||||
|
|
@ -301,7 +302,6 @@ including:
|
||||||
|
|
||||||
I am grateful for their previous work and inspiration, and I wholeheartedly
|
I am grateful for their previous work and inspiration, and I wholeheartedly
|
||||||
recommend checking their work out.
|
recommend checking their work out.
|
||||||
<br/>
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
||||||
11
.github/typos.toml
vendored
11
.github/typos.toml
vendored
|
|
@ -1,5 +1,10 @@
|
||||||
|
|
||||||
default.extend-ignore-words-re = ["(?i)(noice)", "befores", "annote", "viw"]
|
files.extend-exclude = ["npins/sources.json"]
|
||||||
files.extend-exclude = [
|
default.extend-ignore-words-re = [
|
||||||
"npins/sources.json"
|
"(?i)(noice)",
|
||||||
|
"befores",
|
||||||
|
"annote",
|
||||||
|
"viw",
|
||||||
|
"BA", # somehow "BANanaD3V" is valid, but BA is not...
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
2
.github/workflows/cachix.yml
vendored
2
.github/workflows/cachix.yml
vendored
|
|
@ -36,7 +36,7 @@ jobs:
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
- uses: cachix/cachix-action@v15
|
- uses: cachix/cachix-action@v16
|
||||||
with:
|
with:
|
||||||
authToken: ${{ secrets.CACHIX_TOKEN }}
|
authToken: ${{ secrets.CACHIX_TOKEN }}
|
||||||
extraPullNames: nix-community
|
extraPullNames: nix-community
|
||||||
|
|
|
||||||
56
.github/workflows/check-docs.yml
vendored
56
.github/workflows/check-docs.yml
vendored
|
|
@ -1,56 +0,0 @@
|
||||||
name: "Validate flake & check documentation"
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- docs/**
|
|
||||||
jobs:
|
|
||||||
flake-docs-check:
|
|
||||||
name: Validate Flake Documentation
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
package:
|
|
||||||
- docs
|
|
||||||
- docs-html
|
|
||||||
- docs-manpages
|
|
||||||
- docs-json
|
|
||||||
steps:
|
|
||||||
- name: Install Nix
|
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
|
||||||
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set default git branch (to reduce log spam)
|
|
||||||
run: git config --global init.defaultBranch main
|
|
||||||
|
|
||||||
- name: Build documentation packages
|
|
||||||
run: nix build .#${{ matrix.package }} --print-build-logs
|
|
||||||
|
|
||||||
- name: Get current date
|
|
||||||
id: get-date
|
|
||||||
# output format: 2023-12-22-120000
|
|
||||||
run: echo "date=$(date +'%Y-%m-%d-%H%M%S')" >> ${GITHUB_OUTPUT}
|
|
||||||
|
|
||||||
- name: Upload doc artifacts
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: "${{ matrix.package }}"
|
|
||||||
path: result/share/doc/nvf
|
|
||||||
|
|
||||||
flake-docs-linkcheck:
|
|
||||||
name: Validate hyperlinks in documentation sources
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Install Nix
|
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
|
||||||
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Build documentation packages
|
|
||||||
run: nix build .#docs-linkcheck -Lv
|
|
||||||
127
.github/workflows/check.yml
vendored
127
.github/workflows/check.yml
vendored
|
|
@ -1,4 +1,6 @@
|
||||||
name: "Validate flake & check formatting"
|
name: "Treewide Checks"
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
@ -6,13 +8,13 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- .github/**
|
|
||||||
- assets/**
|
- assets/**
|
||||||
- .gitignore
|
|
||||||
jobs:
|
jobs:
|
||||||
nix-flake-check:
|
nix-flake-check:
|
||||||
name: Validate Flake
|
name: "Validate flake"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -24,8 +26,9 @@ jobs:
|
||||||
run: nix flake check
|
run: nix flake check
|
||||||
|
|
||||||
format-with-alejandra:
|
format-with-alejandra:
|
||||||
name: Formatting via Alejandra
|
name: "Check formatting"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -33,4 +36,116 @@ jobs:
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
- run: nix run nixpkgs#alejandra -- -c .
|
- name: Check formatting via Alejandra
|
||||||
|
run: nix run nixpkgs#alejandra -- -c .
|
||||||
|
|
||||||
|
check-typos:
|
||||||
|
name: "Check source tree for typos"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Check for typos
|
||||||
|
uses: crate-ci/typos@master
|
||||||
|
with:
|
||||||
|
config: .github/typos.toml
|
||||||
|
|
||||||
|
- if: ${{ failure() }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "::error:: Current codebase contains typos that were caught by the CI!"
|
||||||
|
echo "If those typos were intentional, please add them to the ignored regexes in .github/typos.toml"
|
||||||
|
echo "[skip ci] label may be added to the PR title if this is a one-time issue and is safe to ignore"
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
flake-docs-check:
|
||||||
|
name: "Validate documentation builds"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
package:
|
||||||
|
- docs
|
||||||
|
- docs-html
|
||||||
|
- docs-manpages
|
||||||
|
- docs-json
|
||||||
|
steps:
|
||||||
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set default git branch (to reduce log spam)
|
||||||
|
run: git config --global init.defaultBranch main
|
||||||
|
|
||||||
|
- name: Build documentation packages
|
||||||
|
run: nix build .#${{ matrix.package }} --print-build-logs
|
||||||
|
|
||||||
|
- name: Get current date
|
||||||
|
id: get-date
|
||||||
|
# output format: 2023-12-22-120000
|
||||||
|
run: echo "date=$(date +'%Y-%m-%d-%H%M%S')" >> ${GITHUB_OUTPUT}
|
||||||
|
|
||||||
|
- name: Upload doc artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: "${{ matrix.package }}"
|
||||||
|
path: result/share/doc/nvf
|
||||||
|
|
||||||
|
flake-docs-linkcheck:
|
||||||
|
name: "Validate hyperlinks in documentation sources"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
|
steps:
|
||||||
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build linkcheck package
|
||||||
|
run: nix build .#docs-linkcheck -Lv
|
||||||
|
|
||||||
|
check-editorconfig:
|
||||||
|
name: "Validate Editorconfig conformance"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
|
steps:
|
||||||
|
- name: Get list of changed files from PR
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
gh api \
|
||||||
|
repos/${{ github.repository }}/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: $?"
|
||||||
|
|
||||||
|
- if: ${{ failure() }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "::error:: Current formatting does not fit convention provided by .editorconfig located in the project root."
|
||||||
|
echo "Please make sure your editor properly integrates editorconfig, Neovim does so by default."
|
||||||
|
echo "See https://editorconfig.org/#download on how to integrate Editorconfig to your editor."
|
||||||
|
exit 1
|
||||||
|
|
|
||||||
8
.github/workflows/cleanup.yml
vendored
8
.github/workflows/cleanup.yml
vendored
|
|
@ -1,9 +1,13 @@
|
||||||
name: Cleanup
|
name: Delete Stale Branches
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 4 1 * *" # 4AM on 1st of every month
|
- cron: "0 4 1 * *" # 4AM on 1st of every month
|
||||||
- cron: "0 4 15 * *" # 4AM on the 15th of every month
|
- cron: "0 4 15 * *" # 4AM on the 15th of every month
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
branches:
|
branches:
|
||||||
name: Cleanup old branches
|
name: Cleanup old branches
|
||||||
|
|
@ -13,7 +17,7 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: "Delete old branches"
|
- name: "Delete old branches"
|
||||||
uses: beatlabs/delete-old-branches-action@v0.0.10
|
uses: beatlabs/delete-old-branches-action@v0.0.11
|
||||||
with:
|
with:
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
date: "1 months ago"
|
date: "1 months ago"
|
||||||
|
|
|
||||||
4
.github/workflows/docs-preview.yml
vendored
4
.github/workflows/docs-preview.yml
vendored
|
|
@ -9,7 +9,7 @@ on:
|
||||||
- "modules/**"
|
- "modules/**"
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
|
|
||||||
# Defining permissions here passes it to all workflows.
|
# Defining permissions here passes it to all jobs.
|
||||||
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
|
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
@ -34,7 +34,7 @@ jobs:
|
||||||
run: git config --global init.defaultBranch main
|
run: git config --global init.defaultBranch main
|
||||||
|
|
||||||
- name: Build documentation packages
|
- name: Build documentation packages
|
||||||
run: nix build .#docs-html --print-build-logs
|
run: nix build .#docs-html --print-build-logs || exit 1
|
||||||
|
|
||||||
- name: Deploy to GitHub Pages preview
|
- name: Deploy to GitHub Pages preview
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
46
.github/workflows/editorconfig.yml
vendored
46
.github/workflows/editorconfig.yml
vendored
|
|
@ -1,46 +0,0 @@
|
||||||
name: "Check validity of .editorconfig"
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check-editorconfig:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
|
||||||
steps:
|
|
||||||
- name: Get list of changed files from PR
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
gh api \
|
|
||||||
repos/notashelf/nvf/pulls/${{github.event.number}}/files --paginate \
|
|
||||||
| jq '.[] | select(.status != "removed") | .filename' \
|
|
||||||
> "$HOME/changed_files"
|
|
||||||
|
|
||||||
- name: Print list of changed files
|
|
||||||
run: |
|
|
||||||
cat "$HOME/changed_files"
|
|
||||||
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
|
||||||
|
|
||||||
- name: Install Nix
|
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
|
||||||
|
|
||||||
- name: Checking EditorConfig
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
cat "$HOME/changed_files" | nix-shell -p editorconfig-checker.out --run 'xargs -r editorconfig-checker -disable-indentation -exclude flake.lock --verbose'
|
|
||||||
echo -n "Check status: $?"
|
|
||||||
|
|
||||||
- name: Fail Gracefully
|
|
||||||
if: ${{ failure() }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "::error:: Current formatting does not fit convention provided by .editorconfig located in the project root."
|
|
||||||
echo "Please make sure your editor properly integrates editorconfig. See https://editorconfig.org/#download for more."
|
|
||||||
exit 1
|
|
||||||
30
.github/workflows/typos.yml
vendored
30
.github/workflows/typos.yml
vendored
|
|
@ -1,30 +0,0 @@
|
||||||
name: "Check for typos in the source tree"
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check-typos:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Check for typos
|
|
||||||
uses: crate-ci/typos@master
|
|
||||||
with:
|
|
||||||
config: .github/typos.toml
|
|
||||||
|
|
||||||
- name: Fail Gracefully
|
|
||||||
if: ${{ failure() }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "::error:: Current codebase contains typos that were caught by the CI!"
|
|
||||||
echo "If those typos were intentional, please add them to the ignored regexes in .github/typos.toml"
|
|
||||||
echo "[skip ci] label may be used if this is a one-time issue"
|
|
||||||
exit 1
|
|
||||||
|
|
@ -173,17 +173,18 @@ isMaximal: {
|
||||||
utility = {
|
utility = {
|
||||||
ccc.enable = false;
|
ccc.enable = false;
|
||||||
vim-wakatime.enable = false;
|
vim-wakatime.enable = false;
|
||||||
icon-picker.enable = isMaximal;
|
|
||||||
surround.enable = isMaximal;
|
|
||||||
diffview-nvim.enable = true;
|
diffview-nvim.enable = true;
|
||||||
yanky-nvim.enable = false;
|
yanky-nvim.enable = false;
|
||||||
|
icon-picker.enable = isMaximal;
|
||||||
|
surround.enable = isMaximal;
|
||||||
leetcode-nvim.enable = isMaximal;
|
leetcode-nvim.enable = isMaximal;
|
||||||
|
multicursors.enable = isMaximal;
|
||||||
|
|
||||||
motion = {
|
motion = {
|
||||||
hop.enable = true;
|
hop.enable = true;
|
||||||
leap.enable = true;
|
leap.enable = true;
|
||||||
precognition.enable = isMaximal;
|
precognition.enable = isMaximal;
|
||||||
};
|
};
|
||||||
|
|
||||||
images = {
|
images = {
|
||||||
image-nvim.enable = false;
|
image-nvim.enable = false;
|
||||||
};
|
};
|
||||||
|
|
@ -233,6 +234,7 @@ isMaximal: {
|
||||||
enable = false;
|
enable = false;
|
||||||
cmp.enable = isMaximal;
|
cmp.enable = isMaximal;
|
||||||
};
|
};
|
||||||
|
codecompanion-nvim.enable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
session = {
|
session = {
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,6 @@
|
||||||
inherit (nvimModuleDocs) optionsJSON;
|
inherit (nvimModuleDocs) optionsJSON;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
inherit (inputs) nmd;
|
|
||||||
|
|
||||||
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
|
# TODO: Use `hmOptionsDocs.optionsJSON` directly once upstream
|
||||||
# `nixosOptionsDoc` is more customizable.
|
# `nixosOptionsDoc` is more customizable.
|
||||||
options.json =
|
options.json =
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ of individual sections of configuration as needed. nvf provides helper functions
|
||||||
in the extended library, usually under `inputs.nvf.lib.nvim.dag` that you may
|
in the extended library, usually under `inputs.nvf.lib.nvim.dag` that you may
|
||||||
use.
|
use.
|
||||||
|
|
||||||
Please refer to the [DAG section](/index.xhtml#ch-dag-entries) in the nvf manual
|
Please refer to the [DAG section](#ch-dag-entries) in the nvf manual
|
||||||
to find out more about the DAG system.
|
to find out more about the DAG system.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,3 +38,22 @@ As of version **0.7**, we exposed an API for configuring lazy-loaded plugins via
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## LazyFile event {#sec-lazyfile-event}
|
||||||
|
|
||||||
|
You can use the `LazyFile` user event to load a plugin when a file is opened:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
config.vim.lazy.plugins = {
|
||||||
|
"aerial.nvim" = {
|
||||||
|
package = pkgs.vimPlugins.aerial-nvim;
|
||||||
|
event = [{event = "User"; pattern = "LazyFile";}];
|
||||||
|
# ...
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can consider `LazyFile` as an alias to
|
||||||
|
`["BufReadPost" "BufNewFile" "BufWritePre"]`
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ options will include useful comments, warnings or setup tips on how a module
|
||||||
option is meant to be used as well as examples in complex cases.
|
option is meant to be used as well as examples in complex cases.
|
||||||
|
|
||||||
An offline version of this page is bundled with nvf as a part of the manpages
|
An offline version of this page is bundled with nvf as a part of the manpages
|
||||||
which you can access with `man 5 nvf`. Please us know if you believe any of the
|
which you can access with `man 5 nvf`. Please let us know if you believe any of
|
||||||
options below are missing useful examples.
|
the options below are missing useful examples.
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
In the manual, individual options may be referenced in Hyperlinks as follows:
|
In the manual, individual options may be referenced in Hyperlinks as follows:
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,26 @@
|
||||||
# Release 0.8 {#sec-release-0.8}
|
# Release 0.8 {#sec-release-0.8}
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
[NotAShelf](https://github.com/notashelf):
|
[NotAShelf](https://github.com/notashelf):
|
||||||
|
|
||||||
[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
|
[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
|
||||||
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
|
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
|
||||||
[yanky.nvim]: https://github.com/gbprod/yanky.nvim
|
[yanky.nvim]: https://github.com/gbprod/yanky.nvim
|
||||||
|
[yazi.nvim]: https://github.com/mikavilpas/yazi.nvim
|
||||||
|
[snacks.nvim]: https://github.com/folke/snacks.nvim
|
||||||
|
|
||||||
- Add [typst-preview.nvim] under
|
- Add [typst-preview.nvim] under
|
||||||
`languages.typst.extensions.typst-preview-nvim`.
|
`languages.typst.extensions.typst-preview-nvim`.
|
||||||
|
|
@ -12,7 +28,7 @@
|
||||||
- Add a search widget to the options page in the nvf manual.
|
- Add a search widget to the options page in the nvf manual.
|
||||||
|
|
||||||
- Add [render-markdown.nvim] under
|
- Add [render-markdown.nvim] under
|
||||||
`languages.markdown.extensions.render-markdown-nvim`
|
`languages.markdown.extensions.render-markdown-nvim`.
|
||||||
|
|
||||||
- Implement [](#opt-vim.git.gitsigns.setupOpts) for user-specified setup table
|
- Implement [](#opt-vim.git.gitsigns.setupOpts) for user-specified setup table
|
||||||
in gitsigns configuration.
|
in gitsigns configuration.
|
||||||
|
|
@ -41,6 +57,27 @@
|
||||||
|
|
||||||
- Add [yanky.nvim] to available plugins, under `vim.utility.yanky-nvim`.
|
- Add [yanky.nvim] to available plugins, under `vim.utility.yanky-nvim`.
|
||||||
|
|
||||||
|
- Fix plugin `setupOpts` for yanky.nvim and assert if shada is configured as a
|
||||||
|
backend while shada is disabled in Neovim options.
|
||||||
|
|
||||||
|
- Add [yazi.nvim] as a companion plugin for Yazi, the terminal file manager.
|
||||||
|
|
||||||
|
- Add [](#opt-vim.autocmds) and [](#opt-vim.augroups) to allow declaring
|
||||||
|
autocommands via Nix.
|
||||||
|
|
||||||
|
- Fix plugin `setupOpts` for yanky.nvim and assert if shada is configured as a
|
||||||
|
backend while shada is disabled in Neovim options.
|
||||||
|
|
||||||
|
- Add [yazi.nvim] as a companion plugin for Yazi, the terminal file manager.
|
||||||
|
|
||||||
|
- Add [snacks.nvim] under `vim.utility.snacks-nvim` as a general-purpose utility
|
||||||
|
plugin.
|
||||||
|
|
||||||
|
- Move LSPSaga to `setupOpts` format, allowing freeform configuration in
|
||||||
|
`vim.lsp.lspsaga.setupOpts`.
|
||||||
|
|
||||||
|
- Lazyload Lspsaga and remove default keybindings for it.
|
||||||
|
|
||||||
[amadaluzia](https://github.com/amadaluzia):
|
[amadaluzia](https://github.com/amadaluzia):
|
||||||
|
|
||||||
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
||||||
|
|
@ -51,7 +88,8 @@
|
||||||
|
|
||||||
[blink.cmp]: https://github.com/saghen/blink.cmp
|
[blink.cmp]: https://github.com/saghen/blink.cmp
|
||||||
|
|
||||||
- Add [blink.cmp] support
|
- Add [blink.cmp] support.
|
||||||
|
- Add `LazyFile` user event.
|
||||||
|
|
||||||
[diniamo](https://github.com/diniamo):
|
[diniamo](https://github.com/diniamo):
|
||||||
|
|
||||||
|
|
@ -65,8 +103,8 @@
|
||||||
[aerial.nvim]: (https://github.com/stevearc/aerial.nvim)
|
[aerial.nvim]: (https://github.com/stevearc/aerial.nvim)
|
||||||
[nvim-ufo]: (https://github.com/kevinhwang91/nvim-ufo)
|
[nvim-ufo]: (https://github.com/kevinhwang91/nvim-ufo)
|
||||||
|
|
||||||
- Add [aerial.nvim]
|
- Add [aerial.nvim].
|
||||||
- Add [nvim-ufo]
|
- Add [nvim-ufo].
|
||||||
|
|
||||||
[LilleAila](https://github.com/LilleAila):
|
[LilleAila](https://github.com/LilleAila):
|
||||||
|
|
||||||
|
|
@ -138,35 +176,103 @@
|
||||||
[thamenato](https://github.com/thamenato):
|
[thamenato](https://github.com/thamenato):
|
||||||
|
|
||||||
[ruff]: (https://github.com/astral-sh/ruff)
|
[ruff]: (https://github.com/astral-sh/ruff)
|
||||||
|
[cue]: (https://cuelang.org/)
|
||||||
|
|
||||||
- Add [ruff] as a formatter option in `vim.languages.python.format.type`.
|
- Add [ruff] as a formatter option in `vim.languages.python.format.type`.
|
||||||
|
- Add [cue] support under `vim.languages.cue`.
|
||||||
|
|
||||||
[ARCIII](https://github.com/ArmandoCIII):
|
[ARCIII](https://github.com/ArmandoCIII):
|
||||||
|
|
||||||
[leetcode.nvim]: https://github.com/kawre/leetcode.nvim
|
[leetcode.nvim]: https://github.com/kawre/leetcode.nvim
|
||||||
|
[codecompanion-nvim]: https://github.com/olimorris/codecompanion.nvim
|
||||||
|
|
||||||
- Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. Code
|
- Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. Code
|
||||||
Inspiration from `vim.languages.clang.dap` implementation.
|
Inspiration from `vim.languages.clang.dap` implementation.
|
||||||
- Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`.
|
- Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`.
|
||||||
|
- Add [codecompanion.nvim] plugin under `vim.assistant.codecompanion-nvim`.
|
||||||
|
|
||||||
|
[nezia1](https://github.com/nezia1):
|
||||||
[nezia1](https://github.com/nezia1)
|
|
||||||
|
|
||||||
- Add support for [nixd](https://github.com/nix-community/nixd) language server.
|
- Add support for [nixd](https://github.com/nix-community/nixd) language server.
|
||||||
|
|
||||||
[folospior](https://github.com/folospior)
|
[jahanson](https://github.com/jahanson):
|
||||||
|
|
||||||
|
- Add [multicursors.nvim](https://github.com/smoka7/multicursors.nvim) to
|
||||||
|
available plugins, under `vim.utility.multicursors`.
|
||||||
|
- Add [hydra.nvim](https://github.com/nvimtools/hydra.nvim) as dependency for
|
||||||
|
`multicursors.nvim` and lazy loads by default.
|
||||||
|
|
||||||
|
[folospior](https://github.com/folospior):
|
||||||
|
|
||||||
- Fix plugin name for lsp/lspkind.
|
- Fix plugin name for lsp/lspkind.
|
||||||
|
|
||||||
[iynaix](https://github.com/iynaix)
|
- Move `vim-illuminate` to `setupOpts format`
|
||||||
|
|
||||||
|
[iynaix](https://github.com/iynaix):
|
||||||
|
|
||||||
- Add lsp options support for [nixd](https://github.com/nix-community/nixd)
|
- Add lsp options support for [nixd](https://github.com/nix-community/nixd)
|
||||||
language server.
|
language server.
|
||||||
|
|
||||||
[Mr-Helpful](https://github.com/Mr-Helpful)
|
[Mr-Helpful](https://github.com/Mr-Helpful):
|
||||||
|
|
||||||
- Corrects pin names used for nvim themes
|
- Corrects pin names used for nvim themes.
|
||||||
|
|
||||||
[Libadoxon](https://github.com/Libadoxon)
|
[Libadoxon](https://github.com/Libadoxon):
|
||||||
|
|
||||||
- Add [git-conflict](https://github.com/akinsho/git-conflict.nvim) plugin for resolving git conflicts
|
- Add [git-conflict](https://github.com/akinsho/git-conflict.nvim) plugin for
|
||||||
|
resolving git conflicts.
|
||||||
|
- Add formatters for go: [gofmt](https://go.dev/blog/gofmt),
|
||||||
|
[golines](https://github.com/segmentio/golines) and
|
||||||
|
[gofumpt](https://github.com/mvdan/gofumpt).
|
||||||
|
|
||||||
|
[UltraGhostie](https://github.com/UltraGhostie)
|
||||||
|
|
||||||
|
- Add [harpoon](https://github.com/ThePrimeagen/harpoon) plugin for navigation
|
||||||
|
|
||||||
|
[MaxMur](https://github.com/TheMaxMur):
|
||||||
|
|
||||||
|
- Add YAML support under `vim.languages.yaml`.
|
||||||
|
|
||||||
|
[alfarel](https://github.com/alfarelcynthesis):
|
||||||
|
|
||||||
|
- Add missing `yazi.nvim` dependency (`snacks.nvim`).
|
||||||
|
|
||||||
|
- Add [mkdir.nvim](https://github.com/jghauser/mkdir.nvim) plugin for automatic
|
||||||
|
creation of parent directories when editing a nested file.
|
||||||
|
- Add [nix-develop.nvim](https://github.com/figsoda/nix-develop.nvim) plugin for
|
||||||
|
in-neovim `nix develop`, `nix shell` and more.
|
||||||
|
- Add [direnv.vim](https://github.com/direnv/direnv.vim) plugin for automatic
|
||||||
|
syncing of nvim shell environment with direnv's.
|
||||||
|
- Add [blink.cmp] source options and some default-disabled sources.
|
||||||
|
- Add [blink.cmp] option to add
|
||||||
|
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so
|
||||||
|
blink.cmp can source snippets from it.
|
||||||
|
- Fix [blink.cmp] breaking when built-in sources were modified.
|
||||||
|
|
||||||
|
[TheColorman](https://github.com/TheColorman):
|
||||||
|
|
||||||
|
- Fix plugin `setupOpts` for `neovim-session-manager` having an invalid value
|
||||||
|
for `autoload_mode`.
|
||||||
|
|
||||||
|
[esdevries](https://github.com/esdevries):
|
||||||
|
|
||||||
|
[projekt0n/github-nvim-theme]: https://github.com/projekt0n/github-nvim-theme
|
||||||
|
|
||||||
|
- Add `github-nvim-theme` theme from [projekt0n/github-nvim-theme].
|
||||||
|
|
||||||
|
[BANanaD3V](https://github.com/BANanaD3V):
|
||||||
|
|
||||||
|
- `alpha` is now configured with nix.
|
||||||
|
|
||||||
|
[viicslen](https://github.com/viicslen):
|
||||||
|
|
||||||
|
- Add `intelephense` language server support under
|
||||||
|
`vim.languages.php.lsp.server`
|
||||||
|
|
||||||
|
[Butzist](https://github.com/butzist):
|
||||||
|
|
||||||
|
- Add Helm chart support under `vim.languages.helm`.
|
||||||
|
|
||||||
|
[rice-cracker-dev](https://github.com/rice-cracker-dev):
|
||||||
|
|
||||||
|
- `eslint_d` now checks for configuration files to load.
|
||||||
|
|
|
||||||
62
flake.lock
generated
62
flake.lock
generated
|
|
@ -5,11 +5,11 @@
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1733312601,
|
"lastModified": 1741352980,
|
||||||
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
|
"narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
|
"rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -38,11 +38,11 @@
|
||||||
},
|
},
|
||||||
"mnw": {
|
"mnw": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1735150973,
|
"lastModified": 1742255973,
|
||||||
"narHash": "sha256-OJhcCAoaMMXeD6o4qI/hxBCNELJp4dN8D5LJZc8w8XA=",
|
"narHash": "sha256-XfEGVKatTgEMMOVb4SNp1LYLQOSzzrFTDMVDTZFyMVE=",
|
||||||
"owner": "Gerg-L",
|
"owner": "Gerg-L",
|
||||||
"repo": "mnw",
|
"repo": "mnw",
|
||||||
"rev": "40cd0b006cc48dffd0f8698ad7f54cf1d56779a6",
|
"rev": "b982dbd5e6d55d4438832b3567c09bc2a129649d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -62,11 +62,11 @@
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1732053863,
|
"lastModified": 1741118843,
|
||||||
"narHash": "sha256-DCIVdlb81Fct2uwzbtnawLBC/U03U2hqx8trqTJB7WA=",
|
"narHash": "sha256-ggXU3RHv6NgWw+vc+HO4/9n0GPufhTIUjVuLci8Za8c=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "nil",
|
"repo": "nil",
|
||||||
"rev": "2e24c9834e3bb5aa2a3701d3713b43a6fb106362",
|
"rev": "577d160da311cc7f5042038456a0713e9863d09e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -77,11 +77,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1737370608,
|
"lastModified": 1741865919,
|
||||||
"narHash": "sha256-hFA6SmioeqvGW/XvZa9bxniAeulksCOcj3kokdNT/YE=",
|
"narHash": "sha256-4thdbnP6dlbdq+qZWTsm4ffAwoS8Tiq1YResB+RP6WE=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "300081d0cc72df578b02d914df941b8ec62240e6",
|
"rev": "573c650e8a14b2faa0041645ab18aed7e60f0c9a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -93,30 +93,17 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
"nixpkgs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1733096140,
|
"lastModified": 1740877520,
|
||||||
"narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=",
|
"narHash": "sha256-oiwv/ZK/2FhGxrCkQkB83i7GnWXPPLzoqFHpDD3uYpk=",
|
||||||
"type": "tarball",
|
"owner": "nix-community",
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
|
"repo": "nixpkgs.lib",
|
||||||
|
"rev": "147dee35aab2193b174e4c0868bd80ead5ce755c",
|
||||||
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"owner": "nix-community",
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
|
"repo": "nixpkgs.lib",
|
||||||
}
|
"type": "github"
|
||||||
},
|
|
||||||
"nmd": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1705050560,
|
|
||||||
"narHash": "sha256-x3zzcdvhJpodsmdjqB4t5mkVW22V3wqHLOun0KRBzUI=",
|
|
||||||
"owner": "~rycee",
|
|
||||||
"repo": "nmd",
|
|
||||||
"rev": "66d9334933119c36f91a78d565c152a4fdc8d3d3",
|
|
||||||
"type": "sourcehut"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "~rycee",
|
|
||||||
"repo": "nmd",
|
|
||||||
"type": "sourcehut"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
|
|
@ -126,7 +113,6 @@
|
||||||
"mnw": "mnw",
|
"mnw": "mnw",
|
||||||
"nil": "nil",
|
"nil": "nil",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nmd": "nmd",
|
|
||||||
"systems": "systems_2"
|
"systems": "systems_2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -138,11 +124,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731983527,
|
"lastModified": 1741055476,
|
||||||
"narHash": "sha256-JECaBgC0pQ91Hq3W4unH6K9to8s2Zl2sPNu7bLOv4ek=",
|
"narHash": "sha256-52vwEV0oS2lCnx3c/alOFGglujZTLmObit7K8VblnS8=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "71287228d96e9568e1e70c6bbfa3f992d145947b",
|
"rev": "aefb7017d710f150970299685e8d8b549d653649",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
|
|
@ -86,12 +86,6 @@
|
||||||
# Alternate neovim-wrapper
|
# Alternate neovim-wrapper
|
||||||
mnw.url = "github:Gerg-L/mnw";
|
mnw.url = "github:Gerg-L/mnw";
|
||||||
|
|
||||||
# For generating documentation website
|
|
||||||
nmd = {
|
|
||||||
url = "sourcehut:~rycee/nmd";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Language servers (use master instead of nixpkgs)
|
# Language servers (use master instead of nixpkgs)
|
||||||
nil = {
|
nil = {
|
||||||
url = "github:oxalica/nil";
|
url = "github:oxalica/nil";
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
stdenv,
|
||||||
rustPlatform,
|
rustPlatform,
|
||||||
hostPlatform,
|
hostPlatform,
|
||||||
vimUtils,
|
vimUtils,
|
||||||
|
|
@ -13,17 +14,11 @@
|
||||||
# TODO: remove this if plugin stops using nightly rust
|
# TODO: remove this if plugin stops using nightly rust
|
||||||
env.RUSTC_BOOTSTRAP = true;
|
env.RUSTC_BOOTSTRAP = true;
|
||||||
|
|
||||||
nativeBuildInputs = [git];
|
useFetchCargoVendor = true;
|
||||||
cargoLock = {
|
cargoHash = "sha256-F1wh/TjYoiIbDY3J/prVF367MKk3vwM7LqOpRobOs7I=";
|
||||||
lockFile = "${src}/Cargo.lock";
|
|
||||||
allowBuiltinFetchGit = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
libExt =
|
nativeBuildInputs = [git];
|
||||||
if hostPlatform.isDarwin
|
};
|
||||||
then "dylib"
|
|
||||||
else "so";
|
|
||||||
in
|
in
|
||||||
vimUtils.buildVimPlugin {
|
vimUtils.buildVimPlugin {
|
||||||
pname = "blink-cmp";
|
pname = "blink-cmp";
|
||||||
|
|
@ -31,8 +26,13 @@ in
|
||||||
|
|
||||||
# blink references a repro.lua which is placed outside the lua/ directory
|
# blink references a repro.lua which is placed outside the lua/ directory
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
preInstall = ''
|
preInstall = let
|
||||||
|
ext = stdenv.hostPlatform.extensions.sharedLibrary;
|
||||||
|
in ''
|
||||||
mkdir -p target/release
|
mkdir -p target/release
|
||||||
ln -s ${blink-fuzzy-lib}/lib/libblink_cmp_fuzzy.${libExt} target/release/libblink_cmp_fuzzy.${libExt}
|
ln -s ${blink-fuzzy-lib}/lib/libblink_cmp_fuzzy${ext} target/release/libblink_cmp_fuzzy${ext}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Module for reproducing issues
|
||||||
|
nvimSkipModule = ["repro"];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
185
modules/neovim/init/autocmds.nix
Normal file
185
modules/neovim/init/autocmds.nix
Normal file
|
|
@ -0,0 +1,185 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
|
inherit (lib.lists) filter;
|
||||||
|
inherit (lib.strings) optionalString;
|
||||||
|
inherit (lib.types) nullOr submodule listOf str bool;
|
||||||
|
inherit (lib.nvim.types) luaInline;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
|
||||||
|
autocommandType = submodule {
|
||||||
|
options = {
|
||||||
|
enable =
|
||||||
|
mkEnableOption ""
|
||||||
|
// {
|
||||||
|
default = true;
|
||||||
|
description = "Whether to enable this autocommand";
|
||||||
|
};
|
||||||
|
|
||||||
|
event = mkOption {
|
||||||
|
type = nullOr (listOf str);
|
||||||
|
default = null;
|
||||||
|
example = ["BufRead" "BufWritePre"];
|
||||||
|
description = "The event(s) that trigger the autocommand.";
|
||||||
|
};
|
||||||
|
|
||||||
|
pattern = mkOption {
|
||||||
|
type = nullOr (listOf str);
|
||||||
|
default = null;
|
||||||
|
example = ["*.lua" "*.vim"];
|
||||||
|
description = "The file pattern(s) that determine when the autocommand applies).";
|
||||||
|
};
|
||||||
|
|
||||||
|
callback = mkOption {
|
||||||
|
type = nullOr luaInline;
|
||||||
|
default = null;
|
||||||
|
example = literalExpression ''
|
||||||
|
mkLuaInline '''
|
||||||
|
function()
|
||||||
|
print("Saving a Lua file...")
|
||||||
|
end
|
||||||
|
''''
|
||||||
|
'';
|
||||||
|
description = "The file pattern(s) that determine when the autocommand applies.";
|
||||||
|
};
|
||||||
|
|
||||||
|
command = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = "Vim command string instead of a Lua function.";
|
||||||
|
};
|
||||||
|
|
||||||
|
group = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
example = "MyAutoCmdGroup";
|
||||||
|
description = "An optional autocommand group to manage related autocommands.";
|
||||||
|
};
|
||||||
|
|
||||||
|
desc = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
example = "Notify when saving a Lua file";
|
||||||
|
description = "A description for the autocommand.";
|
||||||
|
};
|
||||||
|
|
||||||
|
once = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether autocommand run only once.";
|
||||||
|
};
|
||||||
|
|
||||||
|
nested = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether to allow nested autocommands to trigger.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
autogroupType = submodule {
|
||||||
|
options = {
|
||||||
|
enable =
|
||||||
|
mkEnableOption ""
|
||||||
|
// {
|
||||||
|
default = true;
|
||||||
|
description = "Whether to enable this autogroup";
|
||||||
|
};
|
||||||
|
|
||||||
|
name = mkOption {
|
||||||
|
type = str;
|
||||||
|
example = "MyAutoCmdGroup";
|
||||||
|
description = "The name of the autocommand group.";
|
||||||
|
};
|
||||||
|
|
||||||
|
clear = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Whether to clear existing autocommands in this group before defining new ones.
|
||||||
|
This helps avoid duplicate autocommands.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
cfg = config.vim;
|
||||||
|
in {
|
||||||
|
options.vim = {
|
||||||
|
augroups = mkOption {
|
||||||
|
type = listOf autogroupType;
|
||||||
|
default = [];
|
||||||
|
description = ''
|
||||||
|
A list of Neovim autogroups, which are used to organize and manage related
|
||||||
|
autocommands together. Groups allow multiple autocommands to be cleared
|
||||||
|
or redefined collectively, preventing duplicate definitions.
|
||||||
|
|
||||||
|
Each autogroup consists of a name, a boolean indicating whether to clear
|
||||||
|
existing autocommands, and a list of associated autocommands.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
autocmds = mkOption {
|
||||||
|
type = listOf autocommandType;
|
||||||
|
default = [];
|
||||||
|
description = ''
|
||||||
|
A list of Neovim autocommands to be registered.
|
||||||
|
|
||||||
|
Each entry defines an autocommand, specifying events, patterns, optional
|
||||||
|
callbacks, commands, groups, and execution settings.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
vim = let
|
||||||
|
enabledAutocommands = filter (cmd: cmd.enable) cfg.autocmds;
|
||||||
|
enabledAutogroups = filter (au: au.enable) cfg.augroups;
|
||||||
|
in {
|
||||||
|
luaConfigRC = {
|
||||||
|
augroups = entryAfter ["pluginConfigs"] (optionalString (enabledAutogroups != []) ''
|
||||||
|
local nvf_autogroups = {}
|
||||||
|
for _, group in ipairs(${toLuaObject enabledAutogroups}) do
|
||||||
|
if group.name then
|
||||||
|
nvf_autogroups[group.name] = { clear = group.clear }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for group_name, options in pairs(nvf_autogroups) do
|
||||||
|
vim.api.nvim_create_augroup(group_name, options)
|
||||||
|
end
|
||||||
|
'');
|
||||||
|
|
||||||
|
autocmds = entryAfter ["pluginConfigs"] (optionalString (enabledAutocommands != []) ''
|
||||||
|
local nvf_autocommands = ${toLuaObject enabledAutocommands}
|
||||||
|
for _, autocmd in ipairs(nvf_autocommands) do
|
||||||
|
vim.api.nvim_create_autocmd(
|
||||||
|
autocmd.event,
|
||||||
|
{
|
||||||
|
group = autocmd.group,
|
||||||
|
pattern = autocmd.pattern,
|
||||||
|
buffer = autocmd.buffer,
|
||||||
|
desc = autocmd.desc,
|
||||||
|
callback = autocmd.callback,
|
||||||
|
command = autocmd.command,
|
||||||
|
once = autocmd.once,
|
||||||
|
nested = autocmd.nested
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
'');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = builtins.all (cmd: (cmd.command == null || cmd.callback == null)) cfg.autocmds;
|
||||||
|
message = "An autocommand cannot have both 'command' and 'callback' defined at the same time.";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
./autocmds.nix
|
||||||
./basic.nix
|
./basic.nix
|
||||||
./debug.nix
|
./debug.nix
|
||||||
./highlight.nix
|
./highlight.nix
|
||||||
|
|
|
||||||
278
modules/plugins/assistant/codecompanion/codecompanion-nvim.nix
Normal file
278
modules/plugins/assistant/codecompanion/codecompanion-nvim.nix
Normal file
|
|
@ -0,0 +1,278 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.types) int str enum nullOr attrs;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||||
|
in {
|
||||||
|
options.vim.assistant = {
|
||||||
|
codecompanion-nvim = {
|
||||||
|
enable = mkEnableOption "complementary neovim plugin for codecompanion.nvim";
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "codecompanion-nvim" {
|
||||||
|
opts = {
|
||||||
|
send_code = mkEnableOption "code from being sent to the LLM.";
|
||||||
|
|
||||||
|
log_level = mkOption {
|
||||||
|
type = enum ["DEBUG" "INFO" "ERROR" "TRACE"];
|
||||||
|
default = "ERROR";
|
||||||
|
description = "Change the level of logging.";
|
||||||
|
};
|
||||||
|
|
||||||
|
language = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "English";
|
||||||
|
description = "Specify which language an LLM should respond in.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
display = {
|
||||||
|
diff = {
|
||||||
|
enabled =
|
||||||
|
mkEnableOption ""
|
||||||
|
// {
|
||||||
|
default = true;
|
||||||
|
description = "a diff view to see the changes made by the LLM.";
|
||||||
|
};
|
||||||
|
|
||||||
|
close_chat_at = mkOption {
|
||||||
|
type = int;
|
||||||
|
default = 240;
|
||||||
|
description = ''
|
||||||
|
Close an open chat buffer if the
|
||||||
|
total columns of your display are less than...
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
layout = mkOption {
|
||||||
|
type = enum ["vertical" "horizontal"];
|
||||||
|
default = "vertical";
|
||||||
|
description = "Type of split for default provider.";
|
||||||
|
};
|
||||||
|
|
||||||
|
provider = mkOption {
|
||||||
|
type = enum ["default" "mini_diff"];
|
||||||
|
default = "default";
|
||||||
|
description = "The preferred kind of provider.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
inline = {
|
||||||
|
layout = mkOption {
|
||||||
|
type = enum ["vertical" "horizontal" "buffer"];
|
||||||
|
default = "vertical";
|
||||||
|
description = "Customize how output is created in new buffer.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
chat = {
|
||||||
|
auto_scroll = mkEnableOption "automatic page scrolling.";
|
||||||
|
|
||||||
|
show_settings = mkEnableOption ''
|
||||||
|
LLM settings to appear at the top of the chat buffer.
|
||||||
|
'';
|
||||||
|
|
||||||
|
start_in_insert_mode = mkEnableOption ''
|
||||||
|
opening the chat buffer in insert mode.
|
||||||
|
'';
|
||||||
|
|
||||||
|
show_header_separator = mkEnableOption ''
|
||||||
|
header separators in the chat buffer.
|
||||||
|
|
||||||
|
Set this to false if you're using an
|
||||||
|
external markdown formatting plugin.
|
||||||
|
'';
|
||||||
|
|
||||||
|
show_references =
|
||||||
|
mkEnableOption ""
|
||||||
|
// {
|
||||||
|
default = true;
|
||||||
|
description = "references in the chat buffer.";
|
||||||
|
};
|
||||||
|
|
||||||
|
show_token_count =
|
||||||
|
mkEnableOption ""
|
||||||
|
// {
|
||||||
|
default = true;
|
||||||
|
description = "the token count for each response.";
|
||||||
|
};
|
||||||
|
|
||||||
|
intro_message = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "Welcome to CodeCompanion ✨! Press ? for options.";
|
||||||
|
description = "Message to appear in chat buffer.";
|
||||||
|
};
|
||||||
|
|
||||||
|
separator = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "─";
|
||||||
|
description = ''
|
||||||
|
The separator between the
|
||||||
|
different messages in the chat buffer.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
icons = {
|
||||||
|
pinned_buffer = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = " ";
|
||||||
|
description = "The icon to represent a pinned buffer.";
|
||||||
|
};
|
||||||
|
|
||||||
|
watched_buffer = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "👀 ";
|
||||||
|
description = "The icon to represent a watched buffer.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
action_palette = {
|
||||||
|
width = mkOption {
|
||||||
|
type = int;
|
||||||
|
default = 95;
|
||||||
|
description = "Width of the action palette.";
|
||||||
|
};
|
||||||
|
|
||||||
|
height = mkOption {
|
||||||
|
type = int;
|
||||||
|
default = 10;
|
||||||
|
description = "Height of the action palette.";
|
||||||
|
};
|
||||||
|
|
||||||
|
prompt = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "Prompt ";
|
||||||
|
description = "Prompt used for interactive LLM calls.";
|
||||||
|
};
|
||||||
|
|
||||||
|
provider = mkOption {
|
||||||
|
type = enum ["default" "telescope" "mini_pick"];
|
||||||
|
default = "default";
|
||||||
|
description = "Provider used for the action palette.";
|
||||||
|
};
|
||||||
|
|
||||||
|
opts = {
|
||||||
|
show_default_actions =
|
||||||
|
mkEnableOption ""
|
||||||
|
// {
|
||||||
|
default = true;
|
||||||
|
description = "showing default actions in the action palette.";
|
||||||
|
};
|
||||||
|
|
||||||
|
show_default_prompt_library =
|
||||||
|
mkEnableOption ""
|
||||||
|
// {
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
showing default prompt library in the action palette.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
adapters = mkOption {
|
||||||
|
type = nullOr luaInline;
|
||||||
|
default = null;
|
||||||
|
description = "An adapter is what connects Neovim to an LLM.";
|
||||||
|
};
|
||||||
|
|
||||||
|
strategies = {
|
||||||
|
chat = {
|
||||||
|
adapter = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = "Adapter used for the chat strategy.";
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = mkOption {
|
||||||
|
type = nullOr attrs;
|
||||||
|
default = null;
|
||||||
|
description = "Define or override the default keymaps.";
|
||||||
|
};
|
||||||
|
|
||||||
|
variables = mkOption {
|
||||||
|
type = nullOr luaInline;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Define your own variables
|
||||||
|
to share specific content.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
slash_commands = mkOption {
|
||||||
|
type = nullOr luaInline;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Slash Commands (invoked with /) let you dynamically
|
||||||
|
insert context into the chat buffer,
|
||||||
|
such as file contents or date/time.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
tools = mkOption {
|
||||||
|
type = nullOr attrs;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Configure tools to perform specific
|
||||||
|
tasks when invoked by an LLM.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
roles = mkOption {
|
||||||
|
type = nullOr luaInline;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
The chat buffer places user and LLM responses under a H2 header.
|
||||||
|
These can be customized in the configuration.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
inline = {
|
||||||
|
adapter = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = "Adapter used for the inline strategy.";
|
||||||
|
};
|
||||||
|
|
||||||
|
variables = mkOption {
|
||||||
|
type = nullOr luaInline;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Define your own variables
|
||||||
|
to share specific content.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
accept_change = {
|
||||||
|
n = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "ga";
|
||||||
|
description = "Accept the suggested change.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
reject_change = {
|
||||||
|
n = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "gr";
|
||||||
|
description = "Reject the suggested change.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
prompt_library = mkOption {
|
||||||
|
type = nullOr attrs;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
A prompt library is a collection of prompts
|
||||||
|
that can be used in the action palette.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
27
modules/plugins/assistant/codecompanion/config.nix
Normal file
27
modules/plugins/assistant/codecompanion/config.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
|
||||||
|
cfg = config.vim.assistant.codecompanion-nvim;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
startPlugins = [
|
||||||
|
"plenary-nvim"
|
||||||
|
];
|
||||||
|
|
||||||
|
lazy.plugins = {
|
||||||
|
codecompanion-nvim = {
|
||||||
|
package = "codecompanion-nvim";
|
||||||
|
setupModule = "codecompanion";
|
||||||
|
inherit (cfg) setupOpts;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
treesitter.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/plugins/assistant/codecompanion/default.nix
Normal file
6
modules/plugins/assistant/codecompanion/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./codecompanion-nvim.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -37,6 +37,12 @@ in {
|
||||||
inherit (cfg) setupOpts;
|
inherit (cfg) setupOpts;
|
||||||
after = mkIf cfg.cmp.enable "require('copilot_cmp').setup()";
|
after = mkIf cfg.cmp.enable "require('copilot_cmp').setup()";
|
||||||
|
|
||||||
|
event = [
|
||||||
|
{
|
||||||
|
event = "User";
|
||||||
|
pattern = "LazyFile";
|
||||||
|
}
|
||||||
|
];
|
||||||
cmd = ["Copilot" "CopilotAuth" "CopilotDetach" "CopilotPanel" "CopilotStop"];
|
cmd = ["Copilot" "CopilotAuth" "CopilotDetach" "CopilotPanel" "CopilotStop"];
|
||||||
keys = [
|
keys = [
|
||||||
(mkLuaKeymap ["n"] cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion" {})
|
(mkLuaKeymap ["n"] cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion" {})
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,6 @@
|
||||||
imports = [
|
imports = [
|
||||||
./chatgpt
|
./chatgpt
|
||||||
./copilot
|
./copilot
|
||||||
|
./codecompanion
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption literalMD;
|
inherit (lib.options) mkEnableOption mkOption literalMD;
|
||||||
inherit (lib.types) listOf str either attrsOf submodule enum anything int nullOr;
|
inherit (lib.types) bool listOf str either attrsOf submodule enum anything int nullOr;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline pluginType;
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
inherit (lib.nvim.config) mkBool;
|
inherit (lib.nvim.config) mkBool;
|
||||||
|
|
||||||
|
|
@ -21,8 +21,9 @@
|
||||||
freeformType = anything;
|
freeformType = anything;
|
||||||
options = {
|
options = {
|
||||||
module = mkOption {
|
module = mkOption {
|
||||||
type = str;
|
type = nullOr str;
|
||||||
description = "module of the provider";
|
default = null;
|
||||||
|
description = "Provider module.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -37,16 +38,10 @@ in {
|
||||||
description = "Default list of sources to enable for completion.";
|
description = "Default list of sources to enable for completion.";
|
||||||
};
|
};
|
||||||
|
|
||||||
cmdline = mkOption {
|
|
||||||
type = nullOr (listOf str);
|
|
||||||
default = [];
|
|
||||||
description = "List of sources to enable for cmdline. Null means use default source list.";
|
|
||||||
};
|
|
||||||
|
|
||||||
providers = mkOption {
|
providers = mkOption {
|
||||||
type = attrsOf providerType;
|
type = attrsOf providerType;
|
||||||
default = {};
|
default = {};
|
||||||
description = "Settings for completion providers";
|
description = "Settings for completion providers.";
|
||||||
};
|
};
|
||||||
|
|
||||||
transform_items = mkOption {
|
transform_items = mkOption {
|
||||||
|
|
@ -63,6 +58,20 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cmdline = {
|
||||||
|
sources = mkOption {
|
||||||
|
type = nullOr (listOf str);
|
||||||
|
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 = {
|
completion = {
|
||||||
documentation = {
|
documentation = {
|
||||||
auto_show = mkBool true "Show documentation whenever an item is selected";
|
auto_show = mkBool true "Show documentation whenever an item is selected";
|
||||||
|
|
@ -72,6 +81,16 @@ in {
|
||||||
description = "Delay before auto show triggers";
|
description = "Delay before auto show triggers";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
menu.auto_show = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Manages the appearance of the completion menu. You may prevent the menu
|
||||||
|
from automatically showing by this option to `false` and manually showing
|
||||||
|
it with the show keymap command.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
keymap = mkOption {
|
keymap = mkOption {
|
||||||
|
|
@ -101,7 +120,25 @@ in {
|
||||||
fuzzy = {
|
fuzzy = {
|
||||||
prebuilt_binaries = {
|
prebuilt_binaries = {
|
||||||
download = mkBool false ''
|
download = mkBool false ''
|
||||||
Auto-downloads prebuilt binaries. Do not enable, it doesn't work on nix
|
Auto-downloads prebuilt binaries.
|
||||||
|
|
||||||
|
::: .{warning}
|
||||||
|
Do not enable this option, as it does **not work** on Nix!
|
||||||
|
:::
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
implementation = mkOption {
|
||||||
|
type = enum ["lua" "prefer_rust" "rust" "prefer_rust_with_warning"];
|
||||||
|
default = "prefer_rust";
|
||||||
|
description = ''
|
||||||
|
fuzzy matcher implementation for Blink.
|
||||||
|
|
||||||
|
* `"lua"`: slower, Lua native fuzzy matcher implementation
|
||||||
|
* `"rust": use the SIMD fuzzy matcher, 'frizbee'
|
||||||
|
* `"prefer_rust"`: use the rust implementation, but fall back to lua
|
||||||
|
* `"prefer_rust_with_warning"`: use the rust implementation, and fall back to lua
|
||||||
|
if it is not available after emitting a warning.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -116,5 +153,67 @@ in {
|
||||||
scrollDocsUp = mkMappingOption "Scroll docs up [blink.cmp]" "<C-d>";
|
scrollDocsUp = mkMappingOption "Scroll docs up [blink.cmp]" "<C-d>";
|
||||||
scrollDocsDown = mkMappingOption "Scroll docs down [blink.cmp]" "<C-f>";
|
scrollDocsDown = mkMappingOption "Scroll docs down [blink.cmp]" "<C-f>";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sourcePlugins = let
|
||||||
|
sourcePluginType = submodule {
|
||||||
|
options = {
|
||||||
|
enable = mkEnableOption "this source";
|
||||||
|
package = mkOption {
|
||||||
|
type = pluginType;
|
||||||
|
description = ''
|
||||||
|
`blink-cmp` source plugin package.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
module = mkOption {
|
||||||
|
type = str;
|
||||||
|
description = ''
|
||||||
|
Value of {option}`vim.autocomplete.blink-cmp.setupOpts.sources.providers.<name>.module`.
|
||||||
|
|
||||||
|
Should be present in the source's documentation.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
mkOption {
|
||||||
|
type = submodule {
|
||||||
|
freeformType = attrsOf sourcePluginType;
|
||||||
|
options = let
|
||||||
|
defaultSourcePluginOption = name: package: module: {
|
||||||
|
package = mkOption {
|
||||||
|
type = pluginType;
|
||||||
|
default = package;
|
||||||
|
description = ''
|
||||||
|
`blink-cmp` ${name} source plugin package.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
module = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = module;
|
||||||
|
description = ''
|
||||||
|
Value of {option}`vim.autocomplete.blink-cmp.setupOpts.sources.providers.${name}.module`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
enable = mkEnableOption "${name} source";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
# emoji completion after :
|
||||||
|
emoji = defaultSourcePluginOption "emoji" "blink-emoji-nvim" "blink-emoji";
|
||||||
|
# spelling suggestions as completions
|
||||||
|
spell = defaultSourcePluginOption "spell" "blink-cmp-spell" "blink-cmp-spell";
|
||||||
|
# words from nearby files
|
||||||
|
ripgrep = defaultSourcePluginOption "ripgrep" "blink-ripgrep-nvim" "blink-ripgrep";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
`blink.cmp` sources.
|
||||||
|
|
||||||
|
Attribute names must be source names used in {option}`vim.autocomplete.blink-cmp.setupOpts.sources.default`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
friendly-snippets.enable = mkEnableOption "friendly-snippets for blink to source from automatically";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
inherit (lib.attrsets) attrValues filterAttrs mapAttrsToList;
|
||||||
|
inherit (lib.lists) map optional elem;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
|
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
|
||||||
|
|
||||||
|
|
@ -19,9 +21,27 @@
|
||||||
else if (plugin ? pname && (tryEval plugin.pname).success)
|
else if (plugin ? pname && (tryEval plugin.pname).success)
|
||||||
then plugin.pname
|
then plugin.pname
|
||||||
else plugin.name;
|
else plugin.name;
|
||||||
|
|
||||||
|
enabledBlinkSources = filterAttrs (_source: definition: definition.enable) cfg.sourcePlugins;
|
||||||
|
blinkSourcePlugins = map (definition: definition.package) (attrValues enabledBlinkSources);
|
||||||
|
|
||||||
|
blinkBuiltins = [
|
||||||
|
"path"
|
||||||
|
"lsp"
|
||||||
|
"snippets"
|
||||||
|
"buffer"
|
||||||
|
"omni"
|
||||||
|
];
|
||||||
in {
|
in {
|
||||||
|
assertions =
|
||||||
|
mapAttrsToList (provider: definition: {
|
||||||
|
assertion = elem provider blinkBuiltins || definition.module != null;
|
||||||
|
message = "`config.vim.autocomplete.blink-cmp.setupOpts.sources.providers.${provider}.module` is `null`: non-builtin providers must set `module`.";
|
||||||
|
})
|
||||||
|
cfg.setupOpts.sources.providers;
|
||||||
|
|
||||||
vim = mkIf cfg.enable {
|
vim = mkIf cfg.enable {
|
||||||
startPlugins = ["blink-compat"];
|
startPlugins = ["blink-compat"] ++ blinkSourcePlugins ++ (optional cfg.friendly-snippets.enable "friendly-snippets");
|
||||||
lazy.plugins = {
|
lazy.plugins = {
|
||||||
blink-cmp = {
|
blink-cmp = {
|
||||||
package = "blink-cmp";
|
package = "blink-cmp";
|
||||||
|
|
@ -32,7 +52,9 @@ in {
|
||||||
#
|
#
|
||||||
# event = ["InsertEnter" "CmdlineEnter"];
|
# event = ["InsertEnter" "CmdlineEnter"];
|
||||||
|
|
||||||
after = ''
|
after =
|
||||||
|
# lua
|
||||||
|
''
|
||||||
${optionalString config.vim.lazy.enable
|
${optionalString config.vim.lazy.enable
|
||||||
(concatStringsSep "\n" (map
|
(concatStringsSep "\n" (map
|
||||||
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
|
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
|
||||||
|
|
@ -45,13 +67,26 @@ in {
|
||||||
enableSharedCmpSources = true;
|
enableSharedCmpSources = true;
|
||||||
blink-cmp.setupOpts = {
|
blink-cmp.setupOpts = {
|
||||||
sources = {
|
sources = {
|
||||||
default = ["lsp" "path" "snippets" "buffer"] ++ (attrNames cmpCfg.sources);
|
default =
|
||||||
|
[
|
||||||
|
"lsp"
|
||||||
|
"path"
|
||||||
|
"snippets"
|
||||||
|
"buffer"
|
||||||
|
]
|
||||||
|
++ (attrNames cmpCfg.sources)
|
||||||
|
++ (attrNames enabledBlinkSources);
|
||||||
providers =
|
providers =
|
||||||
mapAttrs (name: _: {
|
mapAttrs (name: _: {
|
||||||
inherit name;
|
inherit name;
|
||||||
module = "blink.compat.source";
|
module = "blink.compat.source";
|
||||||
})
|
})
|
||||||
cmpCfg.sources;
|
cmpCfg.sources
|
||||||
|
// (mapAttrs (name: definition: {
|
||||||
|
inherit name;
|
||||||
|
inherit (definition) module;
|
||||||
|
})
|
||||||
|
enabledBlinkSources);
|
||||||
};
|
};
|
||||||
snippets = mkIf config.vim.snippets.luasnip.enable {
|
snippets = mkIf config.vim.snippets.luasnip.enable {
|
||||||
preset = "luasnip";
|
preset = "luasnip";
|
||||||
|
|
@ -67,7 +102,9 @@ in {
|
||||||
${mappings.next} = [
|
${mappings.next} = [
|
||||||
"select_next"
|
"select_next"
|
||||||
"snippet_forward"
|
"snippet_forward"
|
||||||
(mkLuaInline ''
|
(mkLuaInline
|
||||||
|
# lua
|
||||||
|
''
|
||||||
function(cmp)
|
function(cmp)
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
has_words_before = col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
has_words_before = col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||||
|
|
|
||||||
|
|
@ -60,12 +60,6 @@ in {
|
||||||
enableSharedCmpSources = true;
|
enableSharedCmpSources = true;
|
||||||
|
|
||||||
nvim-cmp = {
|
nvim-cmp = {
|
||||||
sources = {
|
|
||||||
nvim-cmp = null;
|
|
||||||
buffer = "[Buffer]";
|
|
||||||
path = "[Path]";
|
|
||||||
};
|
|
||||||
|
|
||||||
sourcePlugins = ["cmp-buffer" "cmp-path"];
|
sourcePlugins = ["cmp-buffer" "cmp-path"];
|
||||||
|
|
||||||
setupOpts = {
|
setupOpts = {
|
||||||
|
|
|
||||||
|
|
@ -98,14 +98,16 @@ in {
|
||||||
|
|
||||||
sources = mkOption {
|
sources = mkOption {
|
||||||
type = attrsOf (nullOr str);
|
type = attrsOf (nullOr str);
|
||||||
default = {};
|
default = {
|
||||||
description = "The list of sources used by nvim-cmp";
|
|
||||||
example = literalExpression ''
|
|
||||||
{
|
|
||||||
nvim-cmp = null;
|
nvim-cmp = null;
|
||||||
buffer = "[Buffer]";
|
buffer = "[Buffer]";
|
||||||
}
|
path = "[Path]";
|
||||||
'';
|
};
|
||||||
|
example = {
|
||||||
|
nvim-cmp = null;
|
||||||
|
buffer = "[Buffer]";
|
||||||
|
};
|
||||||
|
description = "The list of sources used by nvim-cmp";
|
||||||
};
|
};
|
||||||
|
|
||||||
sourcePlugins = mkOption {
|
sourcePlugins = mkOption {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,23 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) listOf attrsOf anything nullOr enum;
|
||||||
in {
|
in {
|
||||||
options.vim.dashboard.alpha = {
|
options.vim.dashboard.alpha = {
|
||||||
enable = mkEnableOption "fast and fully programmable greeter for neovim [alpha.mvim]";
|
enable = mkEnableOption "fast and fully programmable greeter for neovim [alpha.nvim]";
|
||||||
|
theme = mkOption {
|
||||||
|
type = nullOr (enum ["dashboard" "startify" "theta"]);
|
||||||
|
default = "dashboard";
|
||||||
|
description = "Alpha default theme to use";
|
||||||
|
};
|
||||||
|
layout = mkOption {
|
||||||
|
type = listOf (attrsOf anything);
|
||||||
|
default = [];
|
||||||
|
description = "Alpha dashboard layout";
|
||||||
|
};
|
||||||
|
opts = mkOption {
|
||||||
|
type = attrsOf anything;
|
||||||
|
default = {};
|
||||||
|
description = "Optional global options";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,11 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.dashboard.alpha;
|
cfg = config.vim.dashboard.alpha;
|
||||||
|
themeDefined = cfg.theme != null;
|
||||||
|
layoutDefined = cfg.layout != [];
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim.startPlugins = [
|
||||||
|
|
@ -14,207 +17,30 @@ in {
|
||||||
"nvim-web-devicons"
|
"nvim-web-devicons"
|
||||||
];
|
];
|
||||||
|
|
||||||
# the entire credit for this dashboard configuration to https://github.com/Rishabh672003
|
vim.pluginRC.alpha = let
|
||||||
# honestly, excellent work
|
setupOpts =
|
||||||
vim.pluginRC.alpha = entryAnywhere ''
|
if themeDefined
|
||||||
local alpha = require("alpha")
|
then lib.generators.mkLuaInline "require'alpha.themes.${cfg.theme}'.config"
|
||||||
local plenary_path = require("plenary.path")
|
else {
|
||||||
local dashboard = require("alpha.themes.dashboard")
|
inherit (cfg) layout opts;
|
||||||
local cdir = vim.fn.getcwd()
|
};
|
||||||
local if_nil = vim.F.if_nil
|
in ''
|
||||||
|
require('alpha').setup(${toLuaObject setupOpts})
|
||||||
local nvim_web_devicons = {
|
|
||||||
enabled = true,
|
|
||||||
highlight = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
local function get_extension(fn)
|
|
||||||
local match = fn:match("^.+(%..+)$")
|
|
||||||
local ext = ""
|
|
||||||
if match ~= nil then
|
|
||||||
ext = match:sub(2)
|
|
||||||
end
|
|
||||||
return ext
|
|
||||||
end
|
|
||||||
|
|
||||||
local function icon(fn)
|
|
||||||
local nwd = require("nvim-web-devicons")
|
|
||||||
local ext = get_extension(fn)
|
|
||||||
return nwd.get_icon(fn, ext, { default = true })
|
|
||||||
end
|
|
||||||
|
|
||||||
local function file_button(fn, sc, short_fn)
|
|
||||||
short_fn = short_fn or fn
|
|
||||||
local ico_txt
|
|
||||||
local fb_hl = {}
|
|
||||||
|
|
||||||
if nvim_web_devicons.enabled then
|
|
||||||
local ico, hl = icon(fn)
|
|
||||||
local hl_option_type = type(nvim_web_devicons.highlight)
|
|
||||||
if hl_option_type == "boolean" then
|
|
||||||
if hl and nvim_web_devicons.highlight then
|
|
||||||
table.insert(fb_hl, { hl, 0, 3 })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if hl_option_type == "string" then
|
|
||||||
table.insert(fb_hl, { nvim_web_devicons.highlight, 0, 3 })
|
|
||||||
end
|
|
||||||
ico_txt = ico .. " "
|
|
||||||
else
|
|
||||||
ico_txt = ""
|
|
||||||
end
|
|
||||||
local file_button_el = dashboard.button(sc, ico_txt .. short_fn, "<cmd>e " .. fn .. " <CR>")
|
|
||||||
local fn_start = short_fn:match(".*[/\\]")
|
|
||||||
if fn_start ~= nil then
|
|
||||||
table.insert(fb_hl, { "Comment", #ico_txt - 2, #fn_start + #ico_txt })
|
|
||||||
end
|
|
||||||
file_button_el.opts.hl = fb_hl
|
|
||||||
return file_button_el
|
|
||||||
end
|
|
||||||
|
|
||||||
local default_mru_ignore = { "gitcommit" }
|
|
||||||
|
|
||||||
local mru_opts = {
|
|
||||||
ignore = function(path, ext)
|
|
||||||
return (string.find(path, "COMMIT_EDITMSG")) or (vim.tbl_contains(default_mru_ignore, ext))
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
--- @param start number
|
|
||||||
--- @param cwd string optional
|
|
||||||
--- @param items_number number optional number of items to generate, default = 10
|
|
||||||
local function mru(start, cwd, items_number, opts)
|
|
||||||
opts = opts or mru_opts
|
|
||||||
items_number = if_nil(items_number, 15)
|
|
||||||
|
|
||||||
local oldfiles = {}
|
|
||||||
for _, v in pairs(vim.v.oldfiles) do
|
|
||||||
if #oldfiles == items_number then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
local cwd_cond
|
|
||||||
if not cwd then
|
|
||||||
cwd_cond = true
|
|
||||||
else
|
|
||||||
cwd_cond = vim.startswith(v, cwd)
|
|
||||||
end
|
|
||||||
local ignore = (opts.ignore and opts.ignore(v, get_extension(v))) or false
|
|
||||||
if (vim.fn.filereadable(v) == 1) and cwd_cond and not ignore then
|
|
||||||
oldfiles[#oldfiles + 1] = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local target_width = 35
|
|
||||||
|
|
||||||
local tbl = {}
|
|
||||||
for i, fn in ipairs(oldfiles) do
|
|
||||||
local short_fn
|
|
||||||
if cwd then
|
|
||||||
short_fn = vim.fn.fnamemodify(fn, ":.")
|
|
||||||
else
|
|
||||||
short_fn = vim.fn.fnamemodify(fn, ":~")
|
|
||||||
end
|
|
||||||
|
|
||||||
if #short_fn > target_width then
|
|
||||||
short_fn = plenary_path.new(short_fn):shorten(1, { -2, -1 })
|
|
||||||
if #short_fn > target_width then
|
|
||||||
short_fn = plenary_path.new(short_fn):shorten(1, { -1 })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local shortcut = tostring(i + start - 1)
|
|
||||||
|
|
||||||
local file_button_el = file_button(fn, shortcut, short_fn)
|
|
||||||
tbl[i] = file_button_el
|
|
||||||
end
|
|
||||||
return {
|
|
||||||
type = "group",
|
|
||||||
val = tbl,
|
|
||||||
opts = {},
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
local default_header = {
|
|
||||||
type = "text",
|
|
||||||
val = {
|
|
||||||
|
|
||||||
[[███ ██ ███████ ██████ ██ ██ ██ ███ ███]],
|
|
||||||
[[████ ██ ██ ██ ██ ██ ██ ██ ████ ████]],
|
|
||||||
[[██ ██ ██ █████ ██ ██ ██ ██ ██ ██ ████ ██]],
|
|
||||||
[[██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██]],
|
|
||||||
[[██ ████ ███████ ██████ ████ ██ ██ ██]],
|
|
||||||
|
|
||||||
-- [[ __ ]],
|
|
||||||
-- [[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
|
|
||||||
-- [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]],
|
|
||||||
-- [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
|
|
||||||
-- [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]],
|
|
||||||
-- [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]],
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
position = "center",
|
|
||||||
hl = "Type",
|
|
||||||
-- wrap = "overflow";
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local section_mru = {
|
|
||||||
type = "group",
|
|
||||||
val = {
|
|
||||||
{
|
|
||||||
type = "text",
|
|
||||||
val = "Recent files",
|
|
||||||
opts = {
|
|
||||||
hl = "SpecialComment",
|
|
||||||
shrink_margin = false,
|
|
||||||
position = "center",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ type = "padding", val = 1 },
|
|
||||||
{
|
|
||||||
type = "group",
|
|
||||||
val = function()
|
|
||||||
return { mru(0, cdir) }
|
|
||||||
end,
|
|
||||||
opts = { shrink_margin = false },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local buttons = {
|
|
||||||
type = "group",
|
|
||||||
val = {
|
|
||||||
{ type = "text", val = "Quick links", opts = { hl = "SpecialComment", position = "center" } },
|
|
||||||
{ type = "padding", val = 1 },
|
|
||||||
-- TODO: buttons should be added based on whether or not the relevant plugin is available
|
|
||||||
dashboard.button("e", " New file", "<cmd>ene<CR>"), -- available all the time
|
|
||||||
dashboard.button("SPC F", " Find file"), -- telescope
|
|
||||||
dashboard.button("SPC ff", " Live grep"), -- telescope
|
|
||||||
dashboard.button("SPC p", " Projects"), -- any project
|
|
||||||
dashboard.button("q", " Quit", "<cmd>qa<CR>"), -- available all the time
|
|
||||||
},
|
|
||||||
position = "center",
|
|
||||||
}
|
|
||||||
|
|
||||||
local config = {
|
|
||||||
layout = {
|
|
||||||
{ type = "padding", val = 2 },
|
|
||||||
default_header,
|
|
||||||
{ type = "padding", val = 2 },
|
|
||||||
section_mru,
|
|
||||||
{ type = "padding", val = 2 },
|
|
||||||
buttons,
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
margin = 5,
|
|
||||||
setup = function()
|
|
||||||
vim.cmd([[
|
|
||||||
autocmd alpha_temp DirChanged * lua require('alpha').redraw()
|
|
||||||
]])
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
alpha.setup(config)
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = themeDefined || layoutDefined;
|
||||||
|
message = ''
|
||||||
|
One of 'theme' or 'layout' should be defined in Alpha configuration.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
assertion = !(themeDefined && layoutDefined);
|
||||||
|
message = ''
|
||||||
|
'theme' and 'layout' cannot be defined at the same time.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ in {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["nvim-lint"];
|
startPlugins = ["nvim-lint"];
|
||||||
pluginRC.nvim-lint = entryAnywhere ''
|
pluginRC.nvim-lint = entryAnywhere ''
|
||||||
require("lint").setup(${toLuaObject cfg.setupOpts})
|
require("lint").linters_by_ft = ${toLuaObject cfg.linters_by_ft}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) attrsOf listOf str;
|
inherit (lib.types) attrsOf listOf str;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
|
||||||
in {
|
in {
|
||||||
options.vim.diagnostics.nvim-lint = {
|
options.vim.diagnostics.nvim-lint = {
|
||||||
enable = mkEnableOption "asynchronous linter plugin for Neovim [nvim-lint]";
|
enable = mkEnableOption "asynchronous linter plugin for Neovim [nvim-lint]";
|
||||||
setupOpts = mkPluginSetupOption "nvim-lint" {
|
|
||||||
|
# nvim-lint does not have a setup table.
|
||||||
linters_by_ft = mkOption {
|
linters_by_ft = mkOption {
|
||||||
type = attrsOf (listOf str);
|
type = attrsOf (listOf str);
|
||||||
default = {};
|
default = {};
|
||||||
|
|
@ -13,15 +13,13 @@ in {
|
||||||
text = ["vale"];
|
text = ["vale"];
|
||||||
markdown = ["vale"];
|
markdown = ["vale"];
|
||||||
};
|
};
|
||||||
|
|
||||||
description = ''
|
description = ''
|
||||||
Map of filetype to formatters. This option takes a set of
|
Map of filetype to formatters. This option takes a set of `key = value`
|
||||||
`key = value` format where the `value` will be converted
|
format where the `value` will be converted to its Lua equivalent
|
||||||
to its Lua equivalent. You are responsible for passing the
|
through `toLuaObject. You are responsible for passing the correct Nix
|
||||||
correct Nix data types to generate a correct Lua value that
|
data types to generate a correct Lua value that conform is able to
|
||||||
conform is able to accept.
|
accept.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,10 @@ in {
|
||||||
setupOpts = mkPluginSetupOption "git-conflict" {};
|
setupOpts = mkPluginSetupOption "git-conflict" {};
|
||||||
|
|
||||||
mappings = {
|
mappings = {
|
||||||
ours = mkMappingOption "Choose Ours [Git-Conflict]" "co";
|
ours = mkMappingOption "Choose Ours [Git-Conflict]" "<leader>co";
|
||||||
theirs = mkMappingOption "Choose Theirs [Git-Conflict]" "ct";
|
theirs = mkMappingOption "Choose Theirs [Git-Conflict]" "<leader>ct";
|
||||||
both = mkMappingOption "Choose Both [Git-Conflict]" "cb";
|
both = mkMappingOption "Choose Both [Git-Conflict]" "<leader>cb";
|
||||||
none = mkMappingOption "Choose None [Git-Conflict]" "c0";
|
none = mkMappingOption "Choose None [Git-Conflict]" "<leader>c0";
|
||||||
prevConflict = mkMappingOption "Go to the previous Conflict [Git-Conflict]" "]x";
|
prevConflict = mkMappingOption "Go to the previous Conflict [Git-Conflict]" "]x";
|
||||||
nextConflict = mkMappingOption "Go to the next Conflict [Git-Conflict]" "[x";
|
nextConflict = mkMappingOption "Go to the next Conflict [Git-Conflict]" "[x";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
22
modules/plugins/hydra/config.nix
Normal file
22
modules/plugins/hydra/config.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
cfg = config.vim.hydra;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
startPlugins = [];
|
||||||
|
lazy.plugins.hydra = {
|
||||||
|
package = "hydra.nvim";
|
||||||
|
setupModule = "hydra";
|
||||||
|
inherit (cfg) setupOpts;
|
||||||
|
|
||||||
|
event = ["DeferredUIEnter"];
|
||||||
|
cmd = ["MCstart" "MCvisual" "MCclear" "MCpattern" "MCvisualPattern" "MCunderCursor"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/plugins/hydra/default.nix
Normal file
6
modules/plugins/hydra/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./hydra.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
7
modules/plugins/hydra/hydra.nix
Normal file
7
modules/plugins/hydra/hydra.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkEnableOption;
|
||||||
|
in {
|
||||||
|
options.vim.utility.hydra = {
|
||||||
|
enable = mkEnableOption "utility for creating custom submodes and menus [nvimtools/hydra.nvim]";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -72,6 +72,16 @@
|
||||||
ls_sources,
|
ls_sources,
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
null_ls.builtins.diagnostics.eslint_d.with({
|
||||||
command = "${getExe pkg}",
|
command = "${getExe pkg}",
|
||||||
|
condition = function(utils)
|
||||||
|
return utils.root_has_file({
|
||||||
|
"eslint.config.js",
|
||||||
|
"eslint.config.mjs",
|
||||||
|
".eslintrc",
|
||||||
|
".eslintrc.json",
|
||||||
|
".eslintrc.js",
|
||||||
|
".eslintrc.yml",
|
||||||
|
})
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
51
modules/plugins/languages/cue.nix
Normal file
51
modules/plugins/languages/cue.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.types) package;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.cue;
|
||||||
|
in {
|
||||||
|
options.vim.languages.cue = {
|
||||||
|
enable = mkEnableOption "CUE language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "CUE treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
|
||||||
|
package = mkGrammarOption pkgs "cue";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "CUE LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
default = pkgs.cue;
|
||||||
|
description = "cue lsp implementation";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.cue-lsp = ''
|
||||||
|
lspconfig.cue.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = default_on_attach,
|
||||||
|
cmd = {"${cfg.lsp.package}/bin/cue", "lsp"},
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ in {
|
||||||
./asm.nix
|
./asm.nix
|
||||||
./astro.nix
|
./astro.nix
|
||||||
./bash.nix
|
./bash.nix
|
||||||
|
./cue.nix
|
||||||
./dart.nix
|
./dart.nix
|
||||||
./clang.nix
|
./clang.nix
|
||||||
./css.nix
|
./css.nix
|
||||||
|
|
@ -12,6 +13,7 @@ in {
|
||||||
./gleam.nix
|
./gleam.nix
|
||||||
./go.nix
|
./go.nix
|
||||||
./hcl.nix
|
./hcl.nix
|
||||||
|
./helm.nix
|
||||||
./kotlin.nix
|
./kotlin.nix
|
||||||
./html.nix
|
./html.nix
|
||||||
./haskell.nix
|
./haskell.nix
|
||||||
|
|
@ -39,6 +41,7 @@ in {
|
||||||
./nu.nix
|
./nu.nix
|
||||||
./odin.nix
|
./odin.nix
|
||||||
./wgsl.nix
|
./wgsl.nix
|
||||||
|
./yaml.nix
|
||||||
./ruby.nix
|
./ruby.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,43 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
defaultFormat = "gofmt";
|
||||||
|
formats = {
|
||||||
|
gofmt = {
|
||||||
|
package = pkgs.go;
|
||||||
|
nullConfig = ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.formatting.gofmt.with({
|
||||||
|
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",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
golines = {
|
||||||
|
package = pkgs.golines;
|
||||||
|
nullConfig = ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.formatting.golines.with({
|
||||||
|
command = "${cfg.format.package}/bin/golines",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
defaultDebugger = "delve";
|
defaultDebugger = "delve";
|
||||||
debuggers = {
|
debuggers = {
|
||||||
delve = {
|
delve = {
|
||||||
|
|
@ -67,6 +104,22 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
format = {
|
||||||
|
enable = mkEnableOption "Go formatting" // {default = config.vim.languages.enableFormat;};
|
||||||
|
|
||||||
|
type = mkOption {
|
||||||
|
description = "Go formatter to use";
|
||||||
|
type = enum (attrNames formats);
|
||||||
|
default = defaultFormat;
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
description = "Go formatter package";
|
||||||
|
type = package;
|
||||||
|
default = formats.${cfg.format.type}.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
dap = {
|
dap = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
description = "Enable Go Debug Adapter via nvim-dap-go plugin";
|
description = "Enable Go Debug Adapter via nvim-dap-go plugin";
|
||||||
|
|
@ -99,6 +152,11 @@ in {
|
||||||
vim.lsp.lspconfig.sources.go-lsp = servers.${cfg.lsp.server}.lspConfig;
|
vim.lsp.lspconfig.sources.go-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.format.enable {
|
||||||
|
vim.lsp.null-ls.enable = true;
|
||||||
|
vim.lsp.null-ls.sources.go-format = formats.${cfg.format.type}.nullConfig;
|
||||||
|
})
|
||||||
|
|
||||||
(mkIf cfg.dap.enable {
|
(mkIf cfg.dap.enable {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["nvim-dap-go"];
|
startPlugins = ["nvim-dap-go"];
|
||||||
|
|
|
||||||
89
modules/plugins/languages/helm.nix
Normal file
89
modules/plugins/languages/helm.nix
Normal file
|
|
@ -0,0 +1,89 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.lists) isList;
|
||||||
|
inherit (lib.types) enum either listOf package str;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.helm;
|
||||||
|
yamlCfg = config.vim.languages.yaml;
|
||||||
|
|
||||||
|
helmCmd =
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then cfg.lsp.package
|
||||||
|
else ["${cfg.lsp.package}/bin/helm_ls" "serve"];
|
||||||
|
yamlCmd =
|
||||||
|
if isList yamlCfg.lsp.package
|
||||||
|
then builtins.elemAt yamlCfg.lsp.package 0
|
||||||
|
else "${yamlCfg.lsp.package}/bin/yaml-language-server";
|
||||||
|
|
||||||
|
defaultServer = "helm-ls";
|
||||||
|
servers = {
|
||||||
|
helm-ls = {
|
||||||
|
package = pkgs.helm-ls;
|
||||||
|
lspConfig = ''
|
||||||
|
lspconfig.helm_ls.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = default_on_attach,
|
||||||
|
cmd = ${expToLua helmCmd},
|
||||||
|
settings = {
|
||||||
|
['helm-ls'] = {
|
||||||
|
yamlls = {
|
||||||
|
path = "${yamlCmd}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.languages.helm = {
|
||||||
|
enable = mkEnableOption "Helm language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "Helm treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "helm";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "Helm LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
|
||||||
|
server = mkOption {
|
||||||
|
description = "Helm LSP server to use";
|
||||||
|
type = enum (attrNames servers);
|
||||||
|
default = defaultServer;
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
description = "Helm LSP server package";
|
||||||
|
type = either package (listOf str);
|
||||||
|
default = servers.${cfg.lsp.server}.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.helm-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
|
})
|
||||||
|
|
||||||
|
{
|
||||||
|
# Enables filetype detection
|
||||||
|
vim.startPlugins = [pkgs.vimPlugins.vim-helm];
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
@ -121,8 +121,6 @@
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs-fmt = null; # removed
|
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultDiagnosticsProvider = ["statix" "deadnix"];
|
defaultDiagnosticsProvider = ["statix" "deadnix"];
|
||||||
|
|
@ -219,7 +217,6 @@ in {
|
||||||
${concatStringsSep ", " (attrNames formats)}
|
${concatStringsSep ", " (attrNames formats)}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
assertion = cfg.lsp.server != "rnix";
|
assertion = cfg.lsp.server != "rnix";
|
||||||
message = ''
|
message = ''
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,26 @@
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
intelephense = {
|
||||||
|
package = pkgs.intelephense;
|
||||||
|
lspConfig = ''
|
||||||
|
lspconfig.intelephense.setup{
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = default_on_attach,
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else ''
|
||||||
|
{
|
||||||
|
"${getExe cfg.lsp.package}",
|
||||||
|
"--stdio"
|
||||||
|
},
|
||||||
|
''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
options.vim.languages.php = {
|
options.vim.languages.php = {
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,15 @@ in {
|
||||||
description = "Options to pass to rust analyzer";
|
description = "Options to pass to rust analyzer";
|
||||||
type = str;
|
type = str;
|
||||||
default = "";
|
default = "";
|
||||||
|
example = ''
|
||||||
|
['rust-analyzer'] = {
|
||||||
|
cargo = {allFeature = true},
|
||||||
|
checkOnSave = true,
|
||||||
|
procMacro = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -141,6 +150,9 @@ in {
|
||||||
if isList cfg.lsp.package
|
if isList cfg.lsp.package
|
||||||
then expToLua cfg.lsp.package
|
then expToLua cfg.lsp.package
|
||||||
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
||||||
|
},
|
||||||
|
default_settings = {
|
||||||
|
${cfg.lsp.opts}
|
||||||
},
|
},
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
default_on_attach(client, bufnr)
|
default_on_attach(client, bufnr)
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,16 @@
|
||||||
ls_sources,
|
ls_sources,
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
null_ls.builtins.diagnostics.eslint_d.with({
|
||||||
command = "${getExe pkg}",
|
command = "${getExe pkg}",
|
||||||
|
condition = function(utils)
|
||||||
|
return utils.root_has_file({
|
||||||
|
"eslint.config.js",
|
||||||
|
"eslint.config.mjs",
|
||||||
|
".eslintrc",
|
||||||
|
".eslintrc.json",
|
||||||
|
".eslintrc.js",
|
||||||
|
".eslintrc.yml",
|
||||||
|
})
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,16 @@
|
||||||
ls_sources,
|
ls_sources,
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
null_ls.builtins.diagnostics.eslint_d.with({
|
||||||
command = "${getExe pkg}",
|
command = "${getExe pkg}",
|
||||||
|
condition = function(utils)
|
||||||
|
return utils.root_has_file({
|
||||||
|
"eslint.config.js",
|
||||||
|
"eslint.config.mjs",
|
||||||
|
".eslintrc",
|
||||||
|
".eslintrc.json",
|
||||||
|
".eslintrc.js",
|
||||||
|
".eslintrc.yml",
|
||||||
|
})
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
85
modules/plugins/languages/yaml.nix
Normal file
85
modules/plugins/languages/yaml.nix
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.lists) isList;
|
||||||
|
inherit (lib.types) enum either listOf package str;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.yaml;
|
||||||
|
|
||||||
|
onAttach =
|
||||||
|
if config.vim.languages.helm.lsp.enable
|
||||||
|
then ''
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
local filetype = vim.bo[bufnr].filetype
|
||||||
|
if filetype == "helm" then
|
||||||
|
client.stop()
|
||||||
|
end
|
||||||
|
end''
|
||||||
|
else "on_attach = default_on_attach";
|
||||||
|
|
||||||
|
defaultServer = "yaml-language-server";
|
||||||
|
servers = {
|
||||||
|
yaml-language-server = {
|
||||||
|
package = pkgs.nodePackages.yaml-language-server;
|
||||||
|
lspConfig = ''
|
||||||
|
|
||||||
|
|
||||||
|
lspconfig.yamlls.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
${onAttach},
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else ''{"${cfg.lsp.package}/bin/yaml-language-server", "--stdio"}''
|
||||||
|
},
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.languages.yaml = {
|
||||||
|
enable = mkEnableOption "YAML language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "YAML treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
|
||||||
|
package = mkGrammarOption pkgs "yaml";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "YAML LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
|
||||||
|
server = mkOption {
|
||||||
|
type = enum (attrNames servers);
|
||||||
|
default = defaultServer;
|
||||||
|
description = "YAML LSP server to use";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = either package (listOf str);
|
||||||
|
default = servers.${cfg.lsp.server}.package;
|
||||||
|
description = "YAML LSP server package";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.yaml-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
@ -3,51 +3,24 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkDefault;
|
||||||
inherit (lib.strings) optionalString;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding;
|
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp;
|
||||||
self = import ./lspsaga.nix {inherit lib;};
|
|
||||||
|
|
||||||
mappingDefinitions = self.options.vim.lsp.lspsaga.mappings;
|
|
||||||
mappings = addDescriptionsToMappings cfg.lspsaga.mappings mappingDefinitions;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable && cfg.lspsaga.enable) {
|
config = mkIf (cfg.enable && cfg.lspsaga.enable) {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["lspsaga-nvim"];
|
lazy.plugins.lspsaga-nvim = {
|
||||||
|
package = "lspsaga-nvim";
|
||||||
|
setupModule = "lspsaga";
|
||||||
|
inherit (cfg.lspsaga) setupOpts;
|
||||||
|
|
||||||
maps = {
|
event = ["LspAttach"];
|
||||||
visual = mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').range_code_action";
|
|
||||||
normal = mkMerge [
|
|
||||||
(mkSetLuaBinding mappings.lspFinder "require('lspsaga.provider').lsp_finder")
|
|
||||||
(mkSetLuaBinding mappings.renderHoveredDoc "require('lspsaga.hover').render_hover_doc")
|
|
||||||
|
|
||||||
(mkSetLuaBinding mappings.smartScrollUp "function() require('lspsaga.action').smart_scroll_with_saga(-1) end")
|
|
||||||
(mkSetLuaBinding mappings.smartScrollDown "function() require('lspsaga.action').smart_scroll_with_saga(1) end")
|
|
||||||
|
|
||||||
(mkSetLuaBinding mappings.rename "require('lspsaga.rename').rename")
|
|
||||||
(mkSetLuaBinding mappings.previewDefinition "require('lspsaga.provider').preview_definition")
|
|
||||||
|
|
||||||
(mkSetLuaBinding mappings.showLineDiagnostics "require('lspsaga.diagnostic').show_line_diagnostics")
|
|
||||||
(mkSetLuaBinding mappings.showCursorDiagnostics "require('lspsaga.diagnostic').show_cursor_diagnostics")
|
|
||||||
|
|
||||||
(mkSetLuaBinding mappings.nextDiagnostic "require('lspsaga.diagnostic').navigate('next')")
|
|
||||||
(mkSetLuaBinding mappings.previousDiagnostic "require('lspsaga.diagnostic').navigate('prev')")
|
|
||||||
|
|
||||||
(mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action")
|
|
||||||
(mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help"))
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pluginRC.lspsaga = entryAnywhere ''
|
# Optional dependencies, pretty useful to enhance default functionality of
|
||||||
require('lspsaga').init_lsp_saga({
|
# Lspsaga.
|
||||||
${optionalString config.vim.ui.borders.plugins.lspsaga.enable ''
|
treesitter.enable = mkDefault true;
|
||||||
border_style = '${config.vim.ui.borders.plugins.lspsaga.style}',
|
visuals.nvim-web-devicons.enable = mkDefault true;
|
||||||
''}
|
|
||||||
})
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,32 @@
|
||||||
{lib, ...}: let
|
{
|
||||||
inherit (lib.options) mkEnableOption;
|
config,
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkRemovedOptionModule;
|
||||||
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.nvim.types) borderType mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
|
imports = [
|
||||||
|
(mkRemovedOptionModule ["vim" "lsp" "lspsaga" "mappings"] ''
|
||||||
|
Lspsaga mappings have been removed from nvf, as the original author has made
|
||||||
|
very drastic changes to the API after taking back ownership, and the fork we
|
||||||
|
used is now archived. Please refer to Lspsaga documentation to add keybinds
|
||||||
|
for functionality you have used.
|
||||||
|
|
||||||
|
<https://nvimdev.github.io/lspsaga>
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
|
||||||
options.vim.lsp.lspsaga = {
|
options.vim.lsp.lspsaga = {
|
||||||
enable = mkEnableOption "LSP Saga";
|
enable = mkEnableOption "LSP Saga";
|
||||||
|
|
||||||
mappings = {
|
setupOpts = mkPluginSetupOption "lspsaga" {
|
||||||
lspFinder = mkMappingOption "LSP Finder [LSPSaga]" "<leader>lf";
|
border_style = mkOption {
|
||||||
renderHoveredDoc = mkMappingOption "Rendered hovered docs [LSPSaga]" "<leader>lh";
|
type = borderType;
|
||||||
|
default = config.vim.ui.borders.globalStyle;
|
||||||
smartScrollUp = mkMappingOption "Smart scroll up [LSPSaga]" "<C-f>";
|
description = "Border type, see {command}`:help nvim_open_win`";
|
||||||
smartScrollDown = mkMappingOption "Smart scroll up [LSPSaga]" "<C-b>";
|
};
|
||||||
|
|
||||||
rename = mkMappingOption "Rename [LSPSaga]" "<leader>lr";
|
|
||||||
previewDefinition = mkMappingOption "Preview definition [LSPSaga]" "<leader>ld";
|
|
||||||
|
|
||||||
showLineDiagnostics = mkMappingOption "Show line diagnostics [LSPSaga]" "<leader>ll";
|
|
||||||
showCursorDiagnostics = mkMappingOption "Show cursor diagnostics [LSPSaga]" "<leader>lc";
|
|
||||||
|
|
||||||
nextDiagnostic = mkMappingOption "Next diagnostic [LSPSaga]" "<leader>ln";
|
|
||||||
previousDiagnostic = mkMappingOption "Previous diagnostic [LSPSaga]" "<leader>lp";
|
|
||||||
|
|
||||||
codeAction = mkMappingOption "Code action [LSPSaga]" "<leader>ca";
|
|
||||||
|
|
||||||
signatureHelp = mkMappingOption "Signature help [LSPSaga]" "<leader>ls";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,8 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
mappings = {
|
mappings = {
|
||||||
viewToggle = mkMappingOption "Open or close the docs view panel" "lvt";
|
viewToggle = mkMappingOption "Open or close the docs view panel" "<leader>lvt";
|
||||||
viewUpdate = mkMappingOption "Manually update the docs view panel" "lvu";
|
viewUpdate = mkMappingOption "Manually update the docs view panel" "<leader>lvu";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,12 @@
|
||||||
mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions;
|
mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions;
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable && cfg.otter-nvim.enable) {
|
config = mkIf (cfg.enable && cfg.otter-nvim.enable) {
|
||||||
assertions = [
|
warnings = [
|
||||||
{
|
# TODO: remove warning when we update to nvim 0.11
|
||||||
assertion = !config.vim.utility.ccc.enable;
|
(mkIf config.vim.utility.ccc.enable ''
|
||||||
message = ''
|
ccc and otter occasionally have small conflicts that will disappear with nvim 0.11.
|
||||||
ccc and otter have a breaking conflict. It's been reported upstream. Until it's fixed, disable one of them
|
In the meantime, otter handles it by throwing a warning, but both plugins will work.
|
||||||
'';
|
'')
|
||||||
}
|
|
||||||
];
|
];
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["otter-nvim"];
|
startPlugins = ["otter-nvim"];
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,13 @@
|
||||||
cfg = config.vim.minimap.minimap-vim;
|
cfg = config.vim.minimap.minimap-vim;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = [
|
vim = {
|
||||||
pkgs.code-minimap
|
startPlugins = ["minimap-vim"];
|
||||||
"minimap-vim"
|
extraPackages = [pkgs.code-minimap];
|
||||||
];
|
|
||||||
|
|
||||||
vim.binds.whichKey.register = pushDownDefault {
|
binds.whichKey.register = pushDownDefault {
|
||||||
"<leader>m" = "+Minimap";
|
"<leader>m" = "+Minimap";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.types) nullOr str bool;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule;
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
|
inherit (lib.strings) isString;
|
||||||
|
inherit (lib.types) nullOr str bool int enum listOf either;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
inherit (lib.nvim.types) luaInline mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
imports = let
|
imports = let
|
||||||
renameSetupOpt = oldPath: newPath:
|
renameSetupOpt = oldPath: newPath:
|
||||||
|
|
@ -50,68 +54,100 @@ in {
|
||||||
usePicker = mkOption {
|
usePicker = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Whether or not we should use dressing.nvim to build a session picker UI";
|
description = ''
|
||||||
|
Whether we should use `dressing.nvim` to build a session picker UI
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
setupOpts = {
|
setupOpts = mkPluginSetupOption "which-key" {
|
||||||
path_replacer = mkOption {
|
path_replacer = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
default = "__";
|
default = "__";
|
||||||
description = "The character to which the path separator will be replaced for session files";
|
description = ''
|
||||||
|
The character to which the path separator will be replaced for session files
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
colon_replacer = mkOption {
|
colon_replacer = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
default = "++";
|
default = "++";
|
||||||
description = "The character to which the colon symbol will be replaced for session files";
|
description = ''
|
||||||
|
The character to which the colon symbol will be replaced for session files
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
autoload_mode = mkOption {
|
autoload_mode = mkOption {
|
||||||
type = types.enum ["Disabled" "CurrentDir" "LastSession"];
|
type = either (enum ["Disabled" "CurrentDir" "LastSession"]) luaInline;
|
||||||
|
# Variable 'sm' is defined in the pluginRC of nvim-session-manager. The
|
||||||
|
# definition is as follows: `local sm = require('session_manager.config')`
|
||||||
|
apply = val:
|
||||||
|
if isString val
|
||||||
|
then mkLuaInline "sm.AutoloadMode.${val}"
|
||||||
|
else val;
|
||||||
default = "LastSession";
|
default = "LastSession";
|
||||||
description = "Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession";
|
description = ''
|
||||||
|
Define what to do when Neovim is started without arguments.
|
||||||
|
|
||||||
|
Takes either one of `"Disabled"`, `"CurrentDir"`, `"LastSession` in which case the value
|
||||||
|
will be inserted into `sm.AutoloadMode.<value>`, or an inline Lua value.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
max_path_length = mkOption {
|
max_path_length = mkOption {
|
||||||
type = types.nullOr types.int;
|
type = nullOr int;
|
||||||
default = 80;
|
default = 80;
|
||||||
description = "Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all";
|
description = ''
|
||||||
|
Shorten the display path if length exceeds this threshold.
|
||||||
|
|
||||||
|
Use `0` if don't want to shorten the path at all
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
autosave_last_session = mkOption {
|
autosave_last_session = mkOption {
|
||||||
type = types.bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Automatically save last session on exit and on session switch";
|
description = ''
|
||||||
|
Automatically save last session on exit and on session switch
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
autosave_ignore_not_normal = mkOption {
|
autosave_ignore_not_normal = mkOption {
|
||||||
type = types.bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed";
|
description = ''
|
||||||
|
Plugin will not save a session when no buffers are opened, or all of them are
|
||||||
|
not writable or listed
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
autosave_ignore_dirs = mkOption {
|
autosave_ignore_dirs = mkOption {
|
||||||
type = types.listOf types.str;
|
type = listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
description = "A list of directories where the session will not be autosaved";
|
description = "A list of directories where the session will not be autosaved";
|
||||||
};
|
};
|
||||||
|
|
||||||
autosave_ignore_filetypes = mkOption {
|
autosave_ignore_filetypes = mkOption {
|
||||||
type = types.listOf types.str;
|
type = listOf str;
|
||||||
default = ["gitcommit"];
|
default = ["gitcommit"];
|
||||||
description = "All buffers of these file types will be closed before the session is saved";
|
description = ''
|
||||||
|
All buffers of these file types will be closed before the session is saved
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
autosave_ignore_buftypes = mkOption {
|
autosave_ignore_buftypes = mkOption {
|
||||||
type = types.listOf types.str;
|
type = listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
description = "All buffers of these buffer types will be closed before the session is saved";
|
description = ''
|
||||||
|
All buffers of these buffer types will be closed before the session is saved
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
autosave_only_in_session = mkOption {
|
autosave_only_in_session = mkOption {
|
||||||
type = types.bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Always autosaves session. If true, only autosaves after a session is active";
|
description = ''
|
||||||
|
Always autosaves session. If `true`, only autosaves after a session is active
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,17 @@
|
||||||
"codedark"
|
"codedark"
|
||||||
"dracula"
|
"dracula"
|
||||||
"everforest"
|
"everforest"
|
||||||
|
"github_dark"
|
||||||
|
"github_light"
|
||||||
|
"github_dark_dimmed"
|
||||||
|
"github_dark_default"
|
||||||
|
"github_light_default"
|
||||||
|
"github_dark_high_contrast"
|
||||||
|
"github_light_high_contrast"
|
||||||
|
"github_dark_colorblind"
|
||||||
|
"github_light_colorblind"
|
||||||
|
"github_dark_tritanopia"
|
||||||
|
"github_light_tritanopia"
|
||||||
"gruvbox"
|
"gruvbox"
|
||||||
"gruvbox_dark"
|
"gruvbox_dark"
|
||||||
"gruvbox_light"
|
"gruvbox_light"
|
||||||
|
|
@ -113,8 +124,6 @@ in {
|
||||||
mkOption {
|
mkOption {
|
||||||
type = enum themesConcatted;
|
type = enum themesConcatted;
|
||||||
default = "auto";
|
default = "auto";
|
||||||
# TODO: xml generation error if the closing '' is on a new line.
|
|
||||||
# issue: https://gitlab.com/rycee/nmd/-/issues/10
|
|
||||||
defaultText = ''`config.vim.theme.name` if theme supports lualine else "auto"'';
|
defaultText = ''`config.vim.theme.name` if theme supports lualine else "auto"'';
|
||||||
description = "Theme for lualine";
|
description = "Theme for lualine";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -195,4 +195,20 @@ in {
|
||||||
vim.cmd.colorscheme("nord")
|
vim.cmd.colorscheme("nord")
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
github = {
|
||||||
|
setup = {
|
||||||
|
style ? "dark",
|
||||||
|
transparent ? false,
|
||||||
|
...
|
||||||
|
}: ''
|
||||||
|
require('github-theme').setup({
|
||||||
|
options = {
|
||||||
|
transparent = ${boolToString transparent},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.cmd[[colorscheme github_${style}]]
|
||||||
|
'';
|
||||||
|
styles = ["dark" "light" "dark_dimmed" "dark_default" "light_default" "dark_high_contrast" "light_high_contrast" "dark_colorblind" "light_colorblind" "dark_tritanopia" "light_tritanopia"];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,11 +102,7 @@ in {
|
||||||
|
|
||||||
setupOpts = mkPluginSetupOption "colorizer" {
|
setupOpts = mkPluginSetupOption "colorizer" {
|
||||||
filetypes = mkOption {
|
filetypes = mkOption {
|
||||||
description = ''
|
type = attrsOf settingSubmodule;
|
||||||
Filetypes to enable on and their option overrides.
|
|
||||||
|
|
||||||
"*" means enable on all filetypes. Filetypes prefixed with "!" are disabled.
|
|
||||||
'';
|
|
||||||
default = {};
|
default = {};
|
||||||
example = {
|
example = {
|
||||||
"*" = {};
|
"*" = {};
|
||||||
|
|
@ -115,13 +111,21 @@ in {
|
||||||
AARRGGBB = false;
|
AARRGGBB = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
type = attrsOf settingSubmodule;
|
description = ''
|
||||||
|
Filetypes to enable on and their option overrides.
|
||||||
|
|
||||||
|
`"*"` means enable on all filetypes. Filetypes prefixed with `"!"` are disabled.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
user_default_options = mkOption {
|
user_default_options = mkOption {
|
||||||
description = "Default options";
|
|
||||||
default = {};
|
|
||||||
type = settingSubmodule;
|
type = settingSubmodule;
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
`user_default_options` is the second parameter to nvim-colorizer's setup function.
|
||||||
|
|
||||||
|
Anything set here is the inverse of the previous setup configuration.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -4,22 +4,20 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
||||||
cfg = config.vim.ui.illuminate;
|
cfg = config.vim.ui.illuminate;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = ["vim-illuminate"];
|
vim = {
|
||||||
|
startPlugins = ["vim-illuminate"];
|
||||||
|
|
||||||
vim.pluginRC.vim-illuminate = entryAnywhere ''
|
# vim-illuminate does not have a setup function. It is instead called 'configure'
|
||||||
require('illuminate').configure({
|
# and does what you expect from a setup function. Wild.
|
||||||
filetypes_denylist = {
|
pluginRC.vim-illuminate = entryAnywhere ''
|
||||||
'dirvish',
|
require('illuminate').configure(${toLuaObject cfg.setupOpts})
|
||||||
'fugitive',
|
|
||||||
'NvimTree',
|
|
||||||
'TelescopePrompt',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,19 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.types) listOf str;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.ui.illuminate = {
|
options.vim.ui.illuminate = {
|
||||||
enable = mkEnableOption "automatically highlight other uses of the word under the cursor [vim-illuminate]";
|
enable = mkEnableOption ''
|
||||||
|
automatically highlight other uses of the word under the cursor [vim-illuminate]
|
||||||
|
'';
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "vim-illuminate" {
|
||||||
|
filetypes_denylist = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = ["dirvish" "fugitive" "NvimTree" "TelescopePrompt"];
|
||||||
|
description = "Filetypes to not illuminate, this overrides `filetypes_allowlist`";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,25 @@
|
||||||
./binds
|
./binds
|
||||||
./ccc
|
./ccc
|
||||||
./diffview
|
./diffview
|
||||||
|
./direnv
|
||||||
./fzf-lua
|
./fzf-lua
|
||||||
./gestures
|
./gestures
|
||||||
|
./harpoon
|
||||||
./icon-picker
|
./icon-picker
|
||||||
./images
|
./images
|
||||||
|
./leetcode-nvim
|
||||||
|
./mkdir
|
||||||
./motion
|
./motion
|
||||||
|
./multicursors
|
||||||
./new-file-template
|
./new-file-template
|
||||||
|
./nix-develop
|
||||||
./outline
|
./outline
|
||||||
./preview
|
./preview
|
||||||
|
./snacks-nvim
|
||||||
./surround
|
./surround
|
||||||
./telescope
|
./telescope
|
||||||
./wakatime
|
./wakatime
|
||||||
./yanky-nvim
|
./yanky-nvim
|
||||||
./leetcode-nvim
|
./yazi-nvim
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
modules/plugins/utility/direnv/config.nix
Normal file
13
modules/plugins/utility/direnv/config.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
|
||||||
|
cfg = config.vim.utility.direnv;
|
||||||
|
in {
|
||||||
|
vim = mkIf cfg.enable {
|
||||||
|
startPlugins = ["direnv-vim"];
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/plugins/utility/direnv/default.nix
Normal file
6
modules/plugins/utility/direnv/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./direnv.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
5
modules/plugins/utility/direnv/direnv.nix
Normal file
5
modules/plugins/utility/direnv/direnv.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkEnableOption;
|
||||||
|
in {
|
||||||
|
options.vim.utility.direnv.enable = mkEnableOption "syncing nvim shell environment with direnv's using `direnv.vim`";
|
||||||
|
}
|
||||||
41
modules/plugins/utility/harpoon/config.nix
Normal file
41
modules/plugins/utility/harpoon/config.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
options,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.binds) pushDownDefault mkKeymap;
|
||||||
|
|
||||||
|
cfg = config.vim.navigation.harpoon;
|
||||||
|
|
||||||
|
keys = cfg.mappings;
|
||||||
|
inherit (options.vim.navigation.harpoon) mappings;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
startPlugins = ["plenary-nvim"];
|
||||||
|
|
||||||
|
lazy.plugins.harpoon = {
|
||||||
|
package = "harpoon";
|
||||||
|
setupModule = "harpoon";
|
||||||
|
inherit (cfg) setupOpts;
|
||||||
|
|
||||||
|
cmd = ["Harpoon"];
|
||||||
|
|
||||||
|
keys = [
|
||||||
|
(mkKeymap "n" keys.markFile "<Cmd>lua require('harpoon'):list():add()<CR>" {desc = mappings.markFile.description;})
|
||||||
|
(mkKeymap "n" keys.listMarks "<Cmd>lua require('harpoon').ui:toggle_quick_menu(require('harpoon'):list())<CR>" {desc = mappings.listMarks.description;})
|
||||||
|
(mkKeymap "n" keys.file1 "<Cmd>lua require('harpoon'):list():select(1)<CR>" {desc = mappings.file1.description;})
|
||||||
|
(mkKeymap "n" keys.file2 "<Cmd>lua require('harpoon'):list():select(2)<CR>" {desc = mappings.file2.description;})
|
||||||
|
(mkKeymap "n" keys.file3 "<Cmd>lua require('harpoon'):list():select(3)<CR>" {desc = mappings.file3.description;})
|
||||||
|
(mkKeymap "n" keys.file4 "<Cmd>lua require('harpoon'):list():select(4)<CR>" {desc = mappings.file4.description;})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
binds.whichKey.register = pushDownDefault {
|
||||||
|
"<leader>a" = "Harpoon Mark";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/plugins/utility/harpoon/default.nix
Normal file
6
modules/plugins/utility/harpoon/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./harpoon.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
53
modules/plugins/utility/harpoon/harpoon.nix
Normal file
53
modules/plugins/utility/harpoon/harpoon.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) bool;
|
||||||
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
in {
|
||||||
|
options.vim.navigation.harpoon = {
|
||||||
|
mappings = {
|
||||||
|
markFile = mkMappingOption "Mark file [Harpoon]" "<leader>a";
|
||||||
|
listMarks = mkMappingOption "List marked files [Harpoon]" "<C-e>";
|
||||||
|
file1 = mkMappingOption "Go to marked file 1 [Harpoon]" "<C-j>";
|
||||||
|
file2 = mkMappingOption "Go to marked file 2 [Harpoon]" "<C-k>";
|
||||||
|
file3 = mkMappingOption "Go to marked file 3 [Harpoon]" "<C-l>";
|
||||||
|
file4 = mkMappingOption "Go to marked file 4 [Harpoon]" "<C-;>";
|
||||||
|
};
|
||||||
|
|
||||||
|
enable = mkEnableOption "Quick bookmarks on keybinds [Harpoon]";
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "Harpoon" {
|
||||||
|
defaults = {
|
||||||
|
save_on_toggle = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Any time the ui menu is closed then we will save the
|
||||||
|
state back to the backing list, not to the fs
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
sync_on_ui_close = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Any time the ui menu is closed then the state of the
|
||||||
|
list will be sync'd back to the fs
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
key = mkOption {
|
||||||
|
type = luaInline;
|
||||||
|
default = mkLuaInline ''
|
||||||
|
function()
|
||||||
|
return vim.loop.cwd()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
How the out list key is looked up. This can be useful
|
||||||
|
when using worktrees and using git remote instead of file path
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
12
modules/plugins/utility/mkdir/config.nix
Normal file
12
modules/plugins/utility/mkdir/config.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
cfg = config.vim.utility.mkdir;
|
||||||
|
in {
|
||||||
|
vim = mkIf cfg.enable {
|
||||||
|
startPlugins = ["mkdir-nvim"];
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/plugins/utility/mkdir/default.nix
Normal file
6
modules/plugins/utility/mkdir/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./mkdir.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
7
modules/plugins/utility/mkdir/mkdir.nix
Normal file
7
modules/plugins/utility/mkdir/mkdir.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkEnableOption;
|
||||||
|
in {
|
||||||
|
options.vim.utility.mkdir.enable = mkEnableOption ''
|
||||||
|
parent directory creation when editing a nested path that does not exist using `mkdir.nvim`
|
||||||
|
'';
|
||||||
|
}
|
||||||
36
modules/plugins/utility/multicursors/config.nix
Normal file
36
modules/plugins/utility/multicursors/config.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
cfg = config.vim.utility.multicursors;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
startPlugins = ["hydra-nvim"];
|
||||||
|
lazy.plugins."multicursors-nvim" = {
|
||||||
|
package = "multicursors-nvim";
|
||||||
|
setupModule = "multicursors";
|
||||||
|
inherit (cfg) setupOpts;
|
||||||
|
|
||||||
|
event = ["DeferredUIEnter"];
|
||||||
|
cmd = ["MCstart" "MCvisual" "MCclear" "MCpattern" "MCvisualPattern" "MCunderCursor"];
|
||||||
|
keys = [
|
||||||
|
{
|
||||||
|
mode = ["v" "n"];
|
||||||
|
key = "<leader>mcs";
|
||||||
|
action = ":MCstart<cr>";
|
||||||
|
desc = "Create a selection for selected text or word under the cursor [multicursors.nvim]";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = ["v" "n"];
|
||||||
|
key = "<leader>mcp";
|
||||||
|
action = ":MCpattern<cr>";
|
||||||
|
desc = "Create a selection for pattern entered [multicursors.nvim]";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/plugins/utility/multicursors/default.nix
Normal file
6
modules/plugins/utility/multicursors/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./multicursors.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
138
modules/plugins/utility/multicursors/multicursors.nix
Normal file
138
modules/plugins/utility/multicursors/multicursors.nix
Normal file
|
|
@ -0,0 +1,138 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.types) attrsOf nullOr bool int str submodule;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
|
||||||
|
hintConfig = {
|
||||||
|
options = {
|
||||||
|
float_opts = mkOption {
|
||||||
|
description = "The options for the floating hint window";
|
||||||
|
type = submodule {
|
||||||
|
options = {
|
||||||
|
border = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "none";
|
||||||
|
description = "The border style for the hint window";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
position = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "bottom";
|
||||||
|
description = "The position of the hint window";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
generateHints = {
|
||||||
|
options = {
|
||||||
|
normal = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = "Generate hints for the normal mode";
|
||||||
|
};
|
||||||
|
|
||||||
|
insert = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = "Generate hints for the insert mode";
|
||||||
|
};
|
||||||
|
|
||||||
|
extend = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = "Generate hints for the extend mode";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkOption {
|
||||||
|
description = "The configuration for generating hints for multicursors.nvim";
|
||||||
|
type = submodule {
|
||||||
|
options = {
|
||||||
|
column_count = mkOption {
|
||||||
|
type = nullOr int;
|
||||||
|
default = null;
|
||||||
|
description = "The number of columns to use for the hint window";
|
||||||
|
};
|
||||||
|
|
||||||
|
max_hint_length = mkOption {
|
||||||
|
type = int;
|
||||||
|
default = 25;
|
||||||
|
description = "The maximum length of the hint";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
default = {
|
||||||
|
column_count = null;
|
||||||
|
max_hint_length = 25;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.utility.multicursors = {
|
||||||
|
enable = mkEnableOption "vscode like multiple cursors [multicursor.nvim]";
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "multicursors" {
|
||||||
|
DEBUG_MODE = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable debug mode.";
|
||||||
|
};
|
||||||
|
|
||||||
|
create_commands = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = "Create Multicursor user commands";
|
||||||
|
};
|
||||||
|
|
||||||
|
updatetime = mkOption {
|
||||||
|
type = int;
|
||||||
|
default = 50;
|
||||||
|
description = "The time in milliseconds to wait before updating the cursor in insert mode";
|
||||||
|
};
|
||||||
|
|
||||||
|
nowait = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = "Don't wait for the cursor to move before updating the cursor";
|
||||||
|
};
|
||||||
|
|
||||||
|
mode_keys = mkOption {
|
||||||
|
type = attrsOf str;
|
||||||
|
default = {
|
||||||
|
insert = "i";
|
||||||
|
append = "a";
|
||||||
|
change = "c";
|
||||||
|
extend = "e";
|
||||||
|
};
|
||||||
|
description = "The keys to use for each mode";
|
||||||
|
};
|
||||||
|
|
||||||
|
hint_config = mkOption {
|
||||||
|
type = submodule hintConfig;
|
||||||
|
default = {
|
||||||
|
float_opts.border = "none";
|
||||||
|
position = "bottom";
|
||||||
|
};
|
||||||
|
description = "The configuration for the hint window";
|
||||||
|
};
|
||||||
|
|
||||||
|
generate_hints = mkOption {
|
||||||
|
type = submodule generateHints;
|
||||||
|
default = {
|
||||||
|
normal = true;
|
||||||
|
insert = true;
|
||||||
|
extend = true;
|
||||||
|
config = {
|
||||||
|
column_count = null;
|
||||||
|
max_hint_length = 25;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
description = "The configuration for generating hints";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
12
modules/plugins/utility/nix-develop/config.nix
Normal file
12
modules/plugins/utility/nix-develop/config.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
cfg = config.vim.utility.nix-develop;
|
||||||
|
in {
|
||||||
|
vim = mkIf cfg.enable {
|
||||||
|
startPlugins = ["nix-develop-nvim"];
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/plugins/utility/nix-develop/default.nix
Normal file
6
modules/plugins/utility/nix-develop/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./nix-develop.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
5
modules/plugins/utility/nix-develop/nix-develop.nix
Normal file
5
modules/plugins/utility/nix-develop/nix-develop.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkEnableOption;
|
||||||
|
in {
|
||||||
|
options.vim.utility.nix-develop.enable = mkEnableOption "in-neovim `nix develop`, `nix shell`, and more using `nix-develop.nvim`";
|
||||||
|
}
|
||||||
20
modules/plugins/utility/snacks-nvim/config.nix
Normal file
20
modules/plugins/utility/snacks-nvim/config.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
||||||
|
cfg = config.vim.utility.snacks-nvim;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
startPlugins = ["snacks-nvim"];
|
||||||
|
pluginRC.snacks-nvim = entryAnywhere ''
|
||||||
|
require("snacks").setup(${toLuaObject cfg.setupOpts});
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/plugins/utility/snacks-nvim/default.nix
Normal file
6
modules/plugins/utility/snacks-nvim/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./snacks-nvim.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
12
modules/plugins/utility/snacks-nvim/snacks-nvim.nix
Normal file
12
modules/plugins/utility/snacks-nvim/snacks-nvim.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkEnableOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
in {
|
||||||
|
options.vim.utility.snacks-nvim = {
|
||||||
|
enable = mkEnableOption ''
|
||||||
|
collection of QoL plugins for Neovim [snacks-nvim]
|
||||||
|
'';
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "snacks-nvim" {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -14,10 +14,11 @@ in {
|
||||||
vim = {
|
vim = {
|
||||||
lazy.plugins.nvim-surround = {
|
lazy.plugins.nvim-surround = {
|
||||||
package = "nvim-surround";
|
package = "nvim-surround";
|
||||||
|
|
||||||
setupModule = "nvim-surround";
|
setupModule = "nvim-surround";
|
||||||
inherit (cfg) setupOpts;
|
inherit (cfg) setupOpts;
|
||||||
|
|
||||||
|
event = ["BufReadPre" "BufNewFile"];
|
||||||
|
|
||||||
keys = [
|
keys = [
|
||||||
(mkLznKey "i" cfg.setupOpts.keymaps.insert)
|
(mkLznKey "i" cfg.setupOpts.keymaps.insert)
|
||||||
(mkLznKey "i" cfg.setupOpts.keymaps.insert_line)
|
(mkLznKey "i" cfg.setupOpts.keymaps.insert_line)
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,13 @@ in {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
nvim-surround: add/change/delete surrounding delimiter pairs with ease.
|
Whether to enable nvim-surround, Neovim plugin to add/change/delete
|
||||||
Note that the default mappings deviate from upstream to avoid conflicts
|
surrounding delimiter pairs with ease.
|
||||||
with nvim-leap.
|
|
||||||
|
::: {.note}
|
||||||
|
The default mappings deviate from upstream to avoid conflicts with nvim-leap.
|
||||||
|
You may change those in your configuration if you do not use nvim-leap
|
||||||
|
:::
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
setupOpts = mkPluginSetupOption "nvim-surround" {
|
setupOpts = mkPluginSetupOption "nvim-surround" {
|
||||||
|
|
@ -61,7 +65,9 @@ in {
|
||||||
useVendoredKeybindings = mkOption {
|
useVendoredKeybindings = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = "Use alternative set of keybindings that avoids conflicts with other popular plugins, e.g. nvim-leap";
|
description = ''
|
||||||
|
Use alternative set of keybindings that avoids conflicts with other popular plugins, e.g. nvim-leap
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
cfg = config.vim.utility.yanky-nvim;
|
cfg = config.vim.utility.yanky-nvim;
|
||||||
usingSqlite = cfg.setupOpts.ring.storage == "sqlite";
|
usingSqlite = cfg.setupOpts.ring.storage == "sqlite";
|
||||||
|
usingShada = cfg.setupOpts.ring.storage == "shada";
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
|
|
@ -28,5 +29,15 @@ in {
|
||||||
require("yanky").setup(${toLuaObject cfg.setupOpts});
|
require("yanky").setup(${toLuaObject cfg.setupOpts});
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = usingShada && ((config.vim.options.shada or "") == "");
|
||||||
|
message = ''
|
||||||
|
Yanky.nvim is configured to use 'shada' for the storage backend, but shada is disabled
|
||||||
|
in 'vim.options'. Please re-enable shada, or switch to a different backend.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) enum;
|
inherit (lib.types) enum;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.utility.yanky-nvim = {
|
options.vim.utility.yanky-nvim = {
|
||||||
enable = mkEnableOption ''
|
enable = mkEnableOption ''
|
||||||
improved Yank and Put functionalities for Neovim [yanky-nvim]
|
improved Yank and Put functionalities for Neovim [yanky-nvim]
|
||||||
'';
|
'';
|
||||||
|
|
||||||
setupOpts = {
|
setupOpts = mkPluginSetupOption "yanky-nvim" {
|
||||||
ring.storage = mkOption {
|
ring.storage = mkOption {
|
||||||
type = enum ["shada" "sqlite" "memory"];
|
type = enum ["shada" "sqlite" "memory"];
|
||||||
default = "shada";
|
default = "shada";
|
||||||
|
|
@ -15,11 +16,11 @@ in {
|
||||||
description = ''
|
description = ''
|
||||||
storage mode for ring values.
|
storage mode for ring values.
|
||||||
|
|
||||||
- shada: this will save pesistantly using Neovim ShaDa feature.
|
- **shada**: this will save pesistantly using Neovim ShaDa feature.
|
||||||
This means that history will be persisted between each session of Neovim.
|
This means that history will be persisted between each session of Neovim.
|
||||||
- memory: each Neovim instance will have his own history and it will be
|
- **memory**: each Neovim instance will have his own history and it will be
|
||||||
lost between sessions.
|
lost between sessions.
|
||||||
- sqlite: more reliable than `shada`, requires `sqlite.lua` as a dependency.
|
- **sqlite**: more reliable than `shada`, requires `sqlite.lua` as a dependency.
|
||||||
nvf will add this dependency to `PATH` automatically.
|
nvf will add this dependency to `PATH` automatically.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
||||||
33
modules/plugins/utility/yazi-nvim/config.nix
Normal file
33
modules/plugins/utility/yazi-nvim/config.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
options,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.binds) mkKeymap;
|
||||||
|
|
||||||
|
cfg = config.vim.utility.yazi-nvim;
|
||||||
|
keys = cfg.mappings;
|
||||||
|
|
||||||
|
inherit (options.vim.utility.yazi-nvim) mappings;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
startPlugins = ["snacks-nvim"];
|
||||||
|
lazy.plugins."yazi.nvim" = {
|
||||||
|
package = pkgs.vimPlugins.yazi-nvim;
|
||||||
|
setupModule = "yazi";
|
||||||
|
inherit (cfg) setupOpts;
|
||||||
|
event = ["BufAdd" "VimEnter"];
|
||||||
|
|
||||||
|
keys = [
|
||||||
|
(mkKeymap "n" keys.openYazi "<cmd>Yazi<CR>" {desc = mappings.openYazi.description;})
|
||||||
|
(mkKeymap "n" keys.openYaziDir "<cmd>Yazi cwd<CR>" {desc = mappings.openYaziDir.description;})
|
||||||
|
(mkKeymap "n" keys.yaziToggle "<cmd>Yazi toggle<CR>" {desc = mappings.yaziToggle.description;})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/plugins/utility/yazi-nvim/default.nix
Normal file
6
modules/plugins/utility/yazi-nvim/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./yazi-nvim.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
26
modules/plugins/utility/yazi-nvim/yazi-nvim.nix
Normal file
26
modules/plugins/utility/yazi-nvim/yazi-nvim.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) bool;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
in {
|
||||||
|
options.vim.utility.yazi-nvim = {
|
||||||
|
enable = mkEnableOption ''
|
||||||
|
companion plugin for the yazi terminal file manager [yazi-nvim]
|
||||||
|
'';
|
||||||
|
|
||||||
|
mappings = {
|
||||||
|
openYazi = mkMappingOption "Open yazi at the current file [yazi.nvim]" "<leader>-";
|
||||||
|
openYaziDir = mkMappingOption "Open the file manager in nvim's working directory [yazi.nvim]" "<leader>cw";
|
||||||
|
yaziToggle = mkMappingOption "Resume the last yazi session [yazi.nvim]" "<c-up>";
|
||||||
|
};
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "yazi-nvim" {
|
||||||
|
open_for_directories = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether to open Yazi instead of netrw";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -6,9 +6,8 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (pkgs) vimPlugins;
|
inherit (pkgs) vimPlugins;
|
||||||
inherit (lib.strings) isString;
|
inherit (lib.trivial) flip;
|
||||||
inherit (lib.lists) filter map;
|
inherit (builtins) path filter isString;
|
||||||
inherit (builtins) path;
|
|
||||||
|
|
||||||
getPin = name: ((pkgs.callPackages ../../../npins/sources.nix {}) // config.vim.pluginOverrides).${name};
|
getPin = name: ((pkgs.callPackages ../../../npins/sources.nix {}) // config.vim.pluginOverrides).${name};
|
||||||
|
|
||||||
|
|
@ -45,7 +44,7 @@
|
||||||
pluginBuilders = {
|
pluginBuilders = {
|
||||||
nvim-treesitter = buildTreesitterPlug config.vim.treesitter.grammars;
|
nvim-treesitter = buildTreesitterPlug config.vim.treesitter.grammars;
|
||||||
flutter-tools-patched = buildPlug {
|
flutter-tools-patched = buildPlug {
|
||||||
pname = "flutter-tools";
|
pname = "flutter-tools-nvim";
|
||||||
patches = [./patches/flutter-tools.patch];
|
patches = [./patches/flutter-tools.patch];
|
||||||
|
|
||||||
# Disable failing require check hook checks
|
# Disable failing require check hook checks
|
||||||
|
|
@ -76,13 +75,6 @@
|
||||||
buildConfigPlugins config.vim.optPlugins
|
buildConfigPlugins config.vim.optPlugins
|
||||||
);
|
);
|
||||||
|
|
||||||
# additional Lua and Python3 packages, mapped to their respective functions
|
|
||||||
# to conform to the format mnw expects. end user should
|
|
||||||
# only ever need to pass a list of packages, which are modified
|
|
||||||
# here
|
|
||||||
extraLuaPackages = ps: map (x: ps.${x}) config.vim.luaPackages;
|
|
||||||
extraPython3Packages = ps: map (x: ps.${x}) config.vim.python3Packages;
|
|
||||||
|
|
||||||
# Wrap the user's desired (unwrapped) Neovim package with arguments that'll be used to
|
# Wrap the user's desired (unwrapped) Neovim package with arguments that'll be used to
|
||||||
# generate a wrapped Neovim package.
|
# generate a wrapped Neovim package.
|
||||||
neovim-wrapped = inputs.mnw.lib.wrap pkgs {
|
neovim-wrapped = inputs.mnw.lib.wrap pkgs {
|
||||||
|
|
@ -92,9 +84,17 @@
|
||||||
extraBinPath = config.vim.extraPackages;
|
extraBinPath = config.vim.extraPackages;
|
||||||
initLua = config.vim.builtLuaConfigRC;
|
initLua = config.vim.builtLuaConfigRC;
|
||||||
luaFiles = config.vim.extraLuaFiles;
|
luaFiles = config.vim.extraLuaFiles;
|
||||||
|
providers = {
|
||||||
|
python3 = {
|
||||||
|
enable = config.vim.withPython3;
|
||||||
|
extraPackages = ps: map (flip builtins.getAttr ps) config.vim.python3Packages;
|
||||||
|
};
|
||||||
|
ruby.enable = config.vim.withRuby;
|
||||||
|
nodeJs.enable = config.vim.withNodeJs;
|
||||||
|
};
|
||||||
|
aliases = lib.optional config.vim.viAlias "vi" ++ lib.optional config.vim.vimAlias "vim";
|
||||||
|
|
||||||
inherit (config.vim) viAlias vimAlias withRuby withNodeJs withPython3;
|
extraLuaPackages = ps: map (flip builtins.getAttr ps) config.vim.luaPackages;
|
||||||
inherit extraLuaPackages extraPython3Packages;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
dummyInit = pkgs.writeText "nvf-init.lua" config.vim.builtLuaConfigRC;
|
dummyInit = pkgs.writeText "nvf-init.lua" config.vim.builtLuaConfigRC;
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,15 @@ in {
|
||||||
startPlugins = ["lz-n" "lzn-auto-require"];
|
startPlugins = ["lz-n" "lzn-auto-require"];
|
||||||
|
|
||||||
optPlugins = pluginPackages;
|
optPlugins = pluginPackages;
|
||||||
|
augroups = [{name = "nvf_lazy_file_hooks";}];
|
||||||
|
autocmds = [
|
||||||
|
{
|
||||||
|
event = ["BufReadPost" "BufNewFile" "BufWritePre"];
|
||||||
|
group = "nvf_lazy_file_hooks";
|
||||||
|
command = "doautocmd User LazyFile";
|
||||||
|
once = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
lazy.builtLazyConfig = ''
|
lazy.builtLazyConfig = ''
|
||||||
require('lz.n').load(${toLuaObject lznSpecs})
|
require('lz.n').load(${toLuaObject lznSpecs})
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
event = mkOption {
|
event = mkOption {
|
||||||
type = nullOr (oneOf [str (listOf str) lznEvent]);
|
type = nullOr (oneOf [str lznEvent (listOf (either str lznEvent))]);
|
||||||
default = null;
|
default = null;
|
||||||
description = "Lazy-load on event";
|
description = "Lazy-load on event";
|
||||||
};
|
};
|
||||||
|
|
@ -172,7 +172,14 @@
|
||||||
description = "Lazy-load on colorscheme.";
|
description = "Lazy-load on colorscheme.";
|
||||||
};
|
};
|
||||||
|
|
||||||
lazy = mkBool false "Lazy-load manually, e.g. using `trigger_load`.";
|
lazy = mkOption {
|
||||||
|
type = nullOr bool;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Force enable/disable lazy-loading. `null` means only lazy-load if
|
||||||
|
a valid lazy-load condition is set e.g. `cmd`, `ft`, `keys` etc.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
priority = mkOption {
|
priority = mkOption {
|
||||||
type = nullOr int;
|
type = nullOr int;
|
||||||
|
|
|
||||||
1193
npins/sources.json
1193
npins/sources.json
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,3 @@
|
||||||
# Based off of:
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/776c3bee4769c616479393aeefceefeda16b6fcb/pkgs/tools/nix/npins/source.nix
|
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
fetchurl,
|
fetchurl,
|
||||||
|
|
@ -8,7 +6,16 @@
|
||||||
}:
|
}:
|
||||||
builtins.mapAttrs
|
builtins.mapAttrs
|
||||||
(
|
(
|
||||||
_: let
|
name: let
|
||||||
|
getUrl = {
|
||||||
|
url,
|
||||||
|
hash,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
fetchurl {
|
||||||
|
inherit url;
|
||||||
|
sha256 = hash;
|
||||||
|
};
|
||||||
getZip = {
|
getZip = {
|
||||||
url,
|
url,
|
||||||
hash,
|
hash,
|
||||||
|
|
@ -23,19 +30,29 @@ builtins.mapAttrs
|
||||||
repository,
|
repository,
|
||||||
revision,
|
revision,
|
||||||
url ? null,
|
url ? null,
|
||||||
|
submodules,
|
||||||
hash,
|
hash,
|
||||||
...
|
...
|
||||||
} @ attrs:
|
} @ attrs:
|
||||||
assert repository ? type;
|
assert repository ? type;
|
||||||
if url != null
|
if url != null && !submodules
|
||||||
then getZip attrs
|
then getZip attrs
|
||||||
else
|
else
|
||||||
assert repository.type == "Git"; let
|
assert repository.type == "Git"; let
|
||||||
urlToName = url: rev: let
|
url' =
|
||||||
matched = builtins.match "^.*/([^/]*)(\\.git)?$" repository.url;
|
if repository.type == "Git"
|
||||||
short = builtins.substring 0 7 rev;
|
then repository.url
|
||||||
|
else if repository.type == "GitHub"
|
||||||
|
then "https://github.com/${repository.owner}/${repository.repo}.git"
|
||||||
|
else if repository.type == "GitLab"
|
||||||
|
then "${repository.server}/${repository.repo_path}.git"
|
||||||
|
else throw "Unrecognized repository type ${repository.type}";
|
||||||
|
|
||||||
|
name = let
|
||||||
|
matched = builtins.match "^.*/([^/]*)(\\.git)?$" url';
|
||||||
|
short = builtins.substring 0 7 revision;
|
||||||
appendShort =
|
appendShort =
|
||||||
if (builtins.match "[a-f0-9]*" rev) != null
|
if (builtins.match "[a-f0-9]*" revision) != null
|
||||||
then "-${short}"
|
then "-${short}"
|
||||||
else "";
|
else "";
|
||||||
in "${
|
in "${
|
||||||
|
|
@ -43,43 +60,53 @@ builtins.mapAttrs
|
||||||
then "source"
|
then "source"
|
||||||
else builtins.head matched
|
else builtins.head matched
|
||||||
}${appendShort}";
|
}${appendShort}";
|
||||||
name = urlToName repository.url revision;
|
|
||||||
in
|
in
|
||||||
fetchgit {
|
fetchgit {
|
||||||
inherit name;
|
inherit name;
|
||||||
inherit (repository) url;
|
url = url';
|
||||||
rev = revision;
|
rev = revision;
|
||||||
sha256 = hash;
|
sha256 = hash;
|
||||||
};
|
fetchSubmodules = submodules;
|
||||||
|
|
||||||
mkPyPiSource = {
|
|
||||||
url,
|
|
||||||
hash,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
fetchurl {
|
|
||||||
inherit url;
|
|
||||||
sha256 = hash;
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
spec:
|
spec:
|
||||||
assert spec ? type; let
|
assert spec ? type; let
|
||||||
|
mayOverride = path: let
|
||||||
|
envVarName = "NPINS_OVERRIDE_${saneName}";
|
||||||
|
saneName = lib.stringAsChars (c:
|
||||||
|
if (builtins.match "[a-zA-Z0-9]" c) == null
|
||||||
|
then "_"
|
||||||
|
else c)
|
||||||
|
name;
|
||||||
|
ersatz = builtins.getEnv envVarName;
|
||||||
|
in
|
||||||
|
if ersatz == ""
|
||||||
|
then path
|
||||||
|
else
|
||||||
|
# this turns the string into an actual Nix path (for both absolute and
|
||||||
|
# relative paths)
|
||||||
|
builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" (
|
||||||
|
if builtins.substring 0 1 ersatz == "/"
|
||||||
|
then /. + ersatz
|
||||||
|
else /. + builtins.getEnv "PWD" + "/${ersatz}"
|
||||||
|
);
|
||||||
func =
|
func =
|
||||||
{
|
{
|
||||||
Git = mkGitSource;
|
Git = mkGitSource;
|
||||||
GitRelease = mkGitSource;
|
GitRelease = mkGitSource;
|
||||||
PyPi = mkPyPiSource;
|
PyPi = getUrl;
|
||||||
Channel = getZip;
|
Channel = getZip;
|
||||||
|
Tarball = getUrl;
|
||||||
}
|
}
|
||||||
.${spec.type}
|
.${spec.type}
|
||||||
or (builtins.throw "Unknown source type ${spec.type}");
|
or (builtins.throw "Unknown source type ${spec.type}");
|
||||||
in
|
in
|
||||||
spec // {outPath = func spec;}
|
spec // {outPath = mayOverride (func spec);}
|
||||||
)
|
)
|
||||||
(
|
(
|
||||||
let
|
let
|
||||||
json = lib.importJSON ./sources.json;
|
json = lib.importJSON ./sources.json;
|
||||||
in
|
in
|
||||||
assert lib.assertMsg (json.version == 3) "Npins version mismatch!";
|
assert lib.assertMsg (json.version == 5) "Npins version mismatch!";
|
||||||
json.pins
|
json.pins
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue