mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-18 16:18:39 +00:00
Compare commits
219 commits
d8829a9de9
...
664b27cb2c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
664b27cb2c | ||
|
|
8384e388c2 | ||
|
98d9f0e622 |
|||
|
|
26ff9dcc9e |
||
|
f7c35ab342 |
|||
|
5278dab32b |
|||
|
eae1f306b8 |
|||
|
c7e49f3703 |
|||
|
dda89a2d9c |
|||
|
|
028bd7b4cb |
||
|
|
cc2c412b88 | ||
|
|
1f7405aaf7 | ||
|
|
997d685c00 |
||
|
ef3928be60 |
|||
|
|
eb4b990b49 |
||
|
c45f28aefd |
|||
|
|
5dff9537d1 |
||
|
099907591a |
|||
|
|
1381a0eee1 |
||
|
|
878cf96f71 | ||
|
|
ea90d2baf3 | ||
|
efa859381f |
|||
| c30f07fcd6 | |||
| 9bd2a6dcb4 | |||
|
|
ea9075a07f | ||
| 52fb95ea6b | |||
| 35c432db3b | |||
| 159a033902 | |||
| 1768791402 | |||
|
3147ef1371 |
|||
|
6f2f28afb1 |
|||
|
bb3ca63d21 |
|||
|
38eed2d69d |
|||
|
5259d1887e |
|||
|
fc6c11631b |
|||
|
|
e60fd89a42 |
||
|
|
c7b7a5d6d4 | ||
|
af0cc1a856 |
|||
|
707bd3b18c |
|||
|
|
8f73019907 | ||
|
d91df07c7b |
|||
|
d407a9ac0f |
|||
|
2bee8b8a9d |
|||
|
43421d5612 |
|||
|
|
990d3598b1 | ||
|
|
8b305e8ed1 |
||
|
3202c4deba |
|||
|
8441eab1b2 |
|||
|
8ab559ccfe |
|||
|
|
3e3d7171c1 | ||
|
|
95e2eec30b | ||
|
|
9220c27e85 | ||
|
4045c458dc |
|||
|
d2cb38ca0e |
|||
|
46979fd94f |
|||
|
682945c79d |
|||
|
499db0e09a |
|||
|
|
6bf57573f1 | ||
|
27c0b5caf3 |
|||
|
fb7f47b375 |
|||
|
57b9735fc7 |
|||
|
|
ae901bb8cb |
||
|
|
b67e151d22 | ||
|
|
afca477b39 |
||
|
|
5db21bae6f | ||
|
|
33be3db04e |
||
|
|
b762752333 |
||
|
|
a6a7bd37f3 | ||
|
|
df0e2060c6 | ||
|
|
99d600f40f | ||
|
|
ef3ab83254 | ||
|
|
92812036cc |
||
|
|
05954eec6d | ||
|
|
1f6e2f3ca4 | ||
|
|
db3a35a116 | ||
|
|
fd7c559ded | ||
|
|
6f3ad1f726 |
||
|
|
11426ea329 | ||
|
|
cdbf2ff370 | ||
|
f516cb43ce |
|||
|
|
f830553166 | ||
|
|
8961142817 | ||
|
920f3c9670 |
|||
|
|
78efcd173c |
||
|
|
3b8595a263 |
||
|
|
a3051d49aa | ||
|
|
acbeb26854 | ||
|
|
1f8a44c432 | ||
|
|
90d09ba05f | ||
|
|
15ad754ad6 |
||
|
|
2b62a441e9 |
||
|
|
f4ee6a275f |
||
|
|
5c3a90e3f6 |
||
|
1ec2e98103 |
|||
|
2e524ce6d5 |
|||
|
|
a436aca603 | ||
|
|
ed31499ad6 |
||
|
|
a6f8df6785 |
||
|
|
28af5c1ff9 | ||
|
67d9aa7cb5 |
|||
|
|
851dbc92fb |
||
|
|
3e4f99311a | ||
|
|
b1212b77ce | ||
|
|
51d76dd515 | ||
|
585dfca7ca |
|||
|
|
edbadf5d5a |
||
|
d407efa323 |
|||
|
|
2ef9022b58 | ||
|
|
eedb3dd8c4 | ||
|
|
da57f955df | ||
|
670f7eacaa |
|||
|
36abe5b79d |
|||
|
9e95859151 |
|||
|
|
cb1d127d2f | ||
|
|
b7c08147e0 | ||
|
|
6e82a568f2 |
||
|
e2b3daa6f8 |
|||
|
|
95c0cc3bb0 | ||
|
0fc84ed868 |
|||
|
|
a1fbdf49fd | ||
|
939c7e98b4 |
|||
|
1a04f40e89 |
|||
|
751601c1db |
|||
|
d5a12efbcb |
|||
|
|
19339ac3cd | ||
|
5a3ac8993a |
|||
|
|
efd67cd82f | ||
|
|
7918b43155 |
||
|
963af1541e |
|||
|
072f7599ae |
|||
|
|
37397706d6 | ||
|
335a878a8f |
|||
|
c5bc6d503e |
|||
|
|
68346ebede |
||
|
335f24a841 |
|||
|
|
45b4f0b319 | ||
|
|
94b5838175 |
||
|
95c991e48d |
|||
|
b49402bccd |
|||
|
a4d59adcf8 |
|||
|
|
514d4da2d3 |
||
|
|
dafe978ffa |
||
|
|
3ae4b3158a |
||
|
ae23c34be1 |
|||
|
6ab36bbd1c |
|||
|
|
c58ba62a8d |
||
|
|
bac61f3c13 |
||
|
|
e4bbf23c58 |
||
|
|
92ae676e54 |
||
|
13b2f7a96d |
|||
|
|
ed20d9d1bb |
||
|
|
b92d9e7e26 |
||
|
|
fa7fb83315 |
||
|
d33286d549 |
|||
|
0751ec831b |
|||
|
|
88d5a499d0 | ||
|
05489d95b6 |
|||
|
722014ca3f |
|||
|
43b99474e6 |
|||
|
5d2d249a46 |
|||
|
fce24ec604 |
|||
|
701dd911eb |
|||
|
736c323c59 |
|||
|
33b4d9da44 |
|||
|
e133d68ecc |
|||
|
b9050558a4 |
|||
|
6914a70e48 |
|||
|
f3f818656d |
|||
|
e7d5e6c4ac |
|||
|
c7df81c3b8 |
|||
|
18d745c08f |
|||
|
84c257efc3 |
|||
|
|
91a167f334 |
||
|
|
e353ae9f71 |
||
|
|
d45763f7e2 |
||
|
|
6f5738da0c |
||
|
|
bc76ced636 |
||
|
|
0db226be84 |
||
|
|
24a3989ddc |
||
|
|
2c153f57e6 |
||
|
|
7cf9e5c0a6 |
||
|
|
a5deffb890 |
||
|
|
09e5a13c61 |
||
|
|
e0bcd93bea |
||
|
|
ab5dbb263e |
||
|
|
543deb5c2a |
||
|
|
b24999300b |
||
|
|
856b064a19 |
||
|
|
6225dff47a |
||
|
|
07384c3887 |
||
|
|
459e97dab7 |
||
|
|
e996999c0b |
||
|
|
a0c94b31d6 |
||
|
|
2bc0492af3 |
||
|
|
7e1ffe40f5 |
||
|
|
6e8b6bf635 |
||
|
aed996eb33 |
|||
|
72c019cc8f |
|||
|
474e8d23e5 |
|||
|
|
5fac618202 |
||
|
|
43843da230 | ||
|
|
d92b3f3714 | ||
|
2aa1879996 |
|||
|
013fcf3648 |
|||
|
|
d6a310252f | ||
|
6095ccfff8 |
|||
|
7a78edac81 |
|||
|
4f92525672 |
|||
|
|
f82ea9650b | ||
|
|
a40c3ff4a2 |
||
|
|
0342e54d04 |
||
|
caf23d3190 |
|||
|
|
7835cbdc1d | ||
|
|
9f8b7edbf6 | ||
|
|
b07d01c65f |
||
|
9074c734b7 |
|||
|
df1b3f7968 |
|||
|
ac59df1bc9 |
|||
|
d8a56fc5f5 |
121 changed files with 2736 additions and 1779 deletions
6
.github/CODEOWNERS
vendored
6
.github/CODEOWNERS
vendored
|
|
@ -1 +1,5 @@
|
||||||
* @NotAShelf
|
# Codeowners should be used to distinguish the maintainers of the project
|
||||||
|
# and not contributors of specific modules to nvf. While adding a new module
|
||||||
|
# please consider adding yourself to 'meta.maintainers' in the module instead
|
||||||
|
# of CODEOWNERS here.
|
||||||
|
* @NotAShelf @horriblename @Soliprem
|
||||||
|
|
|
||||||
25
.github/README.md
vendored
25
.github/README.md
vendored
|
|
@ -200,8 +200,9 @@ fix.
|
||||||
**Q**: What platforms are supported?
|
**Q**: What platforms are supported?
|
||||||
|
|
||||||
**A**: nvf actively supports **Linux and Darwin** platforms using standalone
|
**A**: nvf actively supports **Linux and Darwin** platforms using standalone
|
||||||
Nix, NixOS or Home-Manager. Please take a look at the [nvf manual] for available
|
Nix, NixOS or Home-Manager. It has been reported that **Android** is also
|
||||||
installation instructions.
|
supported through the Home-Manager module, or using standalone package. Please
|
||||||
|
take a look at the [nvf manual] for available installation instructions.
|
||||||
|
|
||||||
**Q**: Can you add _X_?
|
**Q**: Can you add _X_?
|
||||||
|
|
||||||
|
|
@ -246,14 +247,15 @@ Neovim's behaviour with Nix.
|
||||||
|
|
||||||
### Co-Maintainers
|
### Co-Maintainers
|
||||||
|
|
||||||
Alongside myself, nvf is developed by those talented folk:
|
Alongside [myself](https://github.com/notashelf), nvf is developed by those
|
||||||
|
talented folk. nvf would not be what it is today without their invaluable
|
||||||
|
contributions.
|
||||||
|
|
||||||
- [**@horriblename**](https://github.com/horriblename)
|
- [**@horriblename**](https://github.com/horriblename)
|
||||||
([Liberapay](https://liberapay.com/horriblename/))- For actively implementing
|
([Liberapay](https://liberapay.com/horriblename/))- For actively implementing
|
||||||
planned features and quality of life updates.
|
planned features and quality of life updates.
|
||||||
- [**@Diniamo**](https://github.com/Diniamo)
|
- [**@Soliprem**](https://github.com/soliprem) - For rigorously implementing
|
||||||
([Liberapay](https://en.liberapay.com/diniamo/)) - For actively submitting
|
missing features and excellent work on new language modules.
|
||||||
pull requests, issues and assistance with maintenance of nvf.
|
|
||||||
|
|
||||||
Please do remember to extend your thanks (financially or otherwise) if this
|
Please do remember to extend your thanks (financially or otherwise) if this
|
||||||
project has been helpful to you.
|
project has been helpful to you.
|
||||||
|
|
@ -270,14 +272,14 @@ heart-felt thanks to
|
||||||
- [**@FlafyDev**](https://github.com/FlafyDev) - For getting Home-Manager module
|
- [**@FlafyDev**](https://github.com/FlafyDev) - For getting Home-Manager module
|
||||||
to work and Nix assistance.
|
to work and Nix assistance.
|
||||||
- [**@n3oney**](https://github.com/n3oney) - For making custom keybinds finally
|
- [**@n3oney**](https://github.com/n3oney) - For making custom keybinds finally
|
||||||
possible, and other module additions.
|
possible, great ideas and module additions.
|
||||||
- [**@Yavko**](https://github.com/Yavko) - For the amazing **nvf** logo
|
- [**@Yavko**](https://github.com/Yavko) - For the amazing **nvf** logo
|
||||||
- [**@FrothyMarrow**](https://github.com/FrothyMarrow) - For seeing mistakes
|
- [**@FrothyMarrow**](https://github.com/FrothyMarrow) - For seeing mistakes
|
||||||
that I could not.
|
that I could not and contributing good ideas & code.
|
||||||
- [**@Gerg-l**](https://github.com/gerg-l) 🐸 - For the modern Neovim wrapper,
|
- [**@Gerg-l**](https://github.com/gerg-l) 🐸 - For the modern Neovim wrapper,
|
||||||
[mnw], and occasional code improvements.
|
[mnw], and occasional improvements to the codebase.
|
||||||
- [**@Soliprem**](https://github.com/soliprem) - Rigorously implementing missing
|
- [**@Diniamo**](https://github.com/Diniamo) - For actively submitting pull
|
||||||
features and excellent work on new language modules.
|
requests, issues and assistance with co-maintenance of nvf.
|
||||||
|
|
||||||
and everyone who has submitted issues or pull requests!
|
and everyone who has submitted issues or pull requests!
|
||||||
|
|
||||||
|
|
@ -301,7 +303,6 @@ including:
|
||||||
|
|
||||||
I am grateful for their previous work and inspiration, and I wholeheartedly
|
I am grateful for their previous work and inspiration, and I wholeheartedly
|
||||||
recommend checking their work out.
|
recommend checking their work out.
|
||||||
<br/>
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
||||||
56
.github/workflows/check-docs.yml
vendored
56
.github/workflows/check-docs.yml
vendored
|
|
@ -1,56 +0,0 @@
|
||||||
name: "Validate flake & check documentation"
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- docs/**
|
|
||||||
jobs:
|
|
||||||
flake-docs-check:
|
|
||||||
name: Validate Flake Documentation
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
package:
|
|
||||||
- docs
|
|
||||||
- docs-html
|
|
||||||
- docs-manpages
|
|
||||||
- docs-json
|
|
||||||
steps:
|
|
||||||
- name: Install Nix
|
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
|
||||||
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set default git branch (to reduce log spam)
|
|
||||||
run: git config --global init.defaultBranch main
|
|
||||||
|
|
||||||
- name: Build documentation packages
|
|
||||||
run: nix build .#${{ matrix.package }} --print-build-logs
|
|
||||||
|
|
||||||
- name: Get current date
|
|
||||||
id: get-date
|
|
||||||
# output format: 2023-12-22-120000
|
|
||||||
run: echo "date=$(date +'%Y-%m-%d-%H%M%S')" >> ${GITHUB_OUTPUT}
|
|
||||||
|
|
||||||
- name: Upload doc artifacts
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: "${{ matrix.package }}"
|
|
||||||
path: result/share/doc/nvf
|
|
||||||
|
|
||||||
flake-docs-linkcheck:
|
|
||||||
name: Validate hyperlinks in documentation sources
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Install Nix
|
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
|
||||||
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Build documentation packages
|
|
||||||
run: nix build .#docs-linkcheck -Lv
|
|
||||||
129
.github/workflows/check.yml
vendored
129
.github/workflows/check.yml
vendored
|
|
@ -1,4 +1,6 @@
|
||||||
name: "Validate flake & check formatting"
|
name: "Treewide Checks"
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
@ -6,13 +8,13 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- .github/**
|
|
||||||
- assets/**
|
- assets/**
|
||||||
- .gitignore
|
|
||||||
jobs:
|
jobs:
|
||||||
nix-flake-check:
|
nix-flake-check:
|
||||||
name: Validate Flake
|
name: "Validate flake"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -24,8 +26,9 @@ jobs:
|
||||||
run: nix flake check
|
run: nix flake check
|
||||||
|
|
||||||
format-with-alejandra:
|
format-with-alejandra:
|
||||||
name: Formatting via Alejandra
|
name: "Check formatting"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -33,4 +36,118 @@ jobs:
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
- run: nix run nixpkgs#alejandra -- -c .
|
- name: Check formatting via Alejandra
|
||||||
|
run: nix run nixpkgs#alejandra -- --check . --exclude npins
|
||||||
|
|
||||||
|
check-typos:
|
||||||
|
name: "Check source tree for typos"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Check for typos
|
||||||
|
uses: crate-ci/typos@master
|
||||||
|
with:
|
||||||
|
config: .github/typos.toml
|
||||||
|
|
||||||
|
- if: ${{ failure() }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "::error:: Current codebase contains typos that were caught by the CI!"
|
||||||
|
echo "If those typos were intentional, please add them to the ignored regexes in .github/typos.toml"
|
||||||
|
echo "[skip ci] label may be added to the PR title if this is a one-time issue and is safe to ignore"
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
flake-docs-check:
|
||||||
|
name: "Validate documentation builds"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
package:
|
||||||
|
- docs
|
||||||
|
- docs-html
|
||||||
|
- docs-manpages
|
||||||
|
- docs-json
|
||||||
|
steps:
|
||||||
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set default git branch (to reduce log spam)
|
||||||
|
run: git config --global init.defaultBranch main
|
||||||
|
|
||||||
|
- name: Build documentation packages
|
||||||
|
run: nix build .#${{ matrix.package }} --print-build-logs
|
||||||
|
|
||||||
|
- name: Get current date
|
||||||
|
id: get-date
|
||||||
|
# output format: 2023-12-22-120000
|
||||||
|
run: echo "date=$(date +'%Y-%m-%d-%H%M%S')" >> ${GITHUB_OUTPUT}
|
||||||
|
|
||||||
|
- name: Upload doc artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: "${{ matrix.package }}"
|
||||||
|
path: result/share/doc/nvf
|
||||||
|
|
||||||
|
flake-docs-linkcheck:
|
||||||
|
name: "Validate hyperlinks in documentation sources"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
|
steps:
|
||||||
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build linkcheck package
|
||||||
|
run: nix build .#docs-linkcheck -Lv
|
||||||
|
|
||||||
|
check-editorconfig:
|
||||||
|
name: "Validate Editorconfig conformance"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 2 # slows down checkout, but we need to compare against the previous commit on push events
|
||||||
|
|
||||||
|
- name: Get list of changed files from PR
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||||
|
gh api repos/${{ github.repository }}/pulls/${{ github.event.number }}/files --paginate \
|
||||||
|
| jq -r '.[] | select(.status != "removed") | .filename' \
|
||||||
|
> "$HOME/changed_files"
|
||||||
|
else
|
||||||
|
git diff --name-only HEAD^ > "$HOME/changed_files"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Print list of changed files
|
||||||
|
run: |
|
||||||
|
cat "$HOME/changed_files"
|
||||||
|
|
||||||
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
|
- name: Checking Editorconfig conformance
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
< "$HOME/changed_files" nix-shell -p editorconfig-checker --run 'xargs -r editorconfig-checker -disable-indent-size'
|
||||||
|
|
||||||
|
- if: ${{ failure() }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "::error:: Current formatting does not fit convention provided by .editorconfig located in the project root."
|
||||||
|
echo "Please make sure your editor properly integrates editorconfig, Neovim does so by default."
|
||||||
|
echo "See https://editorconfig.org/#download on how to integrate Editorconfig to your editor."
|
||||||
|
exit 1
|
||||||
|
|
|
||||||
6
.github/workflows/cleanup.yml
vendored
6
.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
|
||||||
|
|
|
||||||
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
|
|
||||||
|
|
@ -23,9 +23,8 @@ isMaximal: {
|
||||||
lightbulb.enable = true;
|
lightbulb.enable = true;
|
||||||
lspsaga.enable = false;
|
lspsaga.enable = false;
|
||||||
trouble.enable = true;
|
trouble.enable = true;
|
||||||
lspSignature.enable = true;
|
lspSignature.enable = !isMaximal; # conflicts with blink in maximal
|
||||||
otter-nvim.enable = isMaximal;
|
otter-nvim.enable = isMaximal;
|
||||||
lsplines.enable = isMaximal;
|
|
||||||
nvim-docs-view.enable = isMaximal;
|
nvim-docs-view.enable = isMaximal;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -82,6 +81,7 @@ isMaximal: {
|
||||||
elixir.enable = false;
|
elixir.enable = false;
|
||||||
haskell.enable = false;
|
haskell.enable = false;
|
||||||
ruby.enable = false;
|
ruby.enable = false;
|
||||||
|
fsharp.enable = false;
|
||||||
|
|
||||||
tailwind.enable = false;
|
tailwind.enable = false;
|
||||||
svelte.enable = false;
|
svelte.enable = false;
|
||||||
|
|
@ -124,7 +124,15 @@ isMaximal: {
|
||||||
|
|
||||||
autopairs.nvim-autopairs.enable = true;
|
autopairs.nvim-autopairs.enable = true;
|
||||||
|
|
||||||
autocomplete.nvim-cmp.enable = true;
|
# nvf provides various autocomplete options. The tried and tested nvim-cmp
|
||||||
|
# is enabled in default package, because it does not trigger a build. We
|
||||||
|
# enable blink-cmp in maximal because it needs to build its rust fuzzy
|
||||||
|
# matcher library.
|
||||||
|
autocomplete = {
|
||||||
|
nvim-cmp.enable = !isMaximal;
|
||||||
|
blink-cmp.enable = isMaximal;
|
||||||
|
};
|
||||||
|
|
||||||
snippets.luasnip.enable = true;
|
snippets.luasnip.enable = true;
|
||||||
|
|
||||||
filetree = {
|
filetree = {
|
||||||
|
|
@ -142,6 +150,7 @@ isMaximal: {
|
||||||
binds = {
|
binds = {
|
||||||
whichKey.enable = true;
|
whichKey.enable = true;
|
||||||
cheatsheet.enable = true;
|
cheatsheet.enable = true;
|
||||||
|
hardtime-nvim.enable = isMaximal;
|
||||||
};
|
};
|
||||||
|
|
||||||
telescope.enable = true;
|
telescope.enable = true;
|
||||||
|
|
|
||||||
|
|
@ -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 =
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ plugin to the runtime, you need to add it to the [](#opt-vim.startPlugins) list
|
||||||
in your configuration.
|
in your configuration.
|
||||||
|
|
||||||
Adding a plugin to `startPlugins` will not allow you to configure the plugin
|
Adding a plugin to `startPlugins` will not allow you to configure the plugin
|
||||||
that you have added, but **nvf** provides multiple way of configuring any custom
|
that you have added, but **nvf** provides multiple ways of configuring any custom
|
||||||
plugins that you might have added to your configuration.
|
plugins that you might have added to your configuration.
|
||||||
|
|
||||||
```{=include=} sections
|
```{=include=} sections
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ formatting to diagnostics. The following languages have sections under the
|
||||||
- Lua: [vim.languages.lua.enable](#opt-vim.languages.lua.enable)
|
- Lua: [vim.languages.lua.enable](#opt-vim.languages.lua.enable)
|
||||||
- PHP: [vim.languages.php.enable](#opt-vim.languages.php.enable)
|
- PHP: [vim.languages.php.enable](#opt-vim.languages.php.enable)
|
||||||
- Tex: [vim.languages.tex.enable](#opt-vim.languages.tex.enable)
|
- Tex: [vim.languages.tex.enable](#opt-vim.languages.tex.enable)
|
||||||
|
- F#: [vim.languages.fsharp.enable](#opt-vim.languages.fsharp.enable)
|
||||||
|
|
||||||
Adding support for more languages, and improving support for existing ones are
|
Adding support for more languages, and improving support for existing ones are
|
||||||
great places where you can contribute with a PR.
|
great places where you can contribute with a PR.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# Maximal {#sec-default-maximal}
|
# Maximal {#sec-default-maximal}
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ nix shell github:notashelf/nvf#maximal test.nix
|
$ nix run github:notashelf/nvf#maximal -- test.nix
|
||||||
```
|
```
|
||||||
|
|
||||||
It is the same fully configured Neovim as with the [Nix](#sec-default-nix)
|
It is the same fully configured Neovim as with the [Nix](#sec-default-nix)
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ An example flake that exposes your custom Neovim configuration might look like
|
||||||
theme.enable = true;
|
theme.enable = true;
|
||||||
|
|
||||||
# Enable Treesitter
|
# Enable Treesitter
|
||||||
tree-sitter.enable = true;
|
treesitter.enable = true;
|
||||||
|
|
||||||
# Other options will go here. Refer to the config
|
# Other options will go here. Refer to the config
|
||||||
# reference in Appendix B of the nvf manual.
|
# reference in Appendix B of the nvf manual.
|
||||||
|
|
|
||||||
|
|
@ -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:
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ Release notes for release 0.5
|
||||||
- Updated indent-blankine.nvim to v3 - this comes with a few option changes,
|
- Updated indent-blankine.nvim to v3 - this comes with a few option changes,
|
||||||
which will be migrated with `renamedOptionModule`
|
which will be migrated with `renamedOptionModule`
|
||||||
|
|
||||||
[jacekpoz](https://jacekpoz.pl):
|
[poz](https://poz.pet):
|
||||||
|
|
||||||
- Fixed scrollOffset not being used
|
- Fixed scrollOffset not being used
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap =
|
||||||
|
|
||||||
- Added rose-pine theme.
|
- Added rose-pine theme.
|
||||||
|
|
||||||
[jacekpoz](https://jacekpoz.pl):
|
[poz](https://poz.pet):
|
||||||
|
|
||||||
- Added `vim.autocomplete.alwaysComplete`. Allows users to have the autocomplete
|
- Added `vim.autocomplete.alwaysComplete`. Allows users to have the autocomplete
|
||||||
window popup only when manually activated.
|
window popup only when manually activated.
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ The changes are, in no particular order:
|
||||||
- Add [lz.n] support and lazy-load some builtin plugins.
|
- Add [lz.n] support and lazy-load some builtin plugins.
|
||||||
- Add simpler helper functions for making keymaps
|
- Add simpler helper functions for making keymaps
|
||||||
|
|
||||||
[jacekpoz](https://jacekpoz.pl):
|
[poz](https://poz.pet):
|
||||||
|
|
||||||
[ocaml-lsp]: https://github.com/ocaml/ocaml-lsp
|
[ocaml-lsp]: https://github.com/ocaml/ocaml-lsp
|
||||||
[new-file-template.nvim]: https://github.com/otavioschwanck/new-file-template.nvim
|
[new-file-template.nvim]: https://github.com/otavioschwanck/new-file-template.nvim
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,11 @@
|
||||||
the new API they provide. Please manually set your keybinds according to
|
the new API they provide. Please manually set your keybinds according to
|
||||||
[Lspsaga documentation] following the new API.
|
[Lspsaga documentation] following the new API.
|
||||||
|
|
||||||
|
- none-ls has been updated to the latest version. If you have been using raw Lua
|
||||||
|
configuration to _manually_ configure it, some of the formats may become
|
||||||
|
unavailable as they have been refactored out of the main none-ls repository
|
||||||
|
upstream.
|
||||||
|
|
||||||
[NotAShelf](https://github.com/notashelf):
|
[NotAShelf](https://github.com/notashelf):
|
||||||
|
|
||||||
[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
|
[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
|
||||||
|
|
@ -21,6 +26,7 @@
|
||||||
[yanky.nvim]: https://github.com/gbprod/yanky.nvim
|
[yanky.nvim]: https://github.com/gbprod/yanky.nvim
|
||||||
[yazi.nvim]: https://github.com/mikavilpas/yazi.nvim
|
[yazi.nvim]: https://github.com/mikavilpas/yazi.nvim
|
||||||
[snacks.nvim]: https://github.com/folke/snacks.nvim
|
[snacks.nvim]: https://github.com/folke/snacks.nvim
|
||||||
|
[oil.nvim]: https://github.com/stevearc/oil.nvim
|
||||||
|
|
||||||
- Add [typst-preview.nvim] under
|
- Add [typst-preview.nvim] under
|
||||||
`languages.typst.extensions.typst-preview-nvim`.
|
`languages.typst.extensions.typst-preview-nvim`.
|
||||||
|
|
@ -78,6 +84,13 @@
|
||||||
|
|
||||||
- Lazyload Lspsaga and remove default keybindings for it.
|
- Lazyload Lspsaga and remove default keybindings for it.
|
||||||
|
|
||||||
|
- Add [oil.nvim] as an alternative file explorer. It will be available under
|
||||||
|
`vim.utility.oil-nvim`.
|
||||||
|
|
||||||
|
- Add `vim.diagnostics` to interact with Neovim's diagnostics module. Available
|
||||||
|
options for `vim.diagnostic.config()` can now be customized through the
|
||||||
|
[](#opt-vim.diagnostics.config) in nvf.
|
||||||
|
|
||||||
[amadaluzia](https://github.com/amadaluzia):
|
[amadaluzia](https://github.com/amadaluzia):
|
||||||
|
|
||||||
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
||||||
|
|
@ -88,8 +101,14 @@
|
||||||
|
|
||||||
[blink.cmp]: https://github.com/saghen/blink.cmp
|
[blink.cmp]: https://github.com/saghen/blink.cmp
|
||||||
|
|
||||||
|
- Add [aerial.nvim].
|
||||||
|
- Add [nvim-ufo].
|
||||||
- Add [blink.cmp] support.
|
- Add [blink.cmp] support.
|
||||||
- Add `LazyFile` user event.
|
- Add `LazyFile` user event.
|
||||||
|
- Migrate language modules from none-ls to conform/nvim-lint
|
||||||
|
- Add tsx support in conform and lint
|
||||||
|
- Moved code setting `additionalRuntimePaths` and `enableLuaLoader` out of
|
||||||
|
`luaConfigPre`'s default to prevent being overridden
|
||||||
|
|
||||||
[diniamo](https://github.com/diniamo):
|
[diniamo](https://github.com/diniamo):
|
||||||
|
|
||||||
|
|
@ -98,14 +117,6 @@
|
||||||
- Disable the built-in format-on-save feature of zls. Use `vim.lsp.formatOnSave`
|
- Disable the built-in format-on-save feature of zls. Use `vim.lsp.formatOnSave`
|
||||||
instead.
|
instead.
|
||||||
|
|
||||||
[horriblename](https://github.com/horriblename):
|
|
||||||
|
|
||||||
[aerial.nvim]: (https://github.com/stevearc/aerial.nvim)
|
|
||||||
[nvim-ufo]: (https://github.com/kevinhwang91/nvim-ufo)
|
|
||||||
|
|
||||||
- Add [aerial.nvim].
|
|
||||||
- Add [nvim-ufo].
|
|
||||||
|
|
||||||
[LilleAila](https://github.com/LilleAila):
|
[LilleAila](https://github.com/LilleAila):
|
||||||
|
|
||||||
- Remove `vim.notes.obsidian.setupOpts.dir`, which was set by default. Fixes
|
- Remove `vim.notes.obsidian.setupOpts.dir`, which was set by default. Fixes
|
||||||
|
|
@ -190,6 +201,7 @@
|
||||||
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`.
|
- Add [codecompanion.nvim] plugin under `vim.assistant.codecompanion-nvim`.
|
||||||
|
- Fix [codecompanion-nvim] plugin: nvim-cmp error and setupOpts defaults.
|
||||||
|
|
||||||
[nezia1](https://github.com/nezia1):
|
[nezia1](https://github.com/nezia1):
|
||||||
|
|
||||||
|
|
@ -235,8 +247,9 @@
|
||||||
|
|
||||||
[alfarel](https://github.com/alfarelcynthesis):
|
[alfarel](https://github.com/alfarelcynthesis):
|
||||||
|
|
||||||
- Add missing `yazi.nvim` dependency (`snacks.nvim`).
|
[conform.nvim]: https://github.com/stevearc/conform.nvim
|
||||||
|
|
||||||
|
- Add missing `yazi.nvim` dependency (`snacks.nvim`).
|
||||||
- Add [mkdir.nvim](https://github.com/jghauser/mkdir.nvim) plugin for automatic
|
- Add [mkdir.nvim](https://github.com/jghauser/mkdir.nvim) plugin for automatic
|
||||||
creation of parent directories when editing a nested file.
|
creation of parent directories when editing a nested file.
|
||||||
- Add [nix-develop.nvim](https://github.com/figsoda/nix-develop.nvim) plugin for
|
- Add [nix-develop.nvim](https://github.com/figsoda/nix-develop.nvim) plugin for
|
||||||
|
|
@ -248,6 +261,8 @@
|
||||||
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so
|
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so
|
||||||
blink.cmp can source snippets from it.
|
blink.cmp can source snippets from it.
|
||||||
- Fix [blink.cmp] breaking when built-in sources were modified.
|
- Fix [blink.cmp] breaking when built-in sources were modified.
|
||||||
|
- Fix [conform.nvim] not allowing disabling formatting on and after save. Use
|
||||||
|
`null` value to disable them if conform is enabled.
|
||||||
|
|
||||||
[TheColorman](https://github.com/TheColorman):
|
[TheColorman](https://github.com/TheColorman):
|
||||||
|
|
||||||
|
|
@ -276,3 +291,74 @@
|
||||||
[rice-cracker-dev](https://github.com/rice-cracker-dev):
|
[rice-cracker-dev](https://github.com/rice-cracker-dev):
|
||||||
|
|
||||||
- `eslint_d` now checks for configuration files to load.
|
- `eslint_d` now checks for configuration files to load.
|
||||||
|
- Fix an error where `eslint_d` fails to load.
|
||||||
|
- Add required files support for linters under
|
||||||
|
`vim.diagnostics.nvim-lint.linters.*.required_files`.
|
||||||
|
- Add global function `nvf_lint` under
|
||||||
|
`vim.diagnostics.nvim-lint.lint_function`.
|
||||||
|
|
||||||
|
[Sc3l3t0n](https://github.com/Sc3l3t0n):
|
||||||
|
|
||||||
|
- Add F# support under `vim.languages.fsharp`.
|
||||||
|
|
||||||
|
[venkyr77](https://github.com/venkyr77):
|
||||||
|
|
||||||
|
- Add lint (luacheck) and formatting (stylua) support for Lua.
|
||||||
|
- Add lint (markdownlint-cli2) support for Markdown.
|
||||||
|
- Add catppuccin integration for Bufferline, Lspsaga.
|
||||||
|
- Add `neo-tree`, `snacks.explorer` integrations to `bufferline`.
|
||||||
|
- Add more applicable filetypes to illuminate denylist.
|
||||||
|
- Disable mini.indentscope for applicable filetypes.
|
||||||
|
- Fix fzf-lua having a hard dependency on fzf.
|
||||||
|
- Enable inlay hints support - `config.vim.lsp.inlayHints`.
|
||||||
|
- Add `neo-tree`, `snacks.picker` extensions to `lualine`.
|
||||||
|
|
||||||
|
[tebuevd](https://github.com/tebuevd):
|
||||||
|
|
||||||
|
- Fix `pickers` configuration for `telescope` by nesting it under `setupOpts`
|
||||||
|
- Fix `find_command` configuration for `telescope` by nesting it under
|
||||||
|
`setupOpts.pickers.find_files`
|
||||||
|
- Update default `telescope.setupOpts.pickers.find_files.find_command` to only
|
||||||
|
include files (and therefore exclude directories from results)
|
||||||
|
|
||||||
|
[ckoehler](https://github.com/ckoehler):
|
||||||
|
|
||||||
|
[flash.nvim]: https://github.com/folke/flash.nvim
|
||||||
|
[gitlinker.nvim]: https://github.com/linrongbin16/gitlinker.nvim
|
||||||
|
|
||||||
|
- Fix oil config referencing snacks
|
||||||
|
- Add [flash.nvim] plugin to `vim.utility.motion.flash-nvim`
|
||||||
|
- Fix default telescope ignore list entry for '.git/' to properly match
|
||||||
|
- Add [gitlinker.nvim] plugin to `vim.git.gitlinker-nvim`
|
||||||
|
|
||||||
|
[rrvsh](https://github.com/rrvsh):
|
||||||
|
|
||||||
|
- Fix namespace of python-lsp-server by changing it to python3Packages
|
||||||
|
|
||||||
|
[Noah765](https://github.com/Noah765):
|
||||||
|
|
||||||
|
[vim-sleuth]: https://github.com/tpope/vim-sleuth
|
||||||
|
|
||||||
|
- Add missing `flutter-tools.nvim` dependency `plenary.nvim`.
|
||||||
|
- Add necessary dependency of `flutter-tools.nvim` on lsp.
|
||||||
|
- Add the `vim.languages.dart.flutter-tools.flutterPackage` option.
|
||||||
|
- Fix the type of the `highlight` color options.
|
||||||
|
- Add [vim-sleuth] plugin under `vim.utility.sleuth`.
|
||||||
|
|
||||||
|
[howird](https://github.com/howird):
|
||||||
|
|
||||||
|
- Change python dap adapter name from `python` to commonly expected `debugpy`.
|
||||||
|
|
||||||
|
[aionoid](https://github.com/aionoid):
|
||||||
|
|
||||||
|
- Fix [render-markdown.nvim] file_types option type to list, to accept merging.
|
||||||
|
|
||||||
|
[poz](https://poz.pet):
|
||||||
|
|
||||||
|
- Fix gitsigns null-ls issue.
|
||||||
|
|
||||||
|
[Haskex](https://github.com/haskex):
|
||||||
|
|
||||||
|
[Hardtime.nvim]: https://github.com/m4xshen/hardtime.nvim
|
||||||
|
|
||||||
|
- Add Plugin [Hardtime.nvim] under `vim.binds.hardtime-nvim` with `enable` and `setupOpts` options
|
||||||
|
|
|
||||||
41
flake.lock
generated
41
flake.lock
generated
|
|
@ -5,11 +5,11 @@
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1741352980,
|
"lastModified": 1743550720,
|
||||||
"narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=",
|
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9",
|
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -38,11 +38,11 @@
|
||||||
},
|
},
|
||||||
"mnw": {
|
"mnw": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1742255973,
|
"lastModified": 1746230955,
|
||||||
"narHash": "sha256-XfEGVKatTgEMMOVb4SNp1LYLQOSzzrFTDMVDTZFyMVE=",
|
"narHash": "sha256-X32sM3RQ3X2y6PzfNnX3rhUAlhuITdDOdfSrwZXjlsQ=",
|
||||||
"owner": "Gerg-L",
|
"owner": "Gerg-L",
|
||||||
"repo": "mnw",
|
"repo": "mnw",
|
||||||
"rev": "b982dbd5e6d55d4438832b3567c09bc2a129649d",
|
"rev": "2a1678ba8e4807bd855dd0da94ea2bef5bca733d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -77,11 +77,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1741865919,
|
"lastModified": 1746152631,
|
||||||
"narHash": "sha256-4thdbnP6dlbdq+qZWTsm4ffAwoS8Tiq1YResB+RP6WE=",
|
"narHash": "sha256-zBuvmL6+CUsk2J8GINpyy8Hs1Zp4PP6iBWSmZ4SCQ/s=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "573c650e8a14b2faa0041645ab18aed7e60f0c9a",
|
"rev": "032bc6539bd5f14e9d0c51bd79cfe9a055b094c3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -93,11 +93,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
"nixpkgs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1740877520,
|
"lastModified": 1743296961,
|
||||||
"narHash": "sha256-oiwv/ZK/2FhGxrCkQkB83i7GnWXPPLzoqFHpDD3uYpk=",
|
"narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs.lib",
|
"repo": "nixpkgs.lib",
|
||||||
"rev": "147dee35aab2193b174e4c0868bd80ead5ce755c",
|
"rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -106,22 +106,6 @@
|
||||||
"type": "github"
|
"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": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
|
|
@ -129,7 +113,6 @@
|
||||||
"mnw": "mnw",
|
"mnw": "mnw",
|
||||||
"nil": "nil",
|
"nil": "nil",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nmd": "nmd",
|
|
||||||
"systems": "systems_2"
|
"systems": "systems_2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -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,11 +1,10 @@
|
||||||
{
|
{
|
||||||
|
stdenv,
|
||||||
rustPlatform,
|
rustPlatform,
|
||||||
hostPlatform,
|
|
||||||
vimUtils,
|
vimUtils,
|
||||||
git,
|
gitMinimal,
|
||||||
src,
|
src,
|
||||||
version,
|
version,
|
||||||
fetchpatch,
|
|
||||||
}: let
|
}: let
|
||||||
blink-fuzzy-lib = rustPlatform.buildRustPackage {
|
blink-fuzzy-lib = rustPlatform.buildRustPackage {
|
||||||
pname = "blink-fuzzy-lib";
|
pname = "blink-fuzzy-lib";
|
||||||
|
|
@ -15,15 +14,10 @@
|
||||||
env.RUSTC_BOOTSTRAP = true;
|
env.RUSTC_BOOTSTRAP = true;
|
||||||
|
|
||||||
useFetchCargoVendor = true;
|
useFetchCargoVendor = true;
|
||||||
cargoHash = "sha256-F1wh/TjYoiIbDY3J/prVF367MKk3vwM7LqOpRobOs7I=";
|
cargoHash = "sha256-IDoDugtNWQovfSstbVMkKHLBXKa06lxRWmywu4zyS3M=";
|
||||||
|
|
||||||
nativeBuildInputs = [git];
|
nativeBuildInputs = [gitMinimal];
|
||||||
};
|
};
|
||||||
|
|
||||||
libExt =
|
|
||||||
if hostPlatform.isDarwin
|
|
||||||
then "dylib"
|
|
||||||
else "so";
|
|
||||||
in
|
in
|
||||||
vimUtils.buildVimPlugin {
|
vimUtils.buildVimPlugin {
|
||||||
pname = "blink-cmp";
|
pname = "blink-cmp";
|
||||||
|
|
@ -31,22 +25,13 @@ in
|
||||||
|
|
||||||
# blink references a repro.lua which is placed outside the lua/ directory
|
# blink references a repro.lua which is placed outside the lua/ directory
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
preInstall = ''
|
preInstall = let
|
||||||
|
ext = stdenv.hostPlatform.extensions.sharedLibrary;
|
||||||
|
in ''
|
||||||
mkdir -p target/release
|
mkdir -p target/release
|
||||||
ln -s ${blink-fuzzy-lib}/lib/libblink_cmp_fuzzy.${libExt} target/release/libblink_cmp_fuzzy.${libExt}
|
ln -s ${blink-fuzzy-lib}/lib/libblink_cmp_fuzzy${ext} target/release/libblink_cmp_fuzzy${ext}
|
||||||
echo -n "nix" > target/release/version
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Borrowed from nixpkgs
|
|
||||||
# TODO: Remove this patch when updating to next version
|
|
||||||
patches = [
|
|
||||||
(fetchpatch {
|
|
||||||
name = "blink-add-bypass-for-nix.patch";
|
|
||||||
url = "https://github.com/Saghen/blink.cmp/commit/6c83ef1ae34abd7ef9a32bfcd9595ac77b61037c.diff?full_index=1";
|
|
||||||
hash = "sha256-304F1gDDKVI1nXRvvQ0T1xBN+kHr3jdmwMMp8CNl+GU=";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
# Module for reproducing issues
|
# Module for reproducing issues
|
||||||
nvimSkipModule = ["repro"];
|
nvimSkipModules = ["repro"];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix
|
|
||||||
{lib}: let
|
{lib}: let
|
||||||
inherit (builtins) isString getAttr;
|
inherit (builtins) isString getAttr;
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.types) bool;
|
inherit (lib.types) listOf bool str submodule attrsOf anything either nullOr;
|
||||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
|
inherit (lib.nvim.types) luaInline;
|
||||||
in {
|
in {
|
||||||
|
# TODO: remove
|
||||||
diagnosticsToLua = {
|
diagnosticsToLua = {
|
||||||
lang,
|
lang,
|
||||||
config,
|
config,
|
||||||
|
|
@ -32,4 +33,48 @@ in {
|
||||||
type = bool;
|
type = bool;
|
||||||
description = "Turn on ${desc} for enabled languages by default";
|
description = "Turn on ${desc} for enabled languages by default";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lspOptions = submodule {
|
||||||
|
freeformType = attrsOf anything;
|
||||||
|
options = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = "Whether to enable this LSP server.";
|
||||||
|
};
|
||||||
|
|
||||||
|
capabilities = mkOption {
|
||||||
|
type = nullOr (either luaInline (attrsOf anything));
|
||||||
|
default = null;
|
||||||
|
description = "LSP capabilitiess to pass to lspconfig";
|
||||||
|
};
|
||||||
|
|
||||||
|
on_attach = mkOption {
|
||||||
|
type = nullOr luaInline;
|
||||||
|
default = null;
|
||||||
|
description = "Function to execute when an LSP server attaches to a buffer";
|
||||||
|
};
|
||||||
|
|
||||||
|
filetypes = mkOption {
|
||||||
|
type = nullOr (listOf str);
|
||||||
|
default = null;
|
||||||
|
description = "Filetypes to auto-attach LSP in";
|
||||||
|
};
|
||||||
|
|
||||||
|
cmd = mkOption {
|
||||||
|
type = nullOr (listOf str);
|
||||||
|
default = null;
|
||||||
|
description = "Command used to start the LSP server";
|
||||||
|
};
|
||||||
|
|
||||||
|
root_markers = mkOption {
|
||||||
|
type = nullOr (listOf str);
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
"root markers" used to determine the root directory of the workspace, and
|
||||||
|
the filetypes associated with this LSP server.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,13 @@ in {
|
||||||
their behaviour was abstract, and confusing. Please use 'vim.options' or 'vim.luaConfigRC'
|
their behaviour was abstract, and confusing. Please use 'vim.options' or 'vim.luaConfigRC'
|
||||||
to replicate previous behaviour.
|
to replicate previous behaviour.
|
||||||
'')
|
'')
|
||||||
|
|
||||||
|
# 2025-04-04
|
||||||
|
(mkRemovedOptionModule ["vim" "lsp" "lsplines"] ''
|
||||||
|
lsplines module has been removed from nvf, as its functionality is now built into Neovim
|
||||||
|
under the diagnostics module. Please consider using one of 'vim.diagnostics.config' or
|
||||||
|
'vim.luaConfigRC' to configure LSP lines for Neovim through its own diagnostics API.
|
||||||
|
'')
|
||||||
]
|
]
|
||||||
|
|
||||||
# Migrated via batchRenameOptions. Further batch renames must be below this line.
|
# Migrated via batchRenameOptions. Further batch renames must be below this line.
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
mkEnableOption ""
|
mkEnableOption ""
|
||||||
// {
|
// {
|
||||||
default = true;
|
default = true;
|
||||||
description = "Whether to enable this autocommand";
|
description = "Whether to enable this autocommand.";
|
||||||
};
|
};
|
||||||
|
|
||||||
event = mkOption {
|
event = mkOption {
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
type = nullOr (listOf str);
|
type = nullOr (listOf str);
|
||||||
default = null;
|
default = null;
|
||||||
example = ["*.lua" "*.vim"];
|
example = ["*.lua" "*.vim"];
|
||||||
description = "The file pattern(s) that determine when the autocommand applies).";
|
description = "The file pattern(s) that determine when the autocommand applies.";
|
||||||
};
|
};
|
||||||
|
|
||||||
callback = mkOption {
|
callback = mkOption {
|
||||||
|
|
@ -44,13 +44,16 @@
|
||||||
end
|
end
|
||||||
''''
|
''''
|
||||||
'';
|
'';
|
||||||
description = "The file pattern(s) that determine when the autocommand applies.";
|
description = "Lua function to be called when the event(s) are triggered.";
|
||||||
};
|
};
|
||||||
|
|
||||||
command = mkOption {
|
command = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
description = "Vim command string instead of a Lua function.";
|
description = ''
|
||||||
|
Vim command to be executed when the event(s) are triggered.
|
||||||
|
Cannot be defined if the `callback` option is already defined.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
group = mkOption {
|
group = mkOption {
|
||||||
|
|
@ -70,7 +73,7 @@
|
||||||
once = mkOption {
|
once = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Whether autocommand run only once.";
|
description = "Whether to run the autocommand only once.";
|
||||||
};
|
};
|
||||||
|
|
||||||
nested = mkOption {
|
nested = mkOption {
|
||||||
|
|
@ -87,7 +90,7 @@
|
||||||
mkEnableOption ""
|
mkEnableOption ""
|
||||||
// {
|
// {
|
||||||
default = true;
|
default = true;
|
||||||
description = "Whether to enable this autogroup";
|
description = "Whether to enable this autocommand group.";
|
||||||
};
|
};
|
||||||
|
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
|
|
@ -118,8 +121,8 @@ in {
|
||||||
autocommands together. Groups allow multiple autocommands to be cleared
|
autocommands together. Groups allow multiple autocommands to be cleared
|
||||||
or redefined collectively, preventing duplicate definitions.
|
or redefined collectively, preventing duplicate definitions.
|
||||||
|
|
||||||
Each autogroup consists of a name, a boolean indicating whether to clear
|
Each autogroup consists of a name and a boolean indicating whether to clear
|
||||||
existing autocommands, and a list of associated autocommands.
|
existing autocommands.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -129,8 +132,8 @@ in {
|
||||||
description = ''
|
description = ''
|
||||||
A list of Neovim autocommands to be registered.
|
A list of Neovim autocommands to be registered.
|
||||||
|
|
||||||
Each entry defines an autocommand, specifying events, patterns, optional
|
Each entry defines an autocommand, specifying events, patterns, a callback or Vim
|
||||||
callbacks, commands, groups, and execution settings.
|
command, an optional group, a description, and execution settings.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@
|
||||||
./autocmds.nix
|
./autocmds.nix
|
||||||
./basic.nix
|
./basic.nix
|
||||||
./debug.nix
|
./debug.nix
|
||||||
|
./diagnostics.nix
|
||||||
./highlight.nix
|
./highlight.nix
|
||||||
|
./lsp.nix
|
||||||
./spellcheck.nix
|
./spellcheck.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
109
modules/neovim/init/diagnostics.nix
Normal file
109
modules/neovim/init/diagnostics.nix
Normal file
|
|
@ -0,0 +1,109 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
|
inherit (lib.types) attrsOf anything oneOf bool submodule;
|
||||||
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
inherit (lib.nvim.types) luaInline;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
|
cfg = config.vim.diagnostics;
|
||||||
|
|
||||||
|
# Takes a boolean, a table, or a Lua list ({key = value}). We
|
||||||
|
# would like to allow all of those types, while clearly expressing
|
||||||
|
# them in the option's type. As such, this type is what it is.
|
||||||
|
diagnosticType = oneOf [(attrsOf anything) bool luaInline];
|
||||||
|
diagnosticsSubmodule = submodule {
|
||||||
|
# The table might need to be extended, so let's allow that case
|
||||||
|
# with a freeform type of what is supported by diagnostics opts.
|
||||||
|
freeformType = attrsOf diagnosticType;
|
||||||
|
options = {
|
||||||
|
underline = mkOption {
|
||||||
|
type = diagnosticType;
|
||||||
|
default = true;
|
||||||
|
description = "Use underline for diagnostics.";
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual_text = mkOption {
|
||||||
|
type = diagnosticType;
|
||||||
|
default = false;
|
||||||
|
example = literalExpression ''
|
||||||
|
{
|
||||||
|
format = lib.generators.mkLuaInline '''
|
||||||
|
function(diagnostic)
|
||||||
|
return string.format("%s (%s)", diagnostic.message, diagnostic.source)
|
||||||
|
end
|
||||||
|
''';
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
Use virtual text for diagnostics. If multiple diagnostics are set for a namespace,
|
||||||
|
one prefix per diagnostic + the last diagnostic message are shown.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual_lines = mkOption {
|
||||||
|
type = diagnosticType;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Use virtual lines for diagnostics.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
signs = mkOption {
|
||||||
|
type = diagnosticType;
|
||||||
|
default = false;
|
||||||
|
example = {
|
||||||
|
signs.text = {
|
||||||
|
"vim.diagnostic.severity.ERROR" = " ";
|
||||||
|
"vim.diagnostic.severity.WARN" = " ";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
|
Use signs for diagnostics. See {command}`:help diagnostic-signs`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
update_in_insert = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Update diagnostics in Insert mode. If `false`, diagnostics will
|
||||||
|
be updated on InsertLeave ({command}`:help InsertLeave`).
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim = {
|
||||||
|
diagnostics = {
|
||||||
|
enable = mkEnableOption "diagostics module for Neovim";
|
||||||
|
config = mkOption {
|
||||||
|
type = diagnosticsSubmodule;
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
Values that will be passed to `vim.diagnostic.config` after being converted
|
||||||
|
to a Lua table. Possible values for each key can be found in the help text
|
||||||
|
for `vim.diagnostics.Opts`. You may find more about the diagnostics API of
|
||||||
|
Neovim in {command}`:help diagnostic-api`.
|
||||||
|
|
||||||
|
:::{.note}
|
||||||
|
This option is freeform. You may set values that are not present in nvf
|
||||||
|
documentation, but those values will not be fully type checked. Please
|
||||||
|
refer to the help text for `vim.diagnostic.Opts` for appropriate values.
|
||||||
|
:::
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config.vim = mkIf cfg.enable {
|
||||||
|
luaConfigRC.diagnostics = entryAfter ["basic"] ''
|
||||||
|
vim.diagnostic.config(${toLuaObject cfg.config})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -5,15 +5,14 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.types) nullOr attrsOf listOf submodule bool ints str enum;
|
inherit (lib.types) nullOr attrsOf listOf submodule bool ints str enum;
|
||||||
inherit (lib.strings) hasPrefix concatLines;
|
inherit (lib.strings) concatLines;
|
||||||
inherit (lib.attrsets) mapAttrsToList;
|
inherit (lib.attrsets) mapAttrsToList;
|
||||||
inherit (lib.nvim.dag) entryBetween;
|
inherit (lib.nvim.dag) entryBetween;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.nvim.types) hexColor;
|
|
||||||
|
|
||||||
mkColorOption = target:
|
mkColorOption = target:
|
||||||
mkOption {
|
mkOption {
|
||||||
type = nullOr hexColor;
|
type = nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
example = "#ebdbb2";
|
example = "#ebdbb2";
|
||||||
description = ''
|
description = ''
|
||||||
|
|
|
||||||
82
modules/neovim/init/lsp.nix
Normal file
82
modules/neovim/init/lsp.nix
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) filter;
|
||||||
|
inherit (lib.modules) mkIf mkMerge mkDefault;
|
||||||
|
inherit (lib.options) mkOption;
|
||||||
|
inherit (lib.types) attrsOf;
|
||||||
|
inherit (lib.strings) concatLines;
|
||||||
|
inherit (lib.attrsets) mapAttrsToList attrNames filterAttrs;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
inherit (lib.nvim.languages) lspOptions;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
|
cfg = config.vim.lsp;
|
||||||
|
|
||||||
|
lspConfigurations =
|
||||||
|
mapAttrsToList (
|
||||||
|
name: value: ''
|
||||||
|
vim.lsp.config["${name}"] = ${toLuaObject value}
|
||||||
|
''
|
||||||
|
)
|
||||||
|
cfg.servers;
|
||||||
|
|
||||||
|
enabledServers = filterAttrs (_: u: u.enable) cfg.servers;
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
vim.lsp.servers = mkOption {
|
||||||
|
type = attrsOf lspOptions;
|
||||||
|
default = {};
|
||||||
|
example = ''
|
||||||
|
{
|
||||||
|
"*" = {
|
||||||
|
root_markers = [".git"];
|
||||||
|
capabilities = {
|
||||||
|
textDocument = {
|
||||||
|
semanticTokens = {
|
||||||
|
multilineTokenSupport = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"clangd" = {
|
||||||
|
filetypes = ["c"];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
LSP configurations that will be managed using `vim.lsp.config()` and
|
||||||
|
related utilities added in Neovim 0.11. LSPs defined here will be
|
||||||
|
added to the resulting {file}`init.lua` using `vim.lsp.config` and
|
||||||
|
enabled through `vim.lsp.enable` below the configuration table.
|
||||||
|
|
||||||
|
You may review the generated configuration by running {command}`nvf-print-config`
|
||||||
|
in a shell. Please see {command}`:help lsp-config` for more details
|
||||||
|
on the underlying API.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkMerge [
|
||||||
|
{
|
||||||
|
vim.lsp.servers."*" = {
|
||||||
|
capabilities = mkDefault (mkLuaInline "capabilities");
|
||||||
|
on_attach = mkDefault (mkLuaInline "default_on_attach");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
(mkIf (cfg.servers != {}) {
|
||||||
|
vim.luaConfigRC.lsp-servers = entryAnywhere ''
|
||||||
|
-- Individual LSP configurations managed by nvf.
|
||||||
|
${concatLines lspConfigurations}
|
||||||
|
|
||||||
|
-- Enable configured LSPs explicitly
|
||||||
|
vim.lsp.enable(${toLuaObject (filter (name: name != "*") (attrNames enabledServers))})
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -30,7 +30,16 @@
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["chatgpt-nvim"];
|
startPlugins = [
|
||||||
|
"chatgpt-nvim"
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
"nui-nvim"
|
||||||
|
"plenary-nvim"
|
||||||
|
];
|
||||||
|
|
||||||
|
# ChatGPT.nvim explicitly depends on Telescope.
|
||||||
|
telescope.enable = true;
|
||||||
|
|
||||||
pluginRC.chagpt = entryAnywhere ''
|
pluginRC.chagpt = entryAnywhere ''
|
||||||
require("chatgpt").setup(${toLuaObject cfg.setupOpts})
|
require("chatgpt").setup(${toLuaObject cfg.setupOpts})
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,14 @@ in {
|
||||||
|
|
||||||
setupOpts = mkPluginSetupOption "codecompanion-nvim" {
|
setupOpts = mkPluginSetupOption "codecompanion-nvim" {
|
||||||
opts = {
|
opts = {
|
||||||
send_code = mkEnableOption "code from being sent to the LLM.";
|
send_code =
|
||||||
|
mkEnableOption ""
|
||||||
|
// {
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Whether to enable code being sent to the LLM.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
log_level = mkOption {
|
log_level = mkOption {
|
||||||
type = enum ["DEBUG" "INFO" "ERROR" "TRACE"];
|
type = enum ["DEBUG" "INFO" "ERROR" "TRACE"];
|
||||||
|
|
@ -30,7 +37,10 @@ in {
|
||||||
mkEnableOption ""
|
mkEnableOption ""
|
||||||
// {
|
// {
|
||||||
default = true;
|
default = true;
|
||||||
description = "a diff view to see the changes made by the LLM.";
|
description = ''
|
||||||
|
Whether to enable a diff view
|
||||||
|
to see the changes made by the LLM.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
close_chat_at = mkOption {
|
close_chat_at = mkOption {
|
||||||
|
|
@ -64,7 +74,12 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
chat = {
|
chat = {
|
||||||
auto_scroll = mkEnableOption "automatic page scrolling.";
|
auto_scroll =
|
||||||
|
mkEnableOption ""
|
||||||
|
// {
|
||||||
|
default = true;
|
||||||
|
description = "Whether to enable automatic page scrolling.";
|
||||||
|
};
|
||||||
|
|
||||||
show_settings = mkEnableOption ''
|
show_settings = mkEnableOption ''
|
||||||
LLM settings to appear at the top of the chat buffer.
|
LLM settings to appear at the top of the chat buffer.
|
||||||
|
|
@ -85,14 +100,18 @@ in {
|
||||||
mkEnableOption ""
|
mkEnableOption ""
|
||||||
// {
|
// {
|
||||||
default = true;
|
default = true;
|
||||||
description = "references in the chat buffer.";
|
description = ''
|
||||||
|
Whether to enable references in the chat buffer.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
show_token_count =
|
show_token_count =
|
||||||
mkEnableOption ""
|
mkEnableOption ""
|
||||||
// {
|
// {
|
||||||
default = true;
|
default = true;
|
||||||
description = "the token count for each response.";
|
description = ''
|
||||||
|
Whether to enable the token count for each response.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
intro_message = mkOption {
|
intro_message = mkOption {
|
||||||
|
|
@ -155,7 +174,10 @@ in {
|
||||||
mkEnableOption ""
|
mkEnableOption ""
|
||||||
// {
|
// {
|
||||||
default = true;
|
default = true;
|
||||||
description = "showing default actions in the action palette.";
|
description = ''
|
||||||
|
Whether to enable showing default
|
||||||
|
actions in the action palette.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
show_default_prompt_library =
|
show_default_prompt_library =
|
||||||
|
|
@ -163,7 +185,8 @@ in {
|
||||||
// {
|
// {
|
||||||
default = true;
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
showing default prompt library in the action palette.
|
Whether to enable showing default
|
||||||
|
prompt library in the action palette.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,11 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
treesitter.enable = true;
|
treesitter.enable = true;
|
||||||
|
|
||||||
|
autocomplete.nvim-cmp = {
|
||||||
|
sources = {codecompanion-nvim = "[codecompanion]";};
|
||||||
|
sourcePlugins = ["codecompanion-nvim"];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,19 +43,6 @@ in {
|
||||||
default = {};
|
default = {};
|
||||||
description = "Settings for completion providers.";
|
description = "Settings for completion providers.";
|
||||||
};
|
};
|
||||||
|
|
||||||
transform_items = mkOption {
|
|
||||||
type = nullOr luaInline;
|
|
||||||
default = mkLuaInline "function(_, items) return items end";
|
|
||||||
defaultText = ''
|
|
||||||
Our default does nothing. If you want blink.cmp's default, which
|
|
||||||
lowers the score for snippets, set this option to null.
|
|
||||||
'';
|
|
||||||
description = ''
|
|
||||||
Function to use when transforming the items before they're returned
|
|
||||||
for all providers.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
cmdline = {
|
cmdline = {
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,50 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.diagnostics.nvim-lint;
|
cfg = config.vim.diagnostics.nvim-lint;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkMerge [
|
||||||
|
(mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["nvim-lint"];
|
startPlugins = ["nvim-lint"];
|
||||||
pluginRC.nvim-lint = entryAnywhere ''
|
pluginRC.nvim-lint = entryAnywhere ''
|
||||||
require("lint").linters_by_ft = ${toLuaObject cfg.linters_by_ft}
|
require("lint").linters_by_ft = ${toLuaObject cfg.linters_by_ft}
|
||||||
|
|
||||||
|
local linters = require("lint").linters
|
||||||
|
local nvf_linters = ${toLuaObject cfg.linters}
|
||||||
|
for linter, config in pairs(nvf_linters) do
|
||||||
|
if linters[linter] == nil then
|
||||||
|
linters[linter] = config
|
||||||
|
else
|
||||||
|
for key, val in pairs(config) do
|
||||||
|
linters[linter][key] = val
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
nvf_lint = ${toLuaObject cfg.lint_function}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
})
|
||||||
|
(mkIf (cfg.enable && cfg.lint_after_save) {
|
||||||
|
vim = {
|
||||||
|
augroups = [{name = "nvf_nvim_lint";}];
|
||||||
|
autocmds = [
|
||||||
|
{
|
||||||
|
event = ["BufWritePost"];
|
||||||
|
callback = mkLuaInline ''
|
||||||
|
function(args)
|
||||||
|
nvf_lint(args.buf)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,94 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.types) attrsOf listOf str;
|
inherit (lib.types) nullOr attrsOf listOf str either submodule bool enum;
|
||||||
|
inherit (lib.nvim.types) luaInline;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
|
||||||
|
linterType = submodule {
|
||||||
|
options = {
|
||||||
|
name = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = "Name of the linter";
|
||||||
|
};
|
||||||
|
|
||||||
|
cmd = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = "Command of the linter";
|
||||||
|
};
|
||||||
|
|
||||||
|
args = mkOption {
|
||||||
|
type = nullOr (listOf (either str luaInline));
|
||||||
|
default = null;
|
||||||
|
description = "Arguments to pass";
|
||||||
|
};
|
||||||
|
|
||||||
|
stdin = mkOption {
|
||||||
|
type = nullOr bool;
|
||||||
|
default = null;
|
||||||
|
description = "Send content via stdin.";
|
||||||
|
};
|
||||||
|
|
||||||
|
append_fname = mkOption {
|
||||||
|
type = nullOr bool;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Automatically add the current file name to the commands arguments. Only
|
||||||
|
has an effect if stdin is false
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
stream = mkOption {
|
||||||
|
type = nullOr (enum ["stdout" "stderr" "both"]);
|
||||||
|
default = null;
|
||||||
|
description = "Result stream";
|
||||||
|
};
|
||||||
|
|
||||||
|
ignore_exitcode = mkOption {
|
||||||
|
type = nullOr bool;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Declares if exit code != 1 should be ignored or result in a warning.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
env = mkOption {
|
||||||
|
type = nullOr (attrsOf str);
|
||||||
|
default = null;
|
||||||
|
description = "Environment variables to use";
|
||||||
|
};
|
||||||
|
|
||||||
|
cwd = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = "Working directory of the linter";
|
||||||
|
};
|
||||||
|
|
||||||
|
parser = mkOption {
|
||||||
|
type = nullOr luaInline;
|
||||||
|
default = null;
|
||||||
|
description = "Parser function";
|
||||||
|
};
|
||||||
|
|
||||||
|
required_files = mkOption {
|
||||||
|
type = nullOr (listOf str);
|
||||||
|
default = null;
|
||||||
|
example = ["eslint.config.js"];
|
||||||
|
description = ''
|
||||||
|
Required files to lint. These files must exist relative to the cwd
|
||||||
|
of the linter or else this linter will be skipped
|
||||||
|
|
||||||
|
::: {.note}
|
||||||
|
This option is an nvf extension that only takes effect if you
|
||||||
|
use the `nvf_lint()` lua function.
|
||||||
|
|
||||||
|
See {option}`vim.diagnostics.nvim-lint.lint_function`.
|
||||||
|
:::
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
in {
|
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]";
|
||||||
|
|
@ -21,5 +109,79 @@ in {
|
||||||
accept.
|
accept.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
linters = mkOption {
|
||||||
|
type = attrsOf linterType;
|
||||||
|
default = {};
|
||||||
|
example = ''
|
||||||
|
{
|
||||||
|
phpcs = {
|
||||||
|
args = ["-q" "--report-json" "-"];
|
||||||
|
|
||||||
|
# this will replace the builtin's env table if it exists
|
||||||
|
env = {
|
||||||
|
ENV_VAR = "something";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
Linter configurations. Builtin linters will be updated and not
|
||||||
|
replaced, but note that this is not a deep extend operation, i.e. if
|
||||||
|
you define an `env` option, it will replace the entire `env` table
|
||||||
|
provided by the builtin (if it exists).
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
lint_after_save = mkEnableOption "autocmd to lint after each save" // {default = true;};
|
||||||
|
|
||||||
|
lint_function = mkOption {
|
||||||
|
type = luaInline;
|
||||||
|
default = mkLuaInline ''
|
||||||
|
function(buf)
|
||||||
|
local ft = vim.api.nvim_get_option_value("filetype", { buf = buf })
|
||||||
|
local linters = require("lint").linters
|
||||||
|
local linters_from_ft = require("lint").linters_by_ft[ft]
|
||||||
|
|
||||||
|
-- if no linter is configured for this filetype, stops linting
|
||||||
|
if linters_from_ft == nil then return end
|
||||||
|
|
||||||
|
for _, name in ipairs(linters_from_ft) do
|
||||||
|
local linter = linters[name]
|
||||||
|
assert(linter, 'Linter with name `' .. name .. '` not available')
|
||||||
|
|
||||||
|
if type(linter) == "function" then
|
||||||
|
linter = linter()
|
||||||
|
end
|
||||||
|
-- for require("lint").lint() to work, linter.name must be set
|
||||||
|
linter.name = linter.name or name
|
||||||
|
local cwd = linter.required_files
|
||||||
|
|
||||||
|
-- if no configuration files are configured, lint
|
||||||
|
if cwd == nil then
|
||||||
|
require("lint").lint(linter)
|
||||||
|
else
|
||||||
|
-- if configuration files are configured and present in the project, lint
|
||||||
|
for _, fn in ipairs(cwd) do
|
||||||
|
local path = vim.fs.joinpath(linter.cwd or vim.fn.getcwd(), fn);
|
||||||
|
if vim.uv.fs_stat(path) then
|
||||||
|
require("lint").lint(linter)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
example = literalExpression ''
|
||||||
|
mkLuaInline '''
|
||||||
|
function(buf)
|
||||||
|
require("lint").try_lint()
|
||||||
|
end
|
||||||
|
'''
|
||||||
|
'';
|
||||||
|
description = "Define the global function nvf_lint which is used by nvf to lint.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.types) attrs enum;
|
inherit (lib.types) attrs enum nullOr;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
inherit (lib.nvim.lua) mkLuaInline;
|
inherit (lib.nvim.lua) mkLuaInline;
|
||||||
in {
|
in {
|
||||||
|
|
@ -31,7 +31,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
format_on_save = mkOption {
|
format_on_save = mkOption {
|
||||||
type = attrs;
|
type = nullOr attrs;
|
||||||
default = {
|
default = {
|
||||||
lsp_format = "fallback";
|
lsp_format = "fallback";
|
||||||
timeout_ms = 500;
|
timeout_ms = 500;
|
||||||
|
|
@ -43,7 +43,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
format_after_save = mkOption {
|
format_after_save = mkOption {
|
||||||
type = attrs;
|
type = nullOr attrs;
|
||||||
default = {lsp_format = "fallback";};
|
default = {lsp_format = "fallback";};
|
||||||
description = ''
|
description = ''
|
||||||
Table that will be passed to `conform.format()`. If this
|
Table that will be passed to `conform.format()`. If this
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ in {
|
||||||
./gitsigns
|
./gitsigns
|
||||||
./vim-fugitive
|
./vim-fugitive
|
||||||
./git-conflict
|
./git-conflict
|
||||||
|
./gitlinker-nvim
|
||||||
];
|
];
|
||||||
|
|
||||||
options.vim.git = {
|
options.vim.git = {
|
||||||
|
|
@ -15,6 +16,7 @@ in {
|
||||||
* gitsigns
|
* gitsigns
|
||||||
* vim-fugitive
|
* vim-fugitive
|
||||||
* git-conflict
|
* git-conflict
|
||||||
|
* gitlinker-nvim
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
22
modules/plugins/git/gitlinker-nvim/config.nix
Normal file
22
modules/plugins/git/gitlinker-nvim/config.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
|
||||||
|
cfg = config.vim.git.gitlinker-nvim;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
lazy.plugins = {
|
||||||
|
"gitlinker-nvim" = {
|
||||||
|
package = "gitlinker-nvim";
|
||||||
|
setupModule = "gitlinker";
|
||||||
|
inherit (cfg) setupOpts;
|
||||||
|
cmd = ["GitLink"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/plugins/git/gitlinker-nvim/default.nix
Normal file
6
modules/plugins/git/gitlinker-nvim/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./gitlinker-nvim.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
13
modules/plugins/git/gitlinker-nvim/gitlinker-nvim.nix
Normal file
13
modules/plugins/git/gitlinker-nvim/gitlinker-nvim.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
in {
|
||||||
|
options.vim.git.gitlinker-nvim = {
|
||||||
|
enable = mkEnableOption "gitlinker-nvim" // {default = config.vim.git.enable;};
|
||||||
|
setupOpts = mkPluginSetupOption "gitlinker-nvim" {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) toJSON;
|
inherit (builtins) toJSON;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetExprBinding mkSetLuaBinding pushDownDefault;
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetExprBinding mkSetLuaBinding pushDownDefault;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
@ -32,6 +33,7 @@ in {
|
||||||
return '<Ignore>'
|
return '<Ignore>'
|
||||||
end
|
end
|
||||||
'')
|
'')
|
||||||
|
|
||||||
(mkSetExprBinding gsMappings.previousHunk ''
|
(mkSetExprBinding gsMappings.previousHunk ''
|
||||||
function()
|
function()
|
||||||
if vim.wo.diff then return ${toJSON gsMappings.previousHunk.value} end
|
if vim.wo.diff then return ${toJSON gsMappings.previousHunk.value} end
|
||||||
|
|
@ -77,13 +79,14 @@ in {
|
||||||
}
|
}
|
||||||
|
|
||||||
(mkIf cfg.codeActions.enable {
|
(mkIf cfg.codeActions.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.lsp.null-ls = {
|
||||||
vim.lsp.null-ls.sources.gitsigns-ca = ''
|
enable = true;
|
||||||
table.insert(
|
setupOpts.sources = [
|
||||||
ls_sources,
|
(mkLuaInline ''
|
||||||
null_ls.builtins.code_actions.gitsigns
|
require("null-ls").builtins.code_actions.gitsigns
|
||||||
)
|
'')
|
||||||
'';
|
];
|
||||||
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.types) enum either listOf package str;
|
inherit (lib.types) enum either listOf package str;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
|
|
||||||
cfg = config.vim.languages.astro;
|
cfg = config.vim.languages.astro;
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
package = pkgs.astro-language-server;
|
package = pkgs.astro-language-server;
|
||||||
lspConfig = ''
|
lspConfig = ''
|
||||||
lspconfig.astro.setup {
|
lspconfig.astro.setup {
|
||||||
capabilities = capabilities;
|
capabilities = capabilities,
|
||||||
on_attach = attach_keymaps,
|
on_attach = attach_keymaps,
|
||||||
cmd = ${
|
cmd = ${
|
||||||
if isList cfg.lsp.package
|
if isList cfg.lsp.package
|
||||||
|
|
@ -39,52 +39,35 @@
|
||||||
formats = {
|
formats = {
|
||||||
prettier = {
|
prettier = {
|
||||||
package = pkgs.nodePackages.prettier;
|
package = pkgs.nodePackages.prettier;
|
||||||
nullConfig = ''
|
};
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
prettierd = {
|
||||||
null_ls.builtins.formatting.prettier.with({
|
package = pkgs.prettierd;
|
||||||
command = "${cfg.format.package}/bin/prettier",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
biome = {
|
biome = {
|
||||||
package = pkgs.biome;
|
package = pkgs.biome;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.biome.with({
|
|
||||||
command = "${cfg.format.package}/bin/biome",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: specify packages
|
# TODO: specify packages
|
||||||
defaultDiagnosticsProvider = ["eslint_d"];
|
defaultDiagnosticsProvider = ["eslint_d"];
|
||||||
diagnosticsProviders = {
|
diagnosticsProviders = {
|
||||||
eslint_d = {
|
eslint_d = let
|
||||||
package = pkgs.eslint_d;
|
pkg = pkgs.eslint_d;
|
||||||
nullConfig = pkg: ''
|
in {
|
||||||
table.insert(
|
package = pkg;
|
||||||
ls_sources,
|
config = {
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
cmd = getExe pkg;
|
||||||
command = "${getExe pkg}",
|
required_files = [
|
||||||
condition = function(utils)
|
"eslint.config.js"
|
||||||
return utils.root_has_file({
|
"eslint.config.mjs"
|
||||||
"eslint.config.js",
|
".eslintrc"
|
||||||
"eslint.config.mjs",
|
".eslintrc.json"
|
||||||
".eslintrc",
|
".eslintrc.js"
|
||||||
".eslintrc.json",
|
".eslintrc.yml"
|
||||||
".eslintrc.js",
|
];
|
||||||
".eslintrc.yml",
|
};
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -101,16 +84,16 @@ in {
|
||||||
enable = mkEnableOption "Astro LSP support" // {default = config.vim.languages.enableLSP;};
|
enable = mkEnableOption "Astro LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
|
||||||
server = mkOption {
|
server = mkOption {
|
||||||
description = "Astro LSP server to use";
|
|
||||||
type = enum (attrNames servers);
|
type = enum (attrNames servers);
|
||||||
default = defaultServer;
|
default = defaultServer;
|
||||||
|
description = "Astro LSP server to use";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
description = "Astro LSP server package, or the command to run as a list of strings";
|
|
||||||
example = ''[lib.getExe pkgs.astro-language-server "--minify" "--stdio"]'';
|
|
||||||
type = either package (listOf str);
|
type = either package (listOf str);
|
||||||
default = servers.${cfg.lsp.server}.package;
|
default = servers.${cfg.lsp.server}.package;
|
||||||
|
example = ''[lib.getExe pkgs.astro-language-server "--minify" "--stdio"]'';
|
||||||
|
description = "Astro LSP server package, or the command to run as a list of strings";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -153,16 +136,22 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.astro-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.astro = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "astro";
|
linters_by_ft.astro = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters =
|
||||||
inherit diagnosticsProviders;
|
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) enum either package listOf str bool;
|
inherit (lib.types) enum either package listOf str bool;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
inherit (lib.nvim.types) diagnostics mkGrammarOption;
|
inherit (lib.nvim.types) diagnostics mkGrammarOption;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
|
||||||
|
|
@ -37,14 +37,6 @@
|
||||||
formats = {
|
formats = {
|
||||||
shfmt = {
|
shfmt = {
|
||||||
package = pkgs.shfmt;
|
package = pkgs.shfmt;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.shfmt.with({
|
|
||||||
command = "${pkgs.shfmt}/bin/shfmt",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -52,15 +44,6 @@
|
||||||
diagnosticsProviders = {
|
diagnosticsProviders = {
|
||||||
shellcheck = {
|
shellcheck = {
|
||||||
package = pkgs.shellcheck;
|
package = pkgs.shellcheck;
|
||||||
nullConfig = pkg: ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.diagnostics.shellcheck.with({
|
|
||||||
command = "${pkg}/bin/shellcheck",
|
|
||||||
diagnostics_format = "#{m} [#{c}]"
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -130,16 +113,23 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.bash-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.sh = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "bash";
|
linters_by_ft.sh = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters = mkMerge (map (name: {
|
||||||
inherit diagnosticsProviders;
|
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||||
|
})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) enum either listOf package str;
|
inherit (lib.types) enum either listOf package str;
|
||||||
|
|
@ -42,14 +43,6 @@
|
||||||
formats = {
|
formats = {
|
||||||
prettier = {
|
prettier = {
|
||||||
package = pkgs.nodePackages.prettier;
|
package = pkgs.nodePackages.prettier;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.prettier.with({
|
|
||||||
command = "${cfg.format.package}/bin/prettier",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
prettierd = {
|
prettierd = {
|
||||||
|
|
@ -132,8 +125,13 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.css-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.css = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
|
||||||
cfg = config.vim.languages.dart;
|
cfg = config.vim.languages.dart;
|
||||||
ftcfg = cfg.flutter-tools;
|
ftcfg = cfg.flutter-tools;
|
||||||
|
|
@ -81,16 +81,25 @@ in {
|
||||||
description = "Enable flutter-tools for flutter support";
|
description = "Enable flutter-tools for flutter support";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
flutterPackage = mkOption {
|
||||||
|
type = nullOr package;
|
||||||
|
default = pkgs.flutter;
|
||||||
|
description = "Flutter package, or null to detect the flutter path at runtime instead.";
|
||||||
|
};
|
||||||
|
|
||||||
enableNoResolvePatch = mkOption {
|
enableNoResolvePatch = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
Whether to patch flutter-tools so that it doesn't resolve
|
Whether to patch flutter-tools so that it doesn't resolve
|
||||||
symlinks when detecting flutter path.
|
symlinks when detecting flutter path.
|
||||||
|
|
||||||
This is required if you want to use a flutter package built with nix.
|
::: {.note}
|
||||||
If you are using a flutter SDK installed from a different source
|
This is required if `flutterPackage` is set to null and the flutter
|
||||||
and encounter the error "`dart` missing from PATH", disable this option.
|
package in your `PATH` was built with Nix. If you are using a flutter
|
||||||
|
SDK installed from a different source and encounter the error "`dart`
|
||||||
|
missing from `PATH`", leave this option disabled.
|
||||||
|
:::
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -122,25 +131,32 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config.vim = mkIf cfg.enable (mkMerge [
|
||||||
(mkIf cfg.treesitter.enable {
|
(mkIf cfg.treesitter.enable {
|
||||||
vim.treesitter.enable = true;
|
treesitter.enable = true;
|
||||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
treesitter.grammars = [cfg.treesitter.package];
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.lsp.enable {
|
(mkIf cfg.lsp.enable {
|
||||||
vim.lsp.lspconfig.enable = true;
|
lsp.lspconfig.enable = true;
|
||||||
vim.lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig;
|
lsp.lspconfig.sources.dart-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf ftcfg.enable {
|
(mkIf ftcfg.enable {
|
||||||
vim.startPlugins =
|
lsp.enable = true;
|
||||||
if ftcfg.enableNoResolvePatch
|
|
||||||
then ["flutter-tools-patched"]
|
|
||||||
else ["flutter-tools-nvim"];
|
|
||||||
|
|
||||||
vim.pluginRC.flutter-tools = entryAnywhere ''
|
startPlugins = [
|
||||||
|
(
|
||||||
|
if ftcfg.enableNoResolvePatch
|
||||||
|
then "flutter-tools-patched"
|
||||||
|
else "flutter-tools-nvim"
|
||||||
|
)
|
||||||
|
"plenary-nvim"
|
||||||
|
];
|
||||||
|
|
||||||
|
pluginRC.flutter-tools = entryAfter ["lsp-setup"] ''
|
||||||
require('flutter-tools').setup {
|
require('flutter-tools').setup {
|
||||||
|
${optionalString (ftcfg.flutterPackage != null) "flutter_path = \"${ftcfg.flutterPackage}/bin/flutter\","}
|
||||||
lsp = {
|
lsp = {
|
||||||
color = { -- show the derived colours for dart variables
|
color = { -- show the derived colours for dart variables
|
||||||
enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
|
enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
|
||||||
|
|
@ -152,7 +168,6 @@ in {
|
||||||
|
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = default_on_attach;
|
on_attach = default_on_attach;
|
||||||
flags = lsp_flags,
|
|
||||||
},
|
},
|
||||||
${optionalString cfg.dap.enable ''
|
${optionalString cfg.dap.enable ''
|
||||||
debugger = {
|
debugger = {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
{lib, ...}: let
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
inherit (lib.nvim.languages) mkEnable;
|
inherit (lib.nvim.languages) mkEnable;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
|
|
@ -12,6 +16,7 @@ in {
|
||||||
./css.nix
|
./css.nix
|
||||||
./dart.nix
|
./dart.nix
|
||||||
./elixir.nix
|
./elixir.nix
|
||||||
|
./fsharp.nix
|
||||||
./gleam.nix
|
./gleam.nix
|
||||||
./go.nix
|
./go.nix
|
||||||
./hcl.nix
|
./hcl.nix
|
||||||
|
|
@ -51,7 +56,11 @@ in {
|
||||||
];
|
];
|
||||||
|
|
||||||
options.vim.languages = {
|
options.vim.languages = {
|
||||||
enableLSP = mkEnable "LSP";
|
# LSPs are now built into Neovim, and we should enable them by default
|
||||||
|
# if `vim.lsp.enable` is true.
|
||||||
|
enableLSP = mkEnable "LSP" // {default = config.vim.lsp.enable;};
|
||||||
|
|
||||||
|
# Those are still managed by plugins, and should be enabled here.
|
||||||
enableDAP = mkEnable "Debug Adapter";
|
enableDAP = mkEnable "Debug Adapter";
|
||||||
enableTreesitter = mkEnable "Treesitter";
|
enableTreesitter = mkEnable "Treesitter";
|
||||||
enableFormat = mkEnable "Formatting";
|
enableFormat = mkEnable "Formatting";
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,9 @@
|
||||||
formats = {
|
formats = {
|
||||||
mix = {
|
mix = {
|
||||||
package = pkgs.elixir;
|
package = pkgs.elixir;
|
||||||
nullConfig = ''
|
config = {
|
||||||
table.insert(
|
command = "${cfg.format.package}/bin/mix";
|
||||||
ls_sources,
|
};
|
||||||
null_ls.builtins.formatting.mix.with({
|
|
||||||
command = "${cfg.format.package}/bin/mix",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -107,8 +102,12 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.elixir-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.elixir = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} =
|
||||||
|
formats.${cfg.format.type}.config;
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.elixir-tools.enable {
|
(mkIf cfg.elixir-tools.enable {
|
||||||
|
|
|
||||||
107
modules/plugins/languages/fsharp.nix
Normal file
107
modules/plugins/languages/fsharp.nix
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) either listOf package str enum;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.lists) isList;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
|
||||||
|
defaultServer = "fsautocomplete";
|
||||||
|
servers = {
|
||||||
|
fsautocomplete = {
|
||||||
|
package = pkgs.fsautocomplete;
|
||||||
|
internalFormatter = false;
|
||||||
|
lspConfig = ''
|
||||||
|
lspconfig.fsautocomplete.setup {
|
||||||
|
capabilities = capabilities;
|
||||||
|
on_attach = default_on_attach;
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else "{'${cfg.lsp.package}/bin/fsautocomplete'}"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultFormat = "fantomas";
|
||||||
|
formats = {
|
||||||
|
fantomas = {
|
||||||
|
package = pkgs.fantomas;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
cfg = config.vim.languages.fsharp;
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
vim.languages.fsharp = {
|
||||||
|
enable = mkEnableOption "F# language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "F# treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "fsharp";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "F# LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
server = mkOption {
|
||||||
|
type = enum (attrNames servers);
|
||||||
|
default = defaultServer;
|
||||||
|
description = "F# LSP server to use";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = either package (listOf str);
|
||||||
|
default = servers.${cfg.lsp.server}.package;
|
||||||
|
example = ''[lib.getExe pkgs.fsautocomplete "--state-directory" "~/.cache/fsautocomplete"]'';
|
||||||
|
description = "F# LSP server package, or the command to run as a list of strings";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
format = {
|
||||||
|
enable = mkEnableOption "F# formatting" // {default = config.vim.languages.enableFormat;};
|
||||||
|
|
||||||
|
type = mkOption {
|
||||||
|
type = enum (attrNames formats);
|
||||||
|
default = defaultFormat;
|
||||||
|
description = "F# formatter to use";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
default = formats.${cfg.format.type}.package;
|
||||||
|
description = "F# formatter package";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.fsharp-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.format.enable {
|
||||||
|
vim.formatter.conform-nvim = {
|
||||||
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.fsharp = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption literalMD;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
|
|
@ -38,36 +38,15 @@
|
||||||
formats = {
|
formats = {
|
||||||
gofmt = {
|
gofmt = {
|
||||||
package = pkgs.go;
|
package = pkgs.go;
|
||||||
nullConfig = ''
|
config.command = "${cfg.format.package}/bin/gofmt";
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.gofmt.with({
|
|
||||||
command = "${cfg.format.package}/bin/gofmt",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
gofumpt = {
|
gofumpt = {
|
||||||
package = pkgs.gofumpt;
|
package = pkgs.gofumpt;
|
||||||
nullConfig = ''
|
config.command = getExe cfg.format.package;
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.gofumpt.with({
|
|
||||||
command = "${cfg.format.package}/bin/gofumpt",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
golines = {
|
golines = {
|
||||||
package = pkgs.golines;
|
package = pkgs.golines;
|
||||||
nullConfig = ''
|
config.command = "${cfg.format.package}/bin/golines";
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.golines.with({
|
|
||||||
command = "${cfg.format.package}/bin/golines",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -105,7 +84,14 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
format = {
|
format = {
|
||||||
enable = mkEnableOption "Go formatting" // {default = config.vim.languages.enableFormat;};
|
enable =
|
||||||
|
mkEnableOption "Go formatting"
|
||||||
|
// {
|
||||||
|
default = !cfg.lsp.enable && config.vim.languages.enableFormat;
|
||||||
|
defaultText = literalMD ''
|
||||||
|
disabled if Go LSP is enabled, otherwise follows {option}`vim.languages.enableFormat`
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
type = mkOption {
|
type = mkOption {
|
||||||
description = "Go formatter to use";
|
description = "Go formatter to use";
|
||||||
|
|
@ -153,8 +139,11 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.go-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.go = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.dap.enable {
|
(mkIf cfg.dap.enable {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.types) package bool enum;
|
inherit (lib.types) package bool enum;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
|
@ -30,14 +31,6 @@
|
||||||
formats = {
|
formats = {
|
||||||
hclfmt = {
|
hclfmt = {
|
||||||
package = pkgs.hclfmt;
|
package = pkgs.hclfmt;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.hclfmt.with({
|
|
||||||
command = "${lib.getExe cfg.format.package}",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -110,8 +103,13 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.hcl-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.hcl = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
inherit (lib.types) either package listOf str;
|
inherit (lib.types) either package listOf str;
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
|
|
@ -19,14 +18,6 @@
|
||||||
diagnosticsProviders = {
|
diagnosticsProviders = {
|
||||||
ktlint = {
|
ktlint = {
|
||||||
package = pkgs.ktlint;
|
package = pkgs.ktlint;
|
||||||
nullConfig = pkg: ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.diagnostics.ktlint.with({
|
|
||||||
command = "${getExe pkg}",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -76,11 +67,13 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "kotlin";
|
linters_by_ft.kotlin = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters = mkMerge (map (name: {
|
||||||
inherit diagnosticsProviders;
|
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||||
|
})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,30 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) either listOf package str;
|
inherit (lib.types) bool either enum listOf package str;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) diagnostics mkGrammarOption;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
inherit (lib.nvim.dag) entryBefore;
|
inherit (lib.nvim.dag) entryBefore;
|
||||||
|
|
||||||
cfg = config.vim.languages.lua;
|
cfg = config.vim.languages.lua;
|
||||||
|
defaultFormat = "stylua";
|
||||||
|
formats = {
|
||||||
|
stylua = {
|
||||||
|
package = pkgs.stylua;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultDiagnosticsProvider = ["luacheck"];
|
||||||
|
diagnosticsProviders = {
|
||||||
|
luacheck = {
|
||||||
|
package = pkgs.luajitPackages.luacheck;
|
||||||
|
};
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
(lib.mkRemovedOptionModule ["vim" "languages" "lua" "lsp" "neodev"] ''
|
(lib.mkRemovedOptionModule ["vim" "languages" "lua" "lsp" "neodev"] ''
|
||||||
|
|
@ -39,6 +53,34 @@ in {
|
||||||
|
|
||||||
lazydev.enable = mkEnableOption "lazydev.nvim integration, useful for neovim plugin developers";
|
lazydev.enable = mkEnableOption "lazydev.nvim integration, useful for neovim plugin developers";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
format = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = config.vim.languages.enableFormat;
|
||||||
|
description = "Enable Lua formatting";
|
||||||
|
};
|
||||||
|
type = mkOption {
|
||||||
|
type = enum (attrNames formats);
|
||||||
|
default = defaultFormat;
|
||||||
|
description = "Lua formatter to use";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
default = formats.${cfg.format.type}.package;
|
||||||
|
description = "Lua formatter package";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
extraDiagnostics = {
|
||||||
|
enable = mkEnableOption "extra Lua diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||||
|
types = diagnostics {
|
||||||
|
langDesc = "Lua";
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
inherit defaultDiagnosticsProvider;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkMerge [
|
config = mkMerge [
|
||||||
|
|
@ -74,6 +116,27 @@ in {
|
||||||
})
|
})
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.format.enable {
|
||||||
|
vim.formatter.conform-nvim = {
|
||||||
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.lua = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
|
vim.diagnostics.nvim-lint = {
|
||||||
|
enable = true;
|
||||||
|
linters_by_ft.lua = cfg.extraDiagnostics.types;
|
||||||
|
linters = mkMerge (map (name: {
|
||||||
|
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||||
|
})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
|
};
|
||||||
|
})
|
||||||
]))
|
]))
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,13 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.lists) isList concatLists;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) bool enum either package listOf str;
|
inherit (lib.types) bool enum either package listOf str nullOr;
|
||||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||||
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
inherit (lib.nvim.types) diagnostics mkGrammarOption mkPluginSetupOption;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
||||||
cfg = config.vim.languages.markdown;
|
cfg = config.vim.languages.markdown;
|
||||||
|
|
@ -32,31 +33,23 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultFormat = "denofmt";
|
defaultFormat = "deno_fmt";
|
||||||
formats = {
|
formats = {
|
||||||
|
# for backwards compatibility
|
||||||
denofmt = {
|
denofmt = {
|
||||||
package = pkgs.deno;
|
package = pkgs.deno;
|
||||||
nullConfig = ''
|
};
|
||||||
table.insert(
|
deno_fmt = {
|
||||||
ls_sources,
|
package = pkgs.deno;
|
||||||
null_ls.builtins.formatting.deno_fmt.with({
|
|
||||||
filetypes = ${expToLua (concatLists [cfg.format.extraFiletypes ["markdown"]])},
|
|
||||||
command = "${cfg.format.package}/bin/deno",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
prettierd = {
|
prettierd = {
|
||||||
package = pkgs.prettierd;
|
package = pkgs.prettierd;
|
||||||
nullConfig = ''
|
};
|
||||||
table.insert(
|
};
|
||||||
ls_sources,
|
defaultDiagnosticsProvider = ["markdownlint-cli2"];
|
||||||
null_ls.builtins.formatting.prettierd.with({
|
diagnosticsProviders = {
|
||||||
filetypes = ${expToLua (concatLists [cfg.format.extraFiletypes ["markdown"]])},
|
markdownlint-cli2 = {
|
||||||
command = "${cfg.format.package}/bin/prettierd",
|
package = pkgs.markdownlint-cli2;
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -96,7 +89,7 @@ in {
|
||||||
type = mkOption {
|
type = mkOption {
|
||||||
type = enum (attrNames formats);
|
type = enum (attrNames formats);
|
||||||
default = defaultFormat;
|
default = defaultFormat;
|
||||||
description = "Markdown formatter to use";
|
description = "Markdown formatter to use. `denofmt` is deprecated and currently aliased to deno_fmt.";
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
|
|
@ -121,19 +114,32 @@ in {
|
||||||
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
|
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
|
||||||
|
|
||||||
Inline Markdown rendering with [render-markdown.nvim]
|
Inline Markdown rendering with [render-markdown.nvim]
|
||||||
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
setupOpts = mkPluginSetupOption "render-markdown" {
|
setupOpts = mkPluginSetupOption "render-markdown" {
|
||||||
auto_override_publish_diagnostics = mkOption {
|
file_types = lib.mkOption {
|
||||||
description = "Automatically override the publish_diagnostics handler";
|
type = nullOr (listOf str);
|
||||||
type = bool;
|
default = null;
|
||||||
default = true;
|
description = ''
|
||||||
|
List of buffer filetypes to enable this plugin in.
|
||||||
|
|
||||||
|
This will cause the plugin to attach to new buffers who
|
||||||
|
have any of these filetypes.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraDiagnostics = {
|
||||||
|
enable = mkEnableOption "extra Markdown diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||||
|
types = diagnostics {
|
||||||
|
langDesc = "Markdown";
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
inherit defaultDiagnosticsProvider;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
|
@ -148,8 +154,17 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.markdown-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.markdown = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${
|
||||||
|
if cfg.format.type == "denofmt"
|
||||||
|
then "deno_fmt"
|
||||||
|
else cfg.format.type
|
||||||
|
} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
# Extensions
|
# Extensions
|
||||||
|
|
@ -159,5 +174,16 @@ in {
|
||||||
require("render-markdown").setup(${toLuaObject cfg.extensions.render-markdown-nvim.setupOpts})
|
require("render-markdown").setup(${toLuaObject cfg.extensions.render-markdown-nvim.setupOpts})
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
|
vim.diagnostics.nvim-lint = {
|
||||||
|
enable = true;
|
||||||
|
linters_by_ft.markdown = cfg.extraDiagnostics.types;
|
||||||
|
linters = mkMerge (map (name: {
|
||||||
|
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||||
|
})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
|
};
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) enum either listOf package str;
|
inherit (lib.types) enum either listOf package str;
|
||||||
|
|
@ -38,14 +39,9 @@
|
||||||
formats = {
|
formats = {
|
||||||
nimpretty = {
|
nimpretty = {
|
||||||
package = pkgs.nim;
|
package = pkgs.nim;
|
||||||
nullConfig = ''
|
config = {
|
||||||
table.insert(
|
command = "${cfg.format.package}/bin/nimpretty";
|
||||||
ls_sources,
|
};
|
||||||
null_ls.builtins.formatting.nimpretty.with({
|
|
||||||
command = "${pkgs.nim}/bin/nimpretty",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -110,8 +106,11 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.nim-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.nim = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||||
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib) concatStringsSep;
|
inherit (lib) concatStringsSep;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
|
|
@ -13,7 +14,6 @@
|
||||||
inherit (lib.types) anything attrsOf enum either listOf nullOr package str;
|
inherit (lib.types) anything attrsOf enum either listOf nullOr package str;
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
|
|
||||||
cfg = config.vim.languages.nix;
|
cfg = config.vim.languages.nix;
|
||||||
|
|
||||||
|
|
@ -100,26 +100,10 @@
|
||||||
formats = {
|
formats = {
|
||||||
alejandra = {
|
alejandra = {
|
||||||
package = pkgs.alejandra;
|
package = pkgs.alejandra;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.alejandra.with({
|
|
||||||
command = "${cfg.format.package}/bin/alejandra"
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nixfmt = {
|
nixfmt = {
|
||||||
package = pkgs.nixfmt-rfc-style;
|
package = pkgs.nixfmt-rfc-style;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.nixfmt.with({
|
|
||||||
command = "${cfg.format.package}/bin/nixfmt"
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -237,17 +221,24 @@ in {
|
||||||
vim.lsp.lspconfig.sources.nix-lsp = servers.${cfg.lsp.server}.lspConfig;
|
vim.lsp.lspconfig.sources.nix-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf (cfg.format.enable && !servers.${cfg.lsp.server}.internalFormatter) {
|
(mkIf (cfg.format.enable && (!cfg.lsp.enable || !servers.${cfg.lsp.server}.internalFormatter)) {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.nix-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.nix = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "nix";
|
linters_by_ft.nix = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters = mkMerge (map (name: {
|
||||||
inherit diagnosticsProviders;
|
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||||
|
})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -37,14 +37,6 @@
|
||||||
formats = {
|
formats = {
|
||||||
ocamlformat = {
|
ocamlformat = {
|
||||||
package = pkgs.ocamlPackages.ocamlformat;
|
package = pkgs.ocamlPackages.ocamlformat;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.ocamlformat.with({
|
|
||||||
command = "${cfg.format.package}/bin/ocamlformat",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -97,9 +89,13 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.ocamlformat = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
vim.extraPackages = [formats.${cfg.format.type}.package];
|
setupOpts.formatters_by_ft.ocaml = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
python-lsp-server = {
|
python-lsp-server = {
|
||||||
package = pkgs.python-lsp-server;
|
package = pkgs.python3Packages.python-lsp-server;
|
||||||
lspConfig = ''
|
lspConfig = ''
|
||||||
lspconfig.pylsp.setup{
|
lspconfig.pylsp.setup{
|
||||||
capabilities = capabilities;
|
capabilities = capabilities;
|
||||||
|
|
@ -66,26 +66,10 @@
|
||||||
formats = {
|
formats = {
|
||||||
black = {
|
black = {
|
||||||
package = pkgs.black;
|
package = pkgs.black;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.black.with({
|
|
||||||
command = "${cfg.format.package}/bin/black",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
isort = {
|
isort = {
|
||||||
package = pkgs.isort;
|
package = pkgs.isort;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.isort.with({
|
|
||||||
command = "${cfg.format.package}/bin/isort",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
black-and-isort = {
|
black-and-isort = {
|
||||||
|
|
@ -96,15 +80,6 @@
|
||||||
black --quiet - "$@" | isort --profile black -
|
black --quiet - "$@" | isort --profile black -
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.black.with({
|
|
||||||
command = "${cfg.format.package}/bin/black",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ruff = {
|
ruff = {
|
||||||
|
|
@ -115,14 +90,6 @@
|
||||||
ruff format -
|
ruff format -
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.ruff.with({
|
|
||||||
command = "${cfg.format.package}/bin/ruff",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -132,7 +99,7 @@
|
||||||
# idk if this is the best way to install/run debugpy
|
# idk if this is the best way to install/run debugpy
|
||||||
package = pkgs.python3.withPackages (ps: with ps; [debugpy]);
|
package = pkgs.python3.withPackages (ps: with ps; [debugpy]);
|
||||||
dapConfig = ''
|
dapConfig = ''
|
||||||
dap.adapters.python = function(cb, config)
|
dap.adapters.debugpy = function(cb, config)
|
||||||
if config.request == 'attach' then
|
if config.request == 'attach' then
|
||||||
---@diagnostic disable-next-line: undefined-field
|
---@diagnostic disable-next-line: undefined-field
|
||||||
local port = (config.connect or config).port
|
local port = (config.connect or config).port
|
||||||
|
|
@ -161,7 +128,7 @@
|
||||||
dap.configurations.python = {
|
dap.configurations.python = {
|
||||||
{
|
{
|
||||||
-- The first three options are required by nvim-dap
|
-- The first three options are required by nvim-dap
|
||||||
type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
|
type = 'debugpy'; -- the type here established the link to the adapter definition: `dap.adapters.debugpy`
|
||||||
request = 'launch';
|
request = 'launch';
|
||||||
name = "Launch file";
|
name = "Launch file";
|
||||||
|
|
||||||
|
|
@ -272,8 +239,22 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.python-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
# HACK: I'm planning to remove these soon so I just took the easiest way out
|
||||||
|
setupOpts.formatters_by_ft.python =
|
||||||
|
if cfg.format.type == "black-and-isort"
|
||||||
|
then ["black"]
|
||||||
|
else [cfg.format.type];
|
||||||
|
setupOpts.formatters =
|
||||||
|
if (cfg.format.type == "black-and-isort")
|
||||||
|
then {
|
||||||
|
black.command = "${cfg.format.package}/bin/black";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
${cfg.format.type}.command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.dap.enable {
|
(mkIf cfg.dap.enable {
|
||||||
|
|
|
||||||
|
|
@ -24,28 +24,29 @@
|
||||||
package = pkgs.rWrapper.override {
|
package = pkgs.rWrapper.override {
|
||||||
packages = [pkgs.rPackages.styler];
|
packages = [pkgs.rPackages.styler];
|
||||||
};
|
};
|
||||||
nullConfig = ''
|
config = {
|
||||||
table.insert(
|
command = "${cfg.format.package}/bin/R";
|
||||||
ls_sources,
|
};
|
||||||
null_ls.builtins.formatting.styler.with({
|
|
||||||
command = "${cfg.format.package}/bin/R",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
format_r = {
|
format_r = {
|
||||||
package = pkgs.rWrapper.override {
|
package = pkgs.rWrapper.override {
|
||||||
packages = [pkgs.rPackages.formatR];
|
packages = [pkgs.rPackages.formatR];
|
||||||
};
|
};
|
||||||
nullConfig = ''
|
config = {
|
||||||
table.insert(
|
command = "${cfg.format.package}/bin/R";
|
||||||
ls_sources,
|
stdin = true;
|
||||||
null_ls.builtins.formatting.format_r.with({
|
args = [
|
||||||
command = "${cfg.format.package}/bin/R",
|
"--slave"
|
||||||
})
|
"--no-restore"
|
||||||
)
|
"--no-save"
|
||||||
'';
|
"-s"
|
||||||
|
"-e"
|
||||||
|
''formatR::tidy_source(source="stdin")''
|
||||||
|
];
|
||||||
|
# TODO: range_args seem to be possible
|
||||||
|
# https://github.com/nvimtools/none-ls.nvim/blob/main/lua/null-ls/builtins/formatting/format_r.lua
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -118,8 +119,11 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.r-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.r = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.lsp.enable {
|
(mkIf cfg.lsp.enable {
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
inherit (lib.types) either listOf package str enum;
|
inherit (lib.types) either listOf package str enum;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
|
|
||||||
cfg = config.vim.languages.ruby;
|
cfg = config.vim.languages.ruby;
|
||||||
|
|
||||||
|
|
@ -35,24 +35,8 @@
|
||||||
defaultFormat = "rubocop";
|
defaultFormat = "rubocop";
|
||||||
formats = {
|
formats = {
|
||||||
rubocop = {
|
rubocop = {
|
||||||
|
# TODO: is this right?
|
||||||
package = pkgs.rubyPackages.rubocop;
|
package = pkgs.rubyPackages.rubocop;
|
||||||
nullConfig = ''
|
|
||||||
local conditional = function(fn)
|
|
||||||
local utils = require("null-ls.utils").make_conditional_utils()
|
|
||||||
return fn(utils)
|
|
||||||
end
|
|
||||||
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.rubocop.with({
|
|
||||||
command="${pkgs.bundler}/bin/bundle",
|
|
||||||
args = vim.list_extend(
|
|
||||||
{"exec", "rubocop", "-a" },
|
|
||||||
null_ls.builtins.formatting.rubocop._opts.args
|
|
||||||
),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -60,14 +44,7 @@
|
||||||
diagnosticsProviders = {
|
diagnosticsProviders = {
|
||||||
rubocop = {
|
rubocop = {
|
||||||
package = pkgs.rubyPackages.rubocop;
|
package = pkgs.rubyPackages.rubocop;
|
||||||
nullConfig = pkg: ''
|
config.command = getExe cfg.format.package;
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.diagnostics.rubocop.with({
|
|
||||||
command = "${lib.getExe pkg}",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -136,16 +113,23 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.ruby-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.ruby = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "ruby";
|
linters_by_ft.ruby = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters = mkMerge (map (name: {
|
||||||
inherit diagnosticsProviders;
|
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||||
|
})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
|
|
@ -21,14 +22,6 @@
|
||||||
formats = {
|
formats = {
|
||||||
rustfmt = {
|
rustfmt = {
|
||||||
package = pkgs.rustfmt;
|
package = pkgs.rustfmt;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.rustfmt.with({
|
|
||||||
command = "${cfg.format.package}/bin/rustfmt",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -128,8 +121,13 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.rust-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.rust = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
|
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,11 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) enum either listOf package str;
|
inherit (lib.types) enum either listOf package str;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
inherit (lib.nvim.types) diagnostics;
|
inherit (lib.nvim.types) diagnostics;
|
||||||
|
|
||||||
cfg = config.vim.languages.sql;
|
cfg = config.vim.languages.sql;
|
||||||
|
|
@ -41,15 +41,10 @@
|
||||||
formats = {
|
formats = {
|
||||||
sqlfluff = {
|
sqlfluff = {
|
||||||
package = sqlfluffDefault;
|
package = sqlfluffDefault;
|
||||||
nullConfig = ''
|
config = {
|
||||||
table.insert(
|
command = getExe cfg.format.package;
|
||||||
ls_sources,
|
append_args = ["--dialect=${cfg.dialect}"];
|
||||||
null_ls.builtins.formatting.sqlfluff.with({
|
};
|
||||||
command = "${cfg.format.package}/bin/sqlfluff",
|
|
||||||
extra_args = {"--dialect", "${cfg.dialect}"}
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -57,15 +52,10 @@
|
||||||
diagnosticsProviders = {
|
diagnosticsProviders = {
|
||||||
sqlfluff = {
|
sqlfluff = {
|
||||||
package = sqlfluffDefault;
|
package = sqlfluffDefault;
|
||||||
nullConfig = pkg: ''
|
config = {
|
||||||
table.insert(
|
cmd = getExe sqlfluffDefault;
|
||||||
ls_sources,
|
args = ["lint" "--format=json" "--dialect=${cfg.dialect}"];
|
||||||
null_ls.builtins.diagnostics.sqlfluff.with({
|
};
|
||||||
command = "${pkg}/bin/sqlfluff",
|
|
||||||
extra_args = {"--dialect", "${cfg.dialect}"}
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -150,16 +140,20 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources."sql-format" = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.sql = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "sql";
|
linters_by_ft.sql = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters =
|
||||||
inherit diagnosticsProviders;
|
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.types) enum either listOf package str;
|
inherit (lib.types) enum either listOf package str;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
|
|
||||||
cfg = config.vim.languages.svelte;
|
cfg = config.vim.languages.svelte;
|
||||||
|
|
@ -39,52 +39,31 @@
|
||||||
formats = {
|
formats = {
|
||||||
prettier = {
|
prettier = {
|
||||||
package = pkgs.nodePackages.prettier;
|
package = pkgs.nodePackages.prettier;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.prettier.with({
|
|
||||||
command = "${cfg.format.package}/bin/prettier",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
biome = {
|
biome = {
|
||||||
package = pkgs.biome;
|
package = pkgs.biome;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.biome.with({
|
|
||||||
command = "${cfg.format.package}/bin/biome",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: specify packages
|
# TODO: specify packages
|
||||||
defaultDiagnosticsProvider = ["eslint_d"];
|
defaultDiagnosticsProvider = ["eslint_d"];
|
||||||
diagnosticsProviders = {
|
diagnosticsProviders = {
|
||||||
eslint_d = {
|
eslint_d = let
|
||||||
package = pkgs.eslint_d;
|
pkg = pkgs.eslint_d;
|
||||||
nullConfig = pkg: ''
|
in {
|
||||||
table.insert(
|
package = pkg;
|
||||||
ls_sources,
|
config = {
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
cmd = getExe pkg;
|
||||||
command = "${getExe pkg}",
|
required_files = [
|
||||||
condition = function(utils)
|
"eslint.config.js"
|
||||||
return utils.root_has_file({
|
"eslint.config.mjs"
|
||||||
"eslint.config.js",
|
".eslintrc"
|
||||||
"eslint.config.mjs",
|
".eslintrc.json"
|
||||||
".eslintrc",
|
".eslintrc.js"
|
||||||
".eslintrc.json",
|
".eslintrc.yml"
|
||||||
".eslintrc.js",
|
];
|
||||||
".eslintrc.yml",
|
};
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -153,16 +132,22 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.svelte-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.svelte = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "svelte";
|
linters_by_ft.svelte = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters =
|
||||||
inherit diagnosticsProviders;
|
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ in {
|
||||||
`vim.g.tex_flavor = <flavor>` line from your lua config entirely
|
`vim.g.tex_flavor = <flavor>` line from your lua config entirely
|
||||||
(unless you manually set it elsewhere of course).
|
(unless you manually set it elsewhere of course).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
flavor = mkOption {
|
flavor = mkOption {
|
||||||
type = enum [
|
type = enum [
|
||||||
"plaintex"
|
"plaintex"
|
||||||
|
|
@ -71,7 +72,7 @@ in {
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
# Extra Lua config options
|
# Extra Lua config options
|
||||||
(mkIf cfg.extraOpts.texFlavor.enable {
|
(mkIf cfg.extraOpts.texFlavor.enable {
|
||||||
vim.globals.tex_flavor = "${cfg.extraOpts.texFlavor.flavor}";
|
vim.globals.tex_flavor = lib.mkDefault "${cfg.extraOpts.texFlavor.flavor}";
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,13 @@ in {
|
||||||
./texlab.nix
|
./texlab.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
config = mkIf (cfg.enable && (any (x: x.enable) (attrValues cfg.lsp))) {
|
config =
|
||||||
vim.lsp.lspconfig.enable = true; # Enable lspconfig when any of the lsps are enabled
|
mkIf
|
||||||
|
(
|
||||||
|
cfg.enable # Check if nvf is enabled.
|
||||||
|
&& (any (x: x.enable) (attrValues cfg.lsp)) # Check if any of the LSPs have been enabled.
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vim.lsp.lspconfig.enable = lib.mkDefault true; # Enable lspconfig when any of the lsps are enabled
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,9 @@
|
||||||
cfg = config.vim.languages.tex;
|
cfg = config.vim.languages.tex;
|
||||||
texlabCfg = cfg.lsp.texlab;
|
texlabCfg = cfg.lsp.texlab;
|
||||||
builderCfg = cfg.build.builder;
|
builderCfg = cfg.build.builder;
|
||||||
|
|
||||||
|
# Get the enabled pdf viewer.
|
||||||
|
pdfViewer = import ../pdfViewer/getEnabledPdfViewer.nix {inherit lib config;};
|
||||||
in {
|
in {
|
||||||
options.vim.languages.tex.lsp.texlab = {
|
options.vim.languages.tex.lsp.texlab = {
|
||||||
enable = mkBool config.vim.languages.enableLSP ''
|
enable = mkBool config.vim.languages.enableLSP ''
|
||||||
|
|
@ -271,7 +274,7 @@ in {
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = package;
|
type = package;
|
||||||
default = cfg.pdfViewer.package;
|
default = pdfViewer.package;
|
||||||
description = ''
|
description = ''
|
||||||
The package to use as your PDF viewer.
|
The package to use as your PDF viewer.
|
||||||
This viewer needs to support Synctex.
|
This viewer needs to support Synctex.
|
||||||
|
|
@ -282,7 +285,7 @@ in {
|
||||||
|
|
||||||
executable = mkOption {
|
executable = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = cfg.pdfViewer.executable;
|
default = pdfViewer.executable;
|
||||||
description = ''
|
description = ''
|
||||||
Defines the executable of the PDF previewer. The previewer needs to
|
Defines the executable of the PDF previewer. The previewer needs to
|
||||||
support SyncTeX.
|
support SyncTeX.
|
||||||
|
|
@ -293,7 +296,7 @@ in {
|
||||||
|
|
||||||
args = mkOption {
|
args = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = cfg.pdfViewer.args;
|
default = pdfViewer.args;
|
||||||
description = ''
|
description = ''
|
||||||
Defines additional arguments that are passed to the configured
|
Defines additional arguments that are passed to the configured
|
||||||
previewer to perform the forward search.
|
previewer to perform the forward search.
|
||||||
|
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
} @ moduleInheritancePackage: let
|
|
||||||
# The name of the pdf viewer
|
|
||||||
name = "custom";
|
|
||||||
|
|
||||||
# The viewer template
|
|
||||||
template = import ./viewerTemplate.nix;
|
|
||||||
|
|
||||||
inherit (lib.options) mkOption mkEnableOption mkPackageOption;
|
|
||||||
inherit (lib.types) str listOf;
|
|
||||||
in (
|
|
||||||
template {
|
|
||||||
inherit name moduleInheritancePackage;
|
|
||||||
|
|
||||||
options = {
|
|
||||||
enable = mkEnableOption "enable using a custom pdf viewer.";
|
|
||||||
|
|
||||||
package = mkPackageOption pkgs "okular" {
|
|
||||||
extraDescription = "custom viewer package";
|
|
||||||
};
|
|
||||||
|
|
||||||
executable = mkOption {
|
|
||||||
type = str;
|
|
||||||
example = "okular";
|
|
||||||
description = "The executable name to call the viewer.";
|
|
||||||
};
|
|
||||||
|
|
||||||
args = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
example = [
|
|
||||||
"--unique"
|
|
||||||
"file:%p#src:%l%f"
|
|
||||||
];
|
|
||||||
description = "Arguments to pass to the viewer.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
argsFunction = viewerCfg: (viewerCfg.args);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
@ -1,162 +1,104 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
defaultPdfViewerName = "okular";
|
|
||||||
|
|
||||||
inherit
|
|
||||||
(builtins)
|
|
||||||
filter
|
|
||||||
isAttrs
|
|
||||||
hasAttr
|
|
||||||
attrNames
|
|
||||||
length
|
|
||||||
elemAt
|
|
||||||
;
|
|
||||||
inherit (lib.modules) mkIf;
|
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.types) str package listOf;
|
inherit (lib.types) str package listOf;
|
||||||
|
|
||||||
cfg = config.vim.languages.tex;
|
cfg = config.vim.languages.tex;
|
||||||
viewerCfg = cfg.pdfViewer;
|
|
||||||
|
|
||||||
enabledPdfViewersInfo = let
|
pdfViewer = {name, ...}: {
|
||||||
# This function will sort through the pdf viewer options and count how many
|
options = {
|
||||||
# pdf viewers have been enabled.
|
enable = lib.mkEnableOption "${builtins.toString name} pdf viewer";
|
||||||
# If no viewers have been enabled, the count will be 0 and the name of the
|
|
||||||
# enabled viewer will be the default pdf viewer defined above.
|
|
||||||
getEnabledPdfViewersInfo = {
|
|
||||||
enabledPdfViewersCount ? 0,
|
|
||||||
index ? 0,
|
|
||||||
pdfViewerNamesList ? (
|
|
||||||
filter (
|
|
||||||
x: let
|
|
||||||
y = viewerCfg."${x}";
|
|
||||||
in (
|
|
||||||
isAttrs y && hasAttr "enable" y && hasAttr "package" y && hasAttr "executable" y && hasAttr "args" y
|
|
||||||
)
|
|
||||||
) (attrNames viewerCfg)
|
|
||||||
),
|
|
||||||
currentEnabledPdfViewerName ? defaultPdfViewerName,
|
|
||||||
}: let
|
|
||||||
# Get the name of the current pdf viewer being checked if it is enabled
|
|
||||||
currentPdfViewerName = elemAt pdfViewerNamesList index;
|
|
||||||
|
|
||||||
# Get the current pdf viewer object
|
|
||||||
currentPdfViewer = viewerCfg."${currentPdfViewerName}";
|
|
||||||
|
|
||||||
# Get the index that will be used for the next iteration
|
|
||||||
nextIndex = index + 1;
|
|
||||||
|
|
||||||
# Increment the count that is recording the number of enabled pdf viewers
|
|
||||||
# if this viewer is enabled, otherwise leave it as is.
|
|
||||||
newEnabledPdfViewersCount =
|
|
||||||
if currentPdfViewer.enable
|
|
||||||
then enabledPdfViewersCount + 1
|
|
||||||
else enabledPdfViewersCount;
|
|
||||||
|
|
||||||
# If this pdf viewer is enabled, set is as the enabled viewer.
|
|
||||||
newEnabledPdfViewerName =
|
|
||||||
if currentPdfViewer.enable
|
|
||||||
then currentPdfViewerName
|
|
||||||
else currentEnabledPdfViewerName;
|
|
||||||
in
|
|
||||||
# Check that the end of the list of viewers has not been reached
|
|
||||||
if length pdfViewerNamesList > nextIndex
|
|
||||||
# If the end of the viewers list has not been reached, call the next iteration
|
|
||||||
# of the function to process the next viewer
|
|
||||||
then
|
|
||||||
getEnabledPdfViewersInfo {
|
|
||||||
inherit pdfViewerNamesList;
|
|
||||||
enabledPdfViewersCount = newEnabledPdfViewersCount;
|
|
||||||
index = nextIndex;
|
|
||||||
currentEnabledPdfViewerName = newEnabledPdfViewerName;
|
|
||||||
}
|
|
||||||
# If the end of the viewers list has been reached, then return the total number
|
|
||||||
# of viewers that have been enabled and the name of the last viewer that was enabled.
|
|
||||||
else {
|
|
||||||
count = newEnabledPdfViewersCount;
|
|
||||||
enabledViewerName = newEnabledPdfViewerName;
|
|
||||||
};
|
|
||||||
in (getEnabledPdfViewersInfo {});
|
|
||||||
|
|
||||||
enabledPdfViewerCfg = viewerCfg."${enabledPdfViewersInfo.enabledViewerName}";
|
|
||||||
in {
|
|
||||||
imports = [
|
|
||||||
./custom.nix
|
|
||||||
./okular.nix
|
|
||||||
./qpdfview.nix
|
|
||||||
./sioyek.nix
|
|
||||||
./zathura.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
options.vim.languages.tex.pdfViewer = {
|
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = enabledPdfViewerCfg.name;
|
example = "okular";
|
||||||
description = ''
|
description = ''
|
||||||
The name of the pdf viewer to use.
|
The name of the pdf viewer to use.
|
||||||
|
|
||||||
This value will be automatically set when any of the viewers are
|
This value will be automatically set when any of the viewers are
|
||||||
enabled.
|
enabled.
|
||||||
|
|
||||||
Setting this option option manually is not recommended but can be used
|
This value will be automatically set to the value of the parent
|
||||||
for some very technical nix-ing. If you wish to use a custom viewer,
|
attribute set. ex. `...tex.pdfViewer.<name>.name = "$${name}"`
|
||||||
please use the `custom` entry provided under `viewers`.
|
This value cannot and should not be changed to be different from this
|
||||||
|
parent value.
|
||||||
|
|
||||||
|
Default values already exist such as `...tex.pdfViewer.okular` but
|
||||||
|
you can override the default values or created completely custom
|
||||||
|
pdf viewers should you wish.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = package;
|
type = package;
|
||||||
default = enabledPdfViewerCfg.package;
|
example = pkgs.kdePackages.okular;
|
||||||
description = ''
|
description = "The package of the pdf viewer to use.";
|
||||||
The package of the pdf viewer to use.
|
|
||||||
|
|
||||||
This value will be automatically set when any of the viewers are
|
|
||||||
enabled.
|
|
||||||
|
|
||||||
Setting this option option manually is not recommended but can be used
|
|
||||||
for some very technical nix-ing. If you wish to use a custom viewer,
|
|
||||||
please use the `custom` entry provided under `viewers`.
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
executable = mkOption {
|
executable = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = enabledPdfViewerCfg.executable;
|
default = "${builtins.toString name}";
|
||||||
description = ''
|
description = ''
|
||||||
The executable for the pdf viewer to use.
|
The executable for the pdf viewer to use.
|
||||||
|
|
||||||
This value will be automatically set when any of the viewers are
|
It will be called as `<package_path>/bin/<executable>`.
|
||||||
enabled.
|
|
||||||
|
|
||||||
Setting this option option manually is not recommended but can be used
|
By default, the name of the pdf viewer will be used.
|
||||||
for some very technical nix-ing. If you wish to use a custom viewer,
|
|
||||||
please use the `custom` entry provided under `viewers`.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
args = mkOption {
|
args = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = enabledPdfViewerCfg.args;
|
default = [];
|
||||||
description = ''
|
description = ''
|
||||||
The command line arguments to use when calling the pdf viewer command.
|
The command line arguments to use when calling the pdf viewer command.
|
||||||
|
|
||||||
This value will be automatically set when any of the viewers are
|
These will be called as
|
||||||
enabled.
|
`<package_path>/bin/<executable> <arg1> <arg2> ...`.
|
||||||
|
|
||||||
Setting this option option manually is not recommended but can be used
|
|
||||||
for some very technical nix-ing. If you wish to use a custom viewer,
|
|
||||||
please use the `custom` entry provided under `viewers`.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (enabledPdfViewersInfo.count > 0) {
|
# The name of the pdf viewer must be set to the parent attribute set name.
|
||||||
|
config.name = lib.mkForce name;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
imports = [
|
||||||
|
./premadePdfViewers.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
options.vim.languages.tex.pdfViewer = mkOption {
|
||||||
|
type = with lib.types; attrsOf (submodule pdfViewer);
|
||||||
|
default = {};
|
||||||
|
example = {
|
||||||
|
zathura.enable = true;
|
||||||
|
|
||||||
|
customOkular = {
|
||||||
|
enable = false;
|
||||||
|
package = pkgs.kdePackages.okular;
|
||||||
|
executable = "okular";
|
||||||
|
args = [
|
||||||
|
"--unique"
|
||||||
|
"file:%p#src:%l%f"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = let
|
||||||
|
# List form of all pdf viewers.
|
||||||
|
pdfViewers = builtins.attrValues cfg.pdfViewer;
|
||||||
|
|
||||||
|
countPdfViewers = viewers: (lib.lists.count (x: x.enable) viewers);
|
||||||
|
in {
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = enabledPdfViewersInfo.count < 2;
|
# Assert that there is only one enabled pdf viewer.
|
||||||
|
assertion = (countPdfViewers pdfViewers) < 2;
|
||||||
message = ''
|
message = ''
|
||||||
The nvf-tex-language implementation does not support having more than
|
The nvf-tex-language implementation does not support having more than
|
||||||
1 pdf viewers enabled.
|
1 pdf viewers enabled.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
# The attribute set of pdf viewers in this configuration.
|
||||||
|
pdfViewers = config.vim.languages.tex.pdfViewer;
|
||||||
|
|
||||||
|
# The list of pdf viewers in this configuration.
|
||||||
|
pdfViewersList = builtins.attrValues pdfViewers;
|
||||||
|
|
||||||
|
# The list of enabled pdf viewers.
|
||||||
|
enabledPdfViewersList = builtins.filter (x: x.enable) pdfViewersList;
|
||||||
|
|
||||||
|
# The number of enabled pdf viewers.
|
||||||
|
enabledPdfViewersCount = lib.lists.count (x: x.enable) pdfViewersList;
|
||||||
|
in
|
||||||
|
if (enabledPdfViewersCount == 0)
|
||||||
|
# Use the fallback if no pdf viewer was enabled.
|
||||||
|
then pdfViewers.fallback
|
||||||
|
# Otherwise get the first enabled viewer.
|
||||||
|
else builtins.head enabledPdfViewersList
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
} @ moduleInheritancePackage: let
|
|
||||||
# The name of the pdf viewer
|
|
||||||
name = "okular";
|
|
||||||
|
|
||||||
# The viewer template
|
|
||||||
template = import ./viewerTemplate.nix;
|
|
||||||
|
|
||||||
inherit (lib.options) mkOption mkEnableOption mkPackageOption;
|
|
||||||
inherit (lib.types) str listOf;
|
|
||||||
in (
|
|
||||||
template {
|
|
||||||
inherit name moduleInheritancePackage;
|
|
||||||
|
|
||||||
options = {
|
|
||||||
enable = mkEnableOption "enable okular as the pdf file previewer.";
|
|
||||||
|
|
||||||
package = mkPackageOption pkgs "okular" {};
|
|
||||||
|
|
||||||
executable = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "okular";
|
|
||||||
description = "The executable name to call the viewer.";
|
|
||||||
};
|
|
||||||
|
|
||||||
args = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [
|
|
||||||
"--unique"
|
|
||||||
"file:%p#src:%l%f"
|
|
||||||
];
|
|
||||||
description = "Arguments to pass to the viewer.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
argsFunction = viewerCfg: (viewerCfg.args);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkDefault mkForce;
|
||||||
|
|
||||||
|
mkPdfViewerDefaults = {
|
||||||
|
package,
|
||||||
|
executable,
|
||||||
|
args ? [],
|
||||||
|
}: {
|
||||||
|
package = mkDefault package;
|
||||||
|
executable = mkDefault executable;
|
||||||
|
args = mkDefault args;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
config.vim.languages.tex.pdfViewer = {
|
||||||
|
okular = mkPdfViewerDefaults {
|
||||||
|
package = pkgs.kdePackages.okular;
|
||||||
|
executable = "okular";
|
||||||
|
args = [
|
||||||
|
"--unique"
|
||||||
|
"file:%p#src:%l%f"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
sioyek = mkPdfViewerDefaults {
|
||||||
|
package = pkgs.sioyek;
|
||||||
|
executable = "sioyek";
|
||||||
|
args = [
|
||||||
|
"--reuse-window"
|
||||||
|
"--execute-command"
|
||||||
|
"toggle_synctex"
|
||||||
|
"--inverse-search"
|
||||||
|
"texlab inverse-search -i \"%%1\" -l %%2"
|
||||||
|
"--forward-search-file"
|
||||||
|
"%f"
|
||||||
|
"--forward-search-line"
|
||||||
|
"%l"
|
||||||
|
"%p"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
qpdfview = mkPdfViewerDefaults {
|
||||||
|
package = pkgs.qpdfview;
|
||||||
|
executable = "qpdfview";
|
||||||
|
args = [
|
||||||
|
"--unique"
|
||||||
|
"%p#src:%f:%l:1"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
zathura = mkPdfViewerDefaults {
|
||||||
|
package = pkgs.zathura;
|
||||||
|
executable = "zathura";
|
||||||
|
args = [
|
||||||
|
"--synctex-forward"
|
||||||
|
"%l:1:%f"
|
||||||
|
"%p"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# This is a special pdf viewer. It is force set to a basic and known
|
||||||
|
# working configuration of okular and is used where needed in the
|
||||||
|
# rest of the tex language configuration encase no other pdf viewer
|
||||||
|
# was enabled.
|
||||||
|
# It cannot be enabled on its own and exists purely as a fallback
|
||||||
|
# option for internal use.
|
||||||
|
fallback = {
|
||||||
|
enable = mkForce false;
|
||||||
|
package = mkForce pkgs.kdePackages.okular;
|
||||||
|
executable = mkForce "okular";
|
||||||
|
args = mkForce [
|
||||||
|
"--unique"
|
||||||
|
"file:%p#src:%l%f"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
} @ moduleInheritancePackage: let
|
|
||||||
# The name of the pdf viewer
|
|
||||||
name = "qpdfview";
|
|
||||||
|
|
||||||
# The viewer template
|
|
||||||
template = import ./viewerTemplate.nix;
|
|
||||||
|
|
||||||
inherit (lib.options) mkOption mkEnableOption mkPackageOption;
|
|
||||||
inherit (lib.types) str listOf;
|
|
||||||
in (
|
|
||||||
template {
|
|
||||||
inherit name moduleInheritancePackage;
|
|
||||||
|
|
||||||
options = {
|
|
||||||
enable = mkEnableOption "enable qpdfview as the pdf file previewer.";
|
|
||||||
|
|
||||||
package = mkPackageOption pkgs "qpdfview" {};
|
|
||||||
|
|
||||||
executable = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "qpdfview";
|
|
||||||
description = "The executable name to call the viewer.";
|
|
||||||
};
|
|
||||||
|
|
||||||
args = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [
|
|
||||||
"--unique"
|
|
||||||
"%p#src:%f:%l:1"
|
|
||||||
];
|
|
||||||
description = "Arguments to pass to the viewer.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
argsFunction = viewerCfg: (viewerCfg.args);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
} @ moduleInheritancePackage: let
|
|
||||||
# The name of the pdf viewer
|
|
||||||
name = "sioyek";
|
|
||||||
|
|
||||||
# The viewer template
|
|
||||||
template = import ./viewerTemplate.nix;
|
|
||||||
|
|
||||||
inherit (lib.options) mkOption mkEnableOption mkPackageOption;
|
|
||||||
inherit (lib.types) str listOf;
|
|
||||||
in (
|
|
||||||
template {
|
|
||||||
inherit name moduleInheritancePackage;
|
|
||||||
|
|
||||||
options = {
|
|
||||||
enable = mkEnableOption "sioyek as the pdf file previewer.";
|
|
||||||
|
|
||||||
package = mkPackageOption pkgs "sioyek" {};
|
|
||||||
|
|
||||||
executable = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "sioyek";
|
|
||||||
description = "The executable name to call the viewer.";
|
|
||||||
};
|
|
||||||
|
|
||||||
args = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [
|
|
||||||
"--reuse-window"
|
|
||||||
"--execute-command"
|
|
||||||
"toggle_synctex"
|
|
||||||
"--inverse-search"
|
|
||||||
"texlab inverse-search -i \"%%1\" -l %%2"
|
|
||||||
"--forward-search-file"
|
|
||||||
"%f"
|
|
||||||
"--forward-search-line"
|
|
||||||
"%l"
|
|
||||||
"%p"
|
|
||||||
];
|
|
||||||
description = ''
|
|
||||||
Arguments to pass to the viewer.
|
|
||||||
|
|
||||||
By default, this is the only viewer that supports the inverse search
|
|
||||||
feature by command line arguments and doesn't explicitly require extra
|
|
||||||
tinkering else where in your config.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
argsFunction = viewerCfg: (viewerCfg.args);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
# This function acts as a template for creating new pdf viewers.
|
|
||||||
# It enforces providing all the parameters required for creating
|
|
||||||
# a new pdf viewer for it to be able to work in the existing code.
|
|
||||||
#
|
|
||||||
# The first layer requirements are as follows:
|
|
||||||
{
|
|
||||||
# This is the name of the pdf viewer, it will only be used internally and
|
|
||||||
# MUST match the <name>.nix file that the pdf viewer is implemented in.
|
|
||||||
name,
|
|
||||||
#
|
|
||||||
# Module attribute set. This is the attribute set that the module that is
|
|
||||||
# defining a pdf viewer is passed as its input.
|
|
||||||
moduleInheritancePackage,
|
|
||||||
#
|
|
||||||
# These are the standard options for the pdf viewer just like creating any
|
|
||||||
# other module. Some options are required and are described below but
|
|
||||||
# it will also accept any other options that are provided to it.
|
|
||||||
options,
|
|
||||||
#
|
|
||||||
# These are the command line arguments that will accompany the executable
|
|
||||||
# when the view command is called.
|
|
||||||
# This is a function that will take in the cfg of its own pdf viewer.
|
|
||||||
# i.e. it will be called as "args cfg.pdfViewer.${name}"
|
|
||||||
argsFunction,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
# Inherit the necessary variables available to any module.
|
|
||||||
inherit (moduleInheritancePackage) lib config;
|
|
||||||
#
|
|
||||||
# Inherit other useful functions.
|
|
||||||
inherit (lib.modules) mkIf;
|
|
||||||
#
|
|
||||||
# Set the cfg variable
|
|
||||||
cfg = config.vim.languages.tex;
|
|
||||||
#
|
|
||||||
# Set the cfg of the viewer itself
|
|
||||||
viewerCfg = cfg.pdfViewer.${name};
|
|
||||||
in {
|
|
||||||
# These are the options for the pdf viewer. It will accept any options
|
|
||||||
# provided to it but some options are mandatory:
|
|
||||||
options.vim.languages.tex.pdfViewer.${name} = ({
|
|
||||||
# The enable option. This one is self explanatory.
|
|
||||||
enable,
|
|
||||||
#
|
|
||||||
# This is the package option for the pdf viewer.
|
|
||||||
package,
|
|
||||||
#
|
|
||||||
# This is the executable that will be used to call the pdf viewer.
|
|
||||||
# It, along with package will result in:
|
|
||||||
# "<package_path>/bin/<executable>"
|
|
||||||
executable,
|
|
||||||
#
|
|
||||||
# Any other options provided are accepted.
|
|
||||||
...
|
|
||||||
} @ opts:
|
|
||||||
opts)
|
|
||||||
options;
|
|
||||||
|
|
||||||
# Check that the language and this pdf viewer have been enabled before making
|
|
||||||
# any config.
|
|
||||||
config = mkIf (cfg.enable && viewerCfg.enable) {
|
|
||||||
vim.languages.tex.pdfViewer = {
|
|
||||||
inherit name;
|
|
||||||
inherit (viewerCfg) package executable;
|
|
||||||
args = argsFunction viewerCfg;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
} @ moduleInheritancePackage: let
|
|
||||||
# The name of the pdf viewer
|
|
||||||
name = "zathura";
|
|
||||||
|
|
||||||
# The viewer template
|
|
||||||
template = import ./viewerTemplate.nix;
|
|
||||||
|
|
||||||
inherit (lib.options) mkOption mkEnableOption mkPackageOption;
|
|
||||||
inherit (lib.types) str listOf;
|
|
||||||
in (
|
|
||||||
template {
|
|
||||||
inherit name moduleInheritancePackage;
|
|
||||||
|
|
||||||
options = {
|
|
||||||
enable = mkEnableOption "enable zathura as the pdf file previewer.";
|
|
||||||
|
|
||||||
package = mkPackageOption pkgs "zathura" {};
|
|
||||||
|
|
||||||
executable = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "zathura";
|
|
||||||
description = "The executable name to call the viewer.";
|
|
||||||
};
|
|
||||||
|
|
||||||
args = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [
|
|
||||||
"--synctex-forward"
|
|
||||||
"%l:1:%f"
|
|
||||||
"%p"
|
|
||||||
];
|
|
||||||
description = "Arguments to pass to the viewer.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
argsFunction = viewerCfg: (viewerCfg.args);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
@ -9,10 +9,10 @@
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.types) enum either listOf package str bool;
|
inherit (lib.types) enum either listOf package str bool;
|
||||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics mkPluginSetupOption;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics mkPluginSetupOption;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
||||||
cfg = config.vim.languages.ts;
|
cfg = config.vim.languages.ts;
|
||||||
|
|
@ -77,65 +77,35 @@
|
||||||
formats = {
|
formats = {
|
||||||
prettier = {
|
prettier = {
|
||||||
package = pkgs.nodePackages.prettier;
|
package = pkgs.nodePackages.prettier;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.prettier.with({
|
|
||||||
command = "${cfg.format.package}/bin/prettier",
|
|
||||||
filetypes = { "typescript", "javascript" },
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
prettierd = {
|
prettierd = {
|
||||||
package = pkgs.prettierd;
|
package = pkgs.prettierd;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.prettier.with({
|
|
||||||
command = "${cfg.format.package}/bin/prettierd",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
biome = {
|
biome = {
|
||||||
package = pkgs.biome;
|
package = pkgs.biome;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.biome.with({
|
|
||||||
command = "${cfg.format.package}/bin/biome",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: specify packages
|
# TODO: specify packages
|
||||||
defaultDiagnosticsProvider = ["eslint_d"];
|
defaultDiagnosticsProvider = ["eslint_d"];
|
||||||
diagnosticsProviders = {
|
diagnosticsProviders = {
|
||||||
eslint_d = {
|
eslint_d = let
|
||||||
package = pkgs.eslint_d;
|
pkg = pkgs.eslint_d;
|
||||||
nullConfig = pkg: ''
|
in {
|
||||||
table.insert(
|
package = pkg;
|
||||||
ls_sources,
|
config = {
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
cmd = getExe pkg;
|
||||||
command = "${getExe pkg}",
|
required_files = [
|
||||||
condition = function(utils)
|
"eslint.config.js"
|
||||||
return utils.root_has_file({
|
"eslint.config.mjs"
|
||||||
"eslint.config.js",
|
".eslintrc"
|
||||||
"eslint.config.mjs",
|
".eslintrc.json"
|
||||||
".eslintrc",
|
".eslintrc.js"
|
||||||
".eslintrc.json",
|
".eslintrc.yml"
|
||||||
".eslintrc.js",
|
];
|
||||||
".eslintrc.yml",
|
};
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -225,16 +195,28 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.ts-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts = {
|
||||||
|
formatters_by_ft.typescript = [cfg.format.type];
|
||||||
|
# .tsx files
|
||||||
|
formatters_by_ft.typescriptreact = [cfg.format.type];
|
||||||
|
formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.extraDiagnostics.enable {
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.diagnostics.nvim-lint = {
|
||||||
vim.lsp.null-ls.sources = diagnosticsToLua {
|
enable = true;
|
||||||
lang = "ts";
|
linters_by_ft.typescript = cfg.extraDiagnostics.types;
|
||||||
config = cfg.extraDiagnostics.types;
|
linters_by_ft.typescriptreact = cfg.extraDiagnostics.types;
|
||||||
inherit diagnosticsProviders;
|
|
||||||
|
linters =
|
||||||
|
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.types) nullOr enum either attrsOf listOf package str;
|
inherit (lib.types) nullOr enum either attrsOf listOf package str;
|
||||||
inherit (lib.attrsets) attrNames;
|
inherit (lib.attrsets) attrNames;
|
||||||
inherit (lib.generators) mkLuaInline;
|
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||||
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
||||||
|
|
@ -61,26 +60,10 @@
|
||||||
formats = {
|
formats = {
|
||||||
typstfmt = {
|
typstfmt = {
|
||||||
package = pkgs.typstfmt;
|
package = pkgs.typstfmt;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.typstfmt.with({
|
|
||||||
command = "${cfg.format.package}/bin/typstfmt",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
# https://github.com/Enter-tainer/typstyle
|
# https://github.com/Enter-tainer/typstyle
|
||||||
typstyle = {
|
typstyle = {
|
||||||
package = pkgs.typstyle;
|
package = pkgs.typstyle;
|
||||||
nullConfig = ''
|
|
||||||
table.insert(
|
|
||||||
ls_sources,
|
|
||||||
null_ls.builtins.formatting.typstfmt.with({
|
|
||||||
command = "${cfg.format.package}/bin/typstyle",
|
|
||||||
})
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
@ -176,8 +159,13 @@ in {
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.format.enable {
|
(mkIf cfg.format.enable {
|
||||||
vim.lsp.null-ls.enable = true;
|
vim.formatter.conform-nvim = {
|
||||||
vim.lsp.null-ls.sources.typst-format = formats.${cfg.format.type}.nullConfig;
|
enable = true;
|
||||||
|
setupOpts.formatters_by_ft.typst = [cfg.format.type];
|
||||||
|
setupOpts.formatters.${cfg.format.type} = {
|
||||||
|
command = getExe cfg.format.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.lsp.enable {
|
(mkIf cfg.lsp.enable {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.trivial) boolToString;
|
inherit (lib.trivial) boolToString;
|
||||||
|
|
@ -28,6 +29,25 @@ in {
|
||||||
sourcePlugins = ["cmp-nvim-lsp"];
|
sourcePlugins = ["cmp-nvim-lsp"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
autocmds =
|
||||||
|
if cfg.inlayHints.enable
|
||||||
|
then [
|
||||||
|
{
|
||||||
|
callback = mkLuaInline ''
|
||||||
|
function(event)
|
||||||
|
local bufnr = event.buf
|
||||||
|
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||||
|
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||||
|
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
desc = "LSP on-attach enable inlay hints autocmd";
|
||||||
|
event = ["LspAttach"];
|
||||||
|
}
|
||||||
|
]
|
||||||
|
else [];
|
||||||
|
|
||||||
pluginRC.lsp-setup = ''
|
pluginRC.lsp-setup = ''
|
||||||
vim.g.formatsave = ${boolToString cfg.formatOnSave};
|
vim.g.formatsave = ${boolToString cfg.formatOnSave};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
./lightbulb
|
./lightbulb
|
||||||
./otter
|
./otter
|
||||||
./lspkind
|
./lspkind
|
||||||
./lsplines
|
|
||||||
./nvim-docs-view
|
./nvim-docs-view
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.modules) mkIf;
|
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
|
||||||
in {
|
|
||||||
config = mkIf (cfg.enable && cfg.lsplines.enable) {
|
|
||||||
vim.startPlugins = ["lsp-lines"];
|
|
||||||
vim.pluginRC.lsplines = entryAfter ["lspconfig"] ''
|
|
||||||
require("lsp_lines").setup()
|
|
||||||
|
|
||||||
vim.diagnostic.config({
|
|
||||||
virtual_text = false,
|
|
||||||
})
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
{lib, ...}: let
|
|
||||||
inherit (lib.options) mkEnableOption;
|
|
||||||
in {
|
|
||||||
options.vim.lsp = {
|
|
||||||
lsplines = {
|
|
||||||
enable = mkEnableOption ''
|
|
||||||
diagnostics using virtual lines on top of the real line of code. [lsp_lines]
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -6,6 +6,19 @@
|
||||||
inherit (lib.modules) mkRemovedOptionModule;
|
inherit (lib.modules) mkRemovedOptionModule;
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.nvim.types) borderType mkPluginSetupOption;
|
inherit (lib.nvim.types) borderType mkPluginSetupOption;
|
||||||
|
inherit (lib.nvim.lua) mkLuaInline;
|
||||||
|
|
||||||
|
uiKindSetupOpts =
|
||||||
|
if config.vim.theme.enable && config.vim.theme.name == "catppuccin"
|
||||||
|
then {
|
||||||
|
ui.kind =
|
||||||
|
mkLuaInline
|
||||||
|
# lua
|
||||||
|
''
|
||||||
|
require("catppuccin.groups.integrations.lsp_saga").custom_kind()
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
else {};
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
(mkRemovedOptionModule ["vim" "lsp" "lspsaga" "mappings"] ''
|
(mkRemovedOptionModule ["vim" "lsp" "lspsaga" "mappings"] ''
|
||||||
|
|
@ -21,12 +34,14 @@ in {
|
||||||
options.vim.lsp.lspsaga = {
|
options.vim.lsp.lspsaga = {
|
||||||
enable = mkEnableOption "LSP Saga";
|
enable = mkEnableOption "LSP Saga";
|
||||||
|
|
||||||
setupOpts = mkPluginSetupOption "lspsaga" {
|
setupOpts =
|
||||||
|
mkPluginSetupOption "lspsaga" {
|
||||||
border_style = mkOption {
|
border_style = mkOption {
|
||||||
type = borderType;
|
type = borderType;
|
||||||
default = config.vim.ui.borders.globalStyle;
|
default = config.vim.ui.borders.globalStyle;
|
||||||
description = "Border type, see {command}`:help nvim_open_win`";
|
description = "Border type, see {command}`:help nvim_open_win`";
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
// uiKindSetupOpts;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ in {
|
||||||
options.vim.lsp = {
|
options.vim.lsp = {
|
||||||
enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options";
|
enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options";
|
||||||
formatOnSave = mkEnableOption "format on save";
|
formatOnSave = mkEnableOption "format on save";
|
||||||
|
inlayHints = {
|
||||||
|
enable = mkEnableOption "inlay hints";
|
||||||
|
};
|
||||||
mappings = {
|
mappings = {
|
||||||
goToDefinition =
|
goToDefinition =
|
||||||
mkMappingOption "Go to definition"
|
mkMappingOption "Go to definition"
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,12 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.attrsets) mapAttrs;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.trivial) boolToString;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
inherit (lib.nvim.dag) entryAnywhere entryAfter entryBetween;
|
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp.null-ls;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.null-ls.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
{
|
{
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = [
|
startPlugins = [
|
||||||
|
|
@ -18,35 +17,14 @@ in {
|
||||||
"plenary-nvim"
|
"plenary-nvim"
|
||||||
];
|
];
|
||||||
|
|
||||||
# null-ls implies LSP already being set up
|
# null-ls implies that LSP is already being set up
|
||||||
# since it will hook into LSPs to receive information
|
# as it will hook into LSPs to receive information.
|
||||||
lsp.enable = true;
|
lsp.enable = true;
|
||||||
|
|
||||||
pluginRC = {
|
pluginRC.null_ls = entryAfter ["lsp-setup"] ''
|
||||||
# early setup for null-ls
|
require('null-ls').setup(${toLuaObject cfg.setupOpts})
|
||||||
null_ls-setup = entryAnywhere ''
|
|
||||||
local null_ls = require("null-ls")
|
|
||||||
local null_helpers = require("null-ls.helpers")
|
|
||||||
local null_methods = require("null-ls.methods")
|
|
||||||
local ls_sources = {}
|
|
||||||
'';
|
|
||||||
|
|
||||||
# null-ls setup
|
|
||||||
null_ls = entryAfter ["null_ls-setup" "lsp-setup"] ''
|
|
||||||
require('null-ls').setup({
|
|
||||||
debug = ${boolToString cfg.null-ls.debug},
|
|
||||||
diagnostics_format = "${cfg.null-ls.diagnostics_format}",
|
|
||||||
debounce = ${toString cfg.null-ls.debounce},
|
|
||||||
default_timeout = ${toString cfg.null-ls.default_timeout},
|
|
||||||
sources = ls_sources,
|
|
||||||
on_attach = default_on_attach
|
|
||||||
})
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
vim.pluginRC = mapAttrs (_: v: (entryBetween ["null_ls"] ["null_ls-setup"] v)) cfg.null-ls.sources;
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,87 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) attrsOf str int;
|
inherit (lib.types) listOf str int nullOr;
|
||||||
in {
|
inherit (lib.generators) mkLuaInline;
|
||||||
options.vim.lsp.null-ls = {
|
inherit (lib.nvim.types) luaInline mkPluginSetupOption;
|
||||||
enable = mkEnableOption "null-ls, also enabled automatically";
|
inherit (lib.nvim.config) batchRenameOptions;
|
||||||
|
|
||||||
debug = mkEnableOption "debugging information for `null-ls";
|
migrationTable = {
|
||||||
|
debug = "debug";
|
||||||
|
diagnostics_format = "diagnostics_format";
|
||||||
|
debounce = "debounce";
|
||||||
|
default_timeout = "default_timeout";
|
||||||
|
sources = "sources";
|
||||||
|
};
|
||||||
|
|
||||||
|
renamedSetupOpts =
|
||||||
|
batchRenameOptions
|
||||||
|
["vim" "lsp" "null-ls"]
|
||||||
|
["vim" "lsp" "null-ls" "setupOpts"]
|
||||||
|
migrationTable;
|
||||||
|
in {
|
||||||
|
imports = renamedSetupOpts;
|
||||||
|
|
||||||
|
options.vim.lsp.null-ls = {
|
||||||
|
enable = mkEnableOption ''
|
||||||
|
null-ls, plugin to use Neovim as a language server to inject LSP diagnostics,
|
||||||
|
code actions, and more via Lua.
|
||||||
|
'';
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "null-ls" {
|
||||||
|
debug = mkEnableOption ''
|
||||||
|
debugging information for null-ls.
|
||||||
|
|
||||||
|
Displays all possible log messages and writes them to the null-ls log,
|
||||||
|
which you can view with the command `:NullLsLog`
|
||||||
|
'';
|
||||||
|
|
||||||
diagnostics_format = mkOption {
|
diagnostics_format = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = "[#{m}] #{s} (#{c})";
|
default = "[#{m}] #{s} (#{c})";
|
||||||
description = "Diagnostic output format for null-ls";
|
description = ''
|
||||||
|
Sets the default format used for diagnostics. null-ls will replace th
|
||||||
|
e following special components with the relevant diagnostic information:
|
||||||
|
|
||||||
|
* `#{m}`: message
|
||||||
|
* `#{s}`: source name (defaults to null-ls if not specified)
|
||||||
|
* `#{c}`: code (if available)
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
debounce = mkOption {
|
debounce = mkOption {
|
||||||
type = int;
|
type = int;
|
||||||
default = 250;
|
default = 250;
|
||||||
description = "Default debounce";
|
description = ''
|
||||||
|
Amount of time between the last change to a buffer and the next `textDocument/didChange` notification.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
default_timeout = mkOption {
|
default_timeout = mkOption {
|
||||||
type = int;
|
type = int;
|
||||||
default = 5000;
|
default = 5000;
|
||||||
description = "Default timeout value, in milliseconds";
|
description = ''
|
||||||
|
Amount of time (in milliseconds) after which built-in sources will time out.
|
||||||
|
|
||||||
|
:::{.note}
|
||||||
|
Built-in sources can define their own timeout period and users can override
|
||||||
|
the timeout period on a per-source basis
|
||||||
|
:::
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
sources = mkOption {
|
sources = mkOption {
|
||||||
description = "null-ls sources";
|
type = nullOr (listOf luaInline);
|
||||||
type = attrsOf str;
|
default = null;
|
||||||
default = {};
|
description = "Sources for null-ls to register";
|
||||||
|
};
|
||||||
|
|
||||||
|
on_attach = mkOption {
|
||||||
|
type = nullOr luaInline;
|
||||||
|
default = mkLuaInline "on_attach";
|
||||||
|
description = ''
|
||||||
|
Defines an on_attach callback to run whenever null-ls attaches to a buffer.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
19
modules/plugins/mini/cursorword/config.nix
Normal file
19
modules/plugins/mini/cursorword/config.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
|
cfg = config.vim.mini.cursorword;
|
||||||
|
in {
|
||||||
|
vim = mkIf cfg.enable {
|
||||||
|
startPlugins = ["mini-cursorword"];
|
||||||
|
|
||||||
|
pluginRC.mini-ai = entryAnywhere ''
|
||||||
|
require("mini.cursorword").setup(${toLuaObject cfg.setupOpts})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
9
modules/plugins/mini/cursorword/cursorword.nix
Normal file
9
modules/plugins/mini/cursorword/cursorword.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkEnableOption;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
in {
|
||||||
|
options.vim.mini.cursorword = {
|
||||||
|
enable = mkEnableOption "mini.cursorword";
|
||||||
|
setupOpts = mkPluginSetupOption "mini.cursorword" {};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/plugins/mini/cursorword/default.nix
Normal file
6
modules/plugins/mini/cursorword/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./cursorword.nix
|
||||||
|
./config.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
./colors
|
./colors
|
||||||
./comment
|
./comment
|
||||||
./completion
|
./completion
|
||||||
|
./cursorword
|
||||||
./diff
|
./diff
|
||||||
./doc
|
./doc
|
||||||
./extra
|
./extra
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
@ -10,6 +11,21 @@
|
||||||
cfg = config.vim.mini.indentscope;
|
cfg = config.vim.mini.indentscope;
|
||||||
in {
|
in {
|
||||||
vim = mkIf cfg.enable {
|
vim = mkIf cfg.enable {
|
||||||
|
autocmds = [
|
||||||
|
{
|
||||||
|
callback = mkLuaInline ''
|
||||||
|
function()
|
||||||
|
local ignore_filetypes = ${toLuaObject cfg.setupOpts.ignore_filetypes}
|
||||||
|
if vim.tbl_contains(ignore_filetypes, vim.bo.filetype) then
|
||||||
|
vim.b.miniindentscope_disable = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
desc = "Disable indentscope for certain filetypes";
|
||||||
|
event = ["FileType"];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
startPlugins = ["mini-indentscope"];
|
startPlugins = ["mini-indentscope"];
|
||||||
|
|
||||||
pluginRC.mini-indentscope = entryAnywhere ''
|
pluginRC.mini-indentscope = entryAnywhere ''
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,16 @@
|
||||||
{
|
{lib, ...}: let
|
||||||
config,
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.options) mkEnableOption;
|
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
inherit (lib.types) str listOf;
|
||||||
in {
|
in {
|
||||||
options.vim.mini.indentscope = {
|
options.vim.mini.indentscope = {
|
||||||
enable = mkEnableOption "mini.indentscope";
|
enable = mkEnableOption "mini.indentscope";
|
||||||
setupOpts = mkPluginSetupOption "mini.indentscope" {};
|
setupOpts = mkPluginSetupOption "mini.indentscope" {
|
||||||
|
ignore_filetypes = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = ["help" "neo-tree" "notify" "NvimTree" "TelescopePrompt"];
|
||||||
|
description = "File types to ignore for illuminate";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,28 @@
|
||||||
bCfg = config.vim.ui.breadcrumbs;
|
bCfg = config.vim.ui.breadcrumbs;
|
||||||
in {
|
in {
|
||||||
config = mkMerge [
|
config = mkMerge [
|
||||||
# TODO: move into nvim-tree file
|
{
|
||||||
(mkIf config.vim.filetree.nvimTree.enable {
|
vim.statusline.lualine.setupOpts.extensions =
|
||||||
vim.statusline.lualine.setupOpts = {
|
(lib.optionals config.vim.filetree.nvimTree.enable ["nvim-tree"])
|
||||||
extensions = ["nvim-tree"];
|
++ (lib.optionals config.vim.filetree.neo-tree.enable ["neo-tree"])
|
||||||
|
++ (lib.optionals config.vim.utility.snacks-nvim.enable [
|
||||||
|
{
|
||||||
|
# same extensions as nerdtree / neo-tree
|
||||||
|
# https://github.com/nvim-lualine/lualine.nvim/blob/master/lua/lualine/extensions/nerdtree.lua
|
||||||
|
# https://github.com/nvim-lualine/lualine.nvim/blob/master/lua/lualine/extensions/neo-tree.lua
|
||||||
|
sections = {
|
||||||
|
lualine_a = mkLuaInline ''
|
||||||
|
{
|
||||||
|
function()
|
||||||
|
return vim.fn.fnamemodify(vim.fn.getcwd(), ":~")
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
})
|
filetypes = ["snacks_picker_list" "snacks_picker_input"];
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
(mkIf (bCfg.enable && bCfg.lualine.winbar.enable && bCfg.source == "nvim-navic") {
|
(mkIf (bCfg.enable && bCfg.lualine.winbar.enable && bCfg.source == "nvim-navic") {
|
||||||
vim.statusline.lualine.setupOpts = {
|
vim.statusline.lualine.setupOpts = {
|
||||||
|
|
|
||||||
|
|
@ -124,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";
|
||||||
};
|
};
|
||||||
|
|
@ -241,35 +239,26 @@ in {
|
||||||
{
|
{
|
||||||
-- Lsp server name
|
-- Lsp server name
|
||||||
function()
|
function()
|
||||||
local buf_ft = vim.api.nvim_get_option_value('filetype', {})
|
local buf_ft = vim.bo.filetype
|
||||||
|
local excluded_buf_ft = { toggleterm = true, NvimTree = true, ["neo-tree"] = true, TelescopePrompt = true }
|
||||||
|
|
||||||
-- List of buffer types to exclude
|
if excluded_buf_ft[buf_ft] then
|
||||||
local excluded_buf_ft = {"toggleterm", "NvimTree", "neo-tree", "TelescopePrompt"}
|
|
||||||
|
|
||||||
-- Check if the current buffer type is in the excluded list
|
|
||||||
for _, excluded_type in ipairs(excluded_buf_ft) do
|
|
||||||
if buf_ft == excluded_type then
|
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
|
local clients = vim.lsp.get_clients({ bufnr = bufnr })
|
||||||
|
|
||||||
|
if vim.tbl_isempty(clients) then
|
||||||
|
return "No Active LSP"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get the name of the LSP server active in the current buffer
|
local active_clients = {}
|
||||||
local clients = vim.lsp.get_active_clients()
|
|
||||||
local msg = 'No Active Lsp'
|
|
||||||
|
|
||||||
-- if no lsp client is attached then return the msg
|
|
||||||
if next(clients) == nil then
|
|
||||||
return msg
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, client in ipairs(clients) do
|
for _, client in ipairs(clients) do
|
||||||
local filetypes = client.config.filetypes
|
table.insert(active_clients, client.name)
|
||||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
|
||||||
return client.name
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return msg
|
return table.concat(active_clients, ", ")
|
||||||
end,
|
end,
|
||||||
icon = ' ',
|
icon = ' ',
|
||||||
separator = {left = ''},
|
separator = {left = ''},
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.tabline.nvimBufferline;
|
cfg = config.vim.tabline.nvimBufferline;
|
||||||
self = import ./nvim-bufferline.nix {inherit lib;};
|
self = import ./nvim-bufferline.nix {inherit config lib;};
|
||||||
inherit (self.options.vim.tabline.nvimBufferline) mappings;
|
inherit (self.options.vim.tabline.nvimBufferline) mappings;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
{lib, ...}: let
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.types) enum bool either nullOr str int listOf attrs;
|
inherit (lib.types) enum bool either nullOr str int listOf attrs;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
|
@ -23,7 +27,14 @@ in {
|
||||||
setupOpts = mkPluginSetupOption "Bufferline-nvim" {
|
setupOpts = mkPluginSetupOption "Bufferline-nvim" {
|
||||||
highlights = mkOption {
|
highlights = mkOption {
|
||||||
type = either attrs luaInline;
|
type = either attrs luaInline;
|
||||||
default = {};
|
default =
|
||||||
|
if config.vim.theme.enable && config.vim.theme.name == "catppuccin"
|
||||||
|
then
|
||||||
|
mkLuaInline
|
||||||
|
''
|
||||||
|
require("catppuccin.groups.integrations.bufferline").get()
|
||||||
|
''
|
||||||
|
else {};
|
||||||
description = ''
|
description = ''
|
||||||
Overrides the highlight groups of bufferline.
|
Overrides the highlight groups of bufferline.
|
||||||
|
|
||||||
|
|
@ -261,14 +272,12 @@ in {
|
||||||
|
|
||||||
offsets = mkOption {
|
offsets = mkOption {
|
||||||
type = listOf attrs;
|
type = listOf attrs;
|
||||||
default = [
|
default = map (filetype: {
|
||||||
{
|
inherit filetype;
|
||||||
filetype = "NvimTree";
|
|
||||||
text = "File Explorer";
|
text = "File Explorer";
|
||||||
highlight = "Directory";
|
highlight = "Directory";
|
||||||
separator = true;
|
separator = true;
|
||||||
}
|
}) ["NvimTree" "neo-tree" "snacks_layout_box"];
|
||||||
];
|
|
||||||
description = "The windows to offset bufferline above, see `:help bufferline-offset`";
|
description = "The windows to offset bufferline above, see `:help bufferline-offset`";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ in {
|
||||||
fidget = true,
|
fidget = true,
|
||||||
alpha = true,
|
alpha = true,
|
||||||
leap = true,
|
leap = true,
|
||||||
|
lsp_saga = true,
|
||||||
markdown = true,
|
markdown = true,
|
||||||
noice = true,
|
noice = true,
|
||||||
notify = true, -- nvim-notify
|
notify = true, -- nvim-notify
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,19 @@ in {
|
||||||
grammars = mkOption {
|
grammars = mkOption {
|
||||||
type = listOf package;
|
type = listOf package;
|
||||||
default = [];
|
default = [];
|
||||||
|
example = literalExpression ''
|
||||||
|
pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
||||||
|
regex
|
||||||
|
kdl
|
||||||
|
];
|
||||||
|
'';
|
||||||
description = ''
|
description = ''
|
||||||
List of treesitter grammars to install.
|
List of treesitter grammars to install. For grammars to be installed properly,
|
||||||
|
you must use grammars from `pkgs.vimPlugins.nvim-treesitter.builtGrammars`.
|
||||||
|
|
||||||
For languages already supported by nvf, you may
|
For languages already supported by nvf, you may use
|
||||||
use the {option}`vim.language.<lang>.treesitter` options, which
|
{option}`vim.language.<lang>.treesitter` options, which will automatically add
|
||||||
will automatically add the required grammars to this.
|
the required grammars to this.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ in {
|
||||||
setupOpts = mkPluginSetupOption "vim-illuminate" {
|
setupOpts = mkPluginSetupOption "vim-illuminate" {
|
||||||
filetypes_denylist = mkOption {
|
filetypes_denylist = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = ["dirvish" "fugitive" "NvimTree" "TelescopePrompt"];
|
default = ["dirvish" "fugitive" "help" "neo-tree" "notify" "NvimTree" "TelescopePrompt"];
|
||||||
description = "Filetypes to not illuminate, this overrides `filetypes_allowlist`";
|
description = "Filetypes to not illuminate, this overrides `filetypes_allowlist`";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,6 @@ _: {
|
||||||
imports = [
|
imports = [
|
||||||
./which-key
|
./which-key
|
||||||
./cheatsheet
|
./cheatsheet
|
||||||
|
./hardtime
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
21
modules/plugins/utility/binds/hardtime/config.nix
Normal file
21
modules/plugins/utility/binds/hardtime/config.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
||||||
|
cfg = config.vim.binds.hardtime-nvim;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
startPlugins = ["hardtime-nvim"];
|
||||||
|
|
||||||
|
pluginRC.hardtime = entryAnywhere ''
|
||||||
|
require("hardtime").setup (${toLuaObject cfg.setupOpts})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
./hardtime.nix
|
||||||
./config.nix
|
./config.nix
|
||||||
./lsplines.nix
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue