mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2025-12-20 04:40:08 +01:00
Compare commits
130 commits
ab57610bc9
...
4d80eeb006
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d80eeb006 | ||
|
|
353b63b6ac | ||
|
|
3433bf9071 | ||
|
|
d65c480188 | ||
|
|
f57dbd04fe | ||
|
|
2393647def | ||
|
|
3859b8d9c9 | ||
|
|
9211746d23 | ||
|
|
af04becc50 | ||
|
|
127523101f | ||
|
|
bd90630606 | ||
|
|
d6433345f9 | ||
|
|
2e326bdb68 | ||
|
|
e640feff1a | ||
|
|
123027e48e | ||
|
|
6a80573475 | ||
|
|
6c3efb5b79 | ||
|
|
937f48d4c5 | ||
|
|
290f4e5b08 | ||
|
|
29d78156ac | ||
|
|
44c007f76e | ||
|
|
3c8fde89cc | ||
|
|
b30727e033 | ||
|
|
08a77485aa | ||
|
|
594d7b434b | ||
|
|
4a581e984c | ||
|
|
892f3d6336 | ||
|
|
ac062b2386 | ||
|
|
4b2d169759 | ||
|
|
35430ca7ab | ||
|
|
0c3c67d068 | ||
|
|
b4098ad71f | ||
|
|
06fbacb3d0 | ||
|
|
d7de68f37e | ||
|
|
9300f920f6 | ||
|
|
80938d1056 | ||
|
|
a5fb96675d | ||
|
|
179418e936 | ||
|
|
39fd4fe6ff | ||
|
|
847c1b5647 | ||
|
|
8d7cac7e1c | ||
|
|
a2ffaf84ac | ||
|
|
e0f0017cdd | ||
|
|
aa75d98822 | ||
|
|
2e5544214b | ||
|
|
77bb18fe08 | ||
|
|
2c856dcd64 | ||
|
|
31f212b5d9 | ||
|
|
7ebbe28b11 | ||
|
|
aa191b683e | ||
|
|
8f042cedca | ||
|
|
e78b4ffe07 | ||
|
|
54a64a4560 | ||
|
|
d5920d108b | ||
|
|
187bf3ef25 | ||
|
|
60fe055375 | ||
|
|
25e2cfa49b | ||
|
|
52d36c0c2c | ||
|
|
8a2a635fc4 | ||
|
|
186b6fd8c1 | ||
|
|
4fbc78cd42 | ||
|
|
286f292127 | ||
|
|
d42896be4a | ||
|
|
7dceb8b0c0 | ||
|
|
ac75542243 | ||
| cd81bbb904 | |||
|
|
7ab37d9a82 | ||
| b750c9075b | |||
|
|
3346621cb5 | ||
| eb3cb67375 | |||
|
|
e5aebe2539 | ||
|
|
85a0fc8db0 | ||
| f1ab540454 | |||
|
|
7baf3d260d | ||
| 0eeb3f2b6c | |||
| 18749d6be7 | |||
|
|
2fe8be4b6c | ||
|
|
056328ff4a | ||
|
|
1d362cd88e | ||
| 13b3916c1c | |||
| 1daa263ff2 | |||
| cc985cc3e2 | |||
| a9697fcaac | |||
| b0ca4a7834 | |||
| 8197082539 | |||
|
|
720630064e | ||
|
|
d5d46e501b | ||
|
|
98f4a2ca3d | ||
|
|
fdc522944a | ||
|
|
800df9bdf2 | ||
|
|
d6a2a1a60a | ||
|
|
0894dd6eec | ||
|
|
ffec23e199 | ||
|
|
142f8d0a65 | ||
|
|
966e96ff5d | ||
|
|
71f352d41e | ||
|
|
b4abb3c82d | ||
|
|
313ad612f6 | ||
|
|
e18932d3eb | ||
|
|
a951495882 | ||
|
|
e47306b276 | ||
|
|
da8c682af7 | ||
|
|
1f39882482 | ||
|
|
4498d3b3fa | ||
| a7087e130d | |||
| 3c90fdc998 | |||
|
|
2d823de83e | ||
| 0c411120ae | |||
| d436031468 | |||
| 06937516c7 | |||
|
|
063a27ce7e | ||
| d363d00748 | |||
| 868c7c51b4 | |||
| aad1b16e7b | |||
|
|
cc57325497 | ||
|
|
b18588695d | ||
|
|
26c4a7e3c3 | ||
| cd1317aff7 | |||
|
|
8b38d2407f | ||
|
|
249cabe0c5 | ||
|
|
43b48909a3 | ||
| d5efd7cc1a | |||
| 4e4fa6274e | |||
| 8f3c6410bc | |||
| b01c8ebe0e | |||
|
|
e63f8f4f33 | ||
| 353ade5acc | |||
| 6ba72078e7 | |||
|
|
e32bc41b85 | ||
|
|
f40b143162 |
87 changed files with 3292 additions and 1135 deletions
4
.github/CONTRIBUTING.md
vendored
4
.github/CONTRIBUTING.md
vendored
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
## Preface
|
||||
|
||||
[LICENSE]: ../LICENSE
|
||||
[LICENSE]: /LICENSE
|
||||
|
||||
I am glad you are thinking about contributing to nvf! The project is shaped by
|
||||
contributors and user feedback, and all contributions are appreciated.
|
||||
|
|
@ -30,7 +30,7 @@ personally.
|
|||
|
||||
## Contributing Process
|
||||
|
||||
[pull request template]: ./PULL_REQUEST_TEMPLATE.md
|
||||
[pull request template]: /.github/PULL_REQUEST_TEMPLATE.md
|
||||
|
||||
The contribution process is mostly documented in the [pull request template].
|
||||
When you create a pull request, you will find a checklist of items to complete
|
||||
|
|
|
|||
4
.github/workflows/backport.yml
vendored
4
.github/workflows/backport.yml
vendored
|
|
@ -17,13 +17,13 @@ jobs:
|
|||
if: |
|
||||
github.event.pull_request.merged == true && startsWith(github.event.label.name, 'backport-')
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
token: ${{ steps.app-token.outputs.token }}
|
||||
|
||||
- name: Backport Action
|
||||
uses: korthout/backport-action@v3
|
||||
uses: korthout/backport-action@v4
|
||||
with:
|
||||
# Regex pattern for labels that should trigger a backport AND extracts the target branch
|
||||
# from the name (e.g. v0.x or v0.x.y; we use zerover). This action will ONLY proceed if
|
||||
|
|
|
|||
9
.github/workflows/cachix.yml
vendored
9
.github/workflows/cachix.yml
vendored
|
|
@ -21,11 +21,16 @@ jobs:
|
|||
- nix
|
||||
- maximal
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
name: Checkout
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
uses: cachix/install-nix-action@v31.9.0
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: |
|
||||
substituters = https://cache.nixos.org/ https://feel-co.cachix.org
|
||||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= feel-co.cachix.org-1:nwEFNnwZvtl4KKSH5LDg+/+K7bV0vcs6faMHAJ6xx0w=
|
||||
|
||||
- uses: cachix/cachix-action@v16
|
||||
with:
|
||||
|
|
|
|||
57
.github/workflows/check.yml
vendored
57
.github/workflows/check.yml
vendored
|
|
@ -17,10 +17,13 @@ jobs:
|
|||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
uses: actions/checkout@v6
|
||||
- uses: cachix/install-nix-action@v31.9.0
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: |
|
||||
substituters = https://cache.nixos.org/ https://feel-co.cachix.org
|
||||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= feel-co.cachix.org-1:nwEFNnwZvtl4KKSH5LDg+/+K7bV0vcs6faMHAJ6xx0w=
|
||||
|
||||
- name: Check Flake
|
||||
run: nix flake check
|
||||
|
|
@ -31,10 +34,15 @@ jobs:
|
|||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
uses: cachix/install-nix-action@v31.9.0
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: |
|
||||
substituters = https://cache.nixos.org/ https://feel-co.cachix.org
|
||||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= feel-co.cachix.org-1:nwEFNnwZvtl4KKSH5LDg+/+K7bV0vcs6faMHAJ6xx0w=
|
||||
|
||||
- name: Check formatting via Alejandra
|
||||
run: nix run nixpkgs#alejandra -- --check . --exclude npins
|
||||
|
|
@ -56,7 +64,7 @@ jobs:
|
|||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Check for typos
|
||||
uses: crate-ci/typos@master
|
||||
|
|
@ -83,11 +91,14 @@ jobs:
|
|||
- docs-manpages
|
||||
- docs-json
|
||||
steps:
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
- uses: cachix/install-nix-action@v31.9.0
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: |
|
||||
substituters = https://cache.nixos.org/ https://feel-co.cachix.org
|
||||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= feel-co.cachix.org-1:nwEFNnwZvtl4KKSH5LDg+/+K7bV0vcs6faMHAJ6xx0w=
|
||||
|
||||
- name: Set default git branch (to reduce log spam)
|
||||
run: git config --global init.defaultBranch main
|
||||
|
|
@ -101,7 +112,7 @@ jobs:
|
|||
run: echo "date=$(date +'%Y-%m-%d-%H%M%S')" >> ${GITHUB_OUTPUT}
|
||||
|
||||
- name: Upload doc artifacts
|
||||
uses: actions/upload-artifact@v5
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: "${{ matrix.package }}"
|
||||
path: result/share/doc/nvf
|
||||
|
|
@ -109,13 +120,16 @@ jobs:
|
|||
flake-docs-linkcheck:
|
||||
name: "Validate hyperlinks in documentation sources"
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
if: false # disabled until we fix ndg docs
|
||||
steps:
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
- uses: cachix/install-nix-action@v31.9.0
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: |
|
||||
substituters = https://cache.nixos.org/ https://feel-co.cachix.org
|
||||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= feel-co.cachix.org-1:nwEFNnwZvtl4KKSH5LDg+/+K7bV0vcs6faMHAJ6xx0w=
|
||||
|
||||
- name: Build linkcheck package
|
||||
run: nix build .#docs-linkcheck -Lv
|
||||
|
|
@ -126,7 +140,7 @@ jobs:
|
|||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 2 # slows down checkout, but we need to compare against the previous commit on push events
|
||||
|
||||
|
|
@ -148,7 +162,12 @@ jobs:
|
|||
cat "$HOME/changed_files"
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
uses: cachix/install-nix-action@v31.9.0
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: |
|
||||
substituters = https://cache.nixos.org/ https://feel-co.cachix.org
|
||||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= feel-co.cachix.org-1:nwEFNnwZvtl4KKSH5LDg+/+K7bV0vcs6faMHAJ6xx0w=
|
||||
|
||||
- name: Checking Editorconfig conformance
|
||||
shell: bash
|
||||
|
|
|
|||
2
.github/workflows/cleanup.yml
vendored
2
.github/workflows/cleanup.yml
vendored
|
|
@ -14,7 +14,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: "Delete old branches"
|
||||
uses: beatlabs/delete-old-branches-action@v0.0.11
|
||||
|
|
|
|||
18
.github/workflows/docs-preview.yml
vendored
18
.github/workflows/docs-preview.yml
vendored
|
|
@ -24,11 +24,13 @@ jobs:
|
|||
build-preview:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: cachix/install-nix-action@v31.9.0
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: |
|
||||
substituters = https://cache.nixos.org/ https://feel-co.cachix.org
|
||||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= feel-co.cachix.org-1:nwEFNnwZvtl4KKSH5LDg+/+K7bV0vcs6faMHAJ6xx0w=
|
||||
|
||||
- name: Set default git branch (to reduce log spam)
|
||||
run: git config --global init.defaultBranch main
|
||||
|
|
@ -49,7 +51,7 @@ jobs:
|
|||
mkdir -p $PREVIEW_DIR
|
||||
|
||||
# Copy the build files to the preview subdirectory
|
||||
cp -rvf ../result/share/doc/nvf/* ./$PREVIEW_DIR
|
||||
cp -rvf ../result/share/doc/* ./$PREVIEW_DIR
|
||||
|
||||
# Configure git to use the GitHub Actions token for authentication
|
||||
git config --global user.name "GitHub Actions"
|
||||
|
|
@ -127,7 +129,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Delete preview for closed/merged PR
|
||||
run: |
|
||||
|
|
@ -164,7 +166,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Double check preview directory deletion
|
||||
run: |
|
||||
|
|
|
|||
15
.github/workflows/manual.yml
vendored
15
.github/workflows/manual.yml
vendored
|
|
@ -28,7 +28,7 @@ jobs:
|
|||
outputs:
|
||||
should_run: ${{ steps.should_run.outputs.should_run }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- name: print latest_commit
|
||||
run: echo ${{ github.sha }}
|
||||
|
||||
|
|
@ -43,11 +43,18 @@ jobs:
|
|||
if: ${{ needs.check_date.outputs.should_run != 'false' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: actions/checkout@v6
|
||||
- uses: cachix/install-nix-action@v31.9.0
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config: |
|
||||
substituters = https://cache.nixos.org/ https://feel-co.cachix.org
|
||||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= feel-co.cachix.org-1:nwEFNnwZvtl4KKSH5LDg+/+K7bV0vcs6faMHAJ6xx0w=
|
||||
|
||||
- run: |
|
||||
nix build .#docs -Lv
|
||||
cp -r result/share/doc/nvf public
|
||||
cp -r result/share/doc public
|
||||
|
||||
- uses: peaceiris/actions-gh-pages@v4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
|||
6
.github/workflows/update.yml
vendored
6
.github/workflows/update.yml
vendored
|
|
@ -9,10 +9,10 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: "Install Nix"
|
||||
uses: cachix/install-nix-action@v31.8.2
|
||||
uses: cachix/install-nix-action@v31.9.0
|
||||
|
||||
- name: Set up Git
|
||||
run: |
|
||||
|
|
@ -69,7 +69,7 @@ jobs:
|
|||
|
||||
- name: Create Pull Request
|
||||
if: steps.check_changes.outputs.changes_detected == 'true'
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
uses: peter-evans/create-pull-request@v8
|
||||
with:
|
||||
branch: ${{ env.BRANCH_NAME }}
|
||||
base: main
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ isMaximal: {
|
|||
typst.enable = isMaximal;
|
||||
rust = {
|
||||
enable = isMaximal;
|
||||
crates.enable = isMaximal;
|
||||
extensions.crates-nvim.enable = isMaximal;
|
||||
};
|
||||
|
||||
# Language modules that are not as common.
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@
|
|||
|
||||
# Generate the HTML manual pages
|
||||
html = pkgs.callPackage ./manual.nix {
|
||||
inherit release;
|
||||
inherit inputs release;
|
||||
inherit (nvimModuleDocs) optionsJSON;
|
||||
};
|
||||
in {
|
||||
|
|
|
|||
133
docs/manual.nix
133
docs/manual.nix
|
|
@ -1,114 +1,47 @@
|
|||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
fetchzip,
|
||||
runCommandLocal,
|
||||
# build inputs
|
||||
nixos-render-docs,
|
||||
documentation-highlighter,
|
||||
dart-sass,
|
||||
inputs,
|
||||
path,
|
||||
# nrd configuration
|
||||
release,
|
||||
stdenvNoCC,
|
||||
runCommandLocal,
|
||||
optionsJSON,
|
||||
release,
|
||||
} @ args: let
|
||||
manual-release = args.release or "unstable";
|
||||
|
||||
scss-reset = fetchzip {
|
||||
url = "https://github.com/Frontend-Layers/scss-reset/archive/refs/tags/1.4.2.zip";
|
||||
hash = "sha256-cif5Sx8Ca5vxdw/mNAgpulLH15TwmzyJFNM7JURpoaE=";
|
||||
};
|
||||
|
||||
compileStylesheet = runCommandLocal "compile-nvf-stylesheet" {} ''
|
||||
mkdir -p $out
|
||||
|
||||
tmpfile=$(mktemp -d)
|
||||
trap "rm -r $tmpfile" EXIT
|
||||
|
||||
ln -s "${scss-reset}/build" "$tmpfile/scss-reset"
|
||||
|
||||
${dart-sass}/bin/sass --load-path "$tmpfile" \
|
||||
${./static/style.scss} "$out/style.css"
|
||||
|
||||
echo "Generated styles"
|
||||
'';
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "nvf-manual";
|
||||
src = builtins.path {
|
||||
name = "nvf-manual-${manual-release}";
|
||||
path = lib.sourceFilesBySuffices ./manual [".md" ".md.in"];
|
||||
};
|
||||
runCommandLocal "nvf-docs-html" {
|
||||
nativeBuildInputs = [
|
||||
(inputs.ndg.packages.${stdenvNoCC.system}.ndg.overrideAttrs
|
||||
{
|
||||
# FIXME: the tests take too long to build
|
||||
doCheck = false;
|
||||
})
|
||||
];
|
||||
} ''
|
||||
mkdir -p $out/share/doc
|
||||
|
||||
strictDependencies = true;
|
||||
nativeBuildInputs = [nixos-render-docs];
|
||||
# Copy the markdown sources to be processed by ndg. This is not
|
||||
# strictly necessary, but allows us to modify the Markdown sources
|
||||
# as we see fit.
|
||||
cp -rvf ${./manual} ./manual
|
||||
|
||||
postPatch = ''
|
||||
ln -s ${optionsJSON}/share/doc/nixos/options.json ./config-options.json
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
dest="$out/share/doc/nvf"
|
||||
mkdir -p "$(dirname "$dest")"
|
||||
mkdir -p $dest/{highlightjs,script}
|
||||
|
||||
# Copy highlight scripts to /highlights in document root.
|
||||
cp -vt $dest/highlightjs \
|
||||
${documentation-highlighter}/highlight.pack.js \
|
||||
${documentation-highlighter}/LICENSE \
|
||||
${documentation-highlighter}/mono-blue.css \
|
||||
${documentation-highlighter}/loader.js
|
||||
|
||||
# Copy anchor scripts to the script directory in document root.
|
||||
cp -vt "$dest"/script \
|
||||
${./static/script}/anchor-min.js \
|
||||
${./static/script}/anchor-use.js \
|
||||
${./static/script}/search.js
|
||||
|
||||
substituteInPlace ./options.md \
|
||||
--subst-var-by OPTIONS_JSON ./config-options.json
|
||||
|
||||
substituteInPlace ./manual.md \
|
||||
# Replace variables following the @VARIABLE@ style in the manual
|
||||
# pages. This can be built into ndg at a later date.
|
||||
substituteInPlace ./manual/index.md \
|
||||
--subst-var-by NVF_VERSION ${manual-release}
|
||||
|
||||
substituteInPlace ./hacking/additional-plugins.md \
|
||||
--subst-var-by NVF_REPO "https://github.com/notashelf/nvf/blob/${manual-release}"
|
||||
|
||||
# Move compiled stylesheet
|
||||
cp -vt $dest \
|
||||
${compileStylesheet}/style.css
|
||||
|
||||
# Move release notes
|
||||
cp -vr ${./release-notes} release-notes
|
||||
|
||||
# Generate final manual from a set of parameters. Explanation of the CLI flags are
|
||||
# as follows:
|
||||
#
|
||||
# 1. --manpage-urls will allow you to use manual pages as they are defined in
|
||||
# the nixpkgs documentation.
|
||||
# 2. --revision is the project revision as it is defined in 'release.json' in the
|
||||
# repository root
|
||||
# 3. --script will inject a given Javascript file into the resulting pages inside
|
||||
# the <script> tag.
|
||||
# 4. --toc-depth will determine the depth of the initial Table of Contents while
|
||||
# --section-toc-depth will determine the depth of per-section Table of Contents
|
||||
# sections.
|
||||
nixos-render-docs manual html \
|
||||
--manpage-urls ${path + "/doc/manpage-urls.json"} \
|
||||
--revision ${lib.trivial.revisionWithDefault manual-release} \
|
||||
--stylesheet style.css \
|
||||
--script highlightjs/highlight.pack.js \
|
||||
--script highlightjs/loader.js \
|
||||
--script script/anchor-use.js \
|
||||
--script script/anchor-min.js \
|
||||
--script script/search.js \
|
||||
--toc-depth 1 \
|
||||
--section-toc-depth 1 \
|
||||
manual.md \
|
||||
"$dest/index.xhtml"
|
||||
# Generate the final manual from a set of parameters. This uses
|
||||
# feel-co/ndg to render the web manual.
|
||||
ndg html \
|
||||
--jobs $NIX_BUILD_CORES --title "NVF" \
|
||||
--module-options ${optionsJSON}/share/doc/nixos/options.json \
|
||||
--manpage-urls ${path}/doc/manpage-urls.json \
|
||||
--options-depth 3 \
|
||||
--generate-search \
|
||||
--highlight-code \
|
||||
--input-dir ./manual \
|
||||
--output-dir "$out/share/doc"
|
||||
|
||||
# Hydra support. Probably not necessary.
|
||||
mkdir -p $out/nix-support/
|
||||
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
}
|
||||
''
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# Configuring nvf {#ch-configuring}
|
||||
|
||||
[helpful tips section]: #ch-helpful-tips
|
||||
[helpful tips section]: ./tips.html#ch-helpful-tips
|
||||
[options reference]: ./options.html
|
||||
|
||||
nvf allows for _very_ extensive configuration in Neovim through the Nix module
|
||||
interface. The below chapters describe several of the options exposed in nvf for
|
||||
|
|
@ -8,7 +9,7 @@ your convenience. You might also be interested in the [helpful tips section] for
|
|||
more advanced or unusual configuration options supported by nvf.
|
||||
|
||||
Note that this section does not cover module _options_. For an overview of all
|
||||
module options provided by nvf, please visit the [appendix](/nvf/options.html)
|
||||
module options provided by nvf, please visit the [options reference]
|
||||
|
||||
```{=include=} chapters
|
||||
configuring/custom-package.md
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
# Custom Neovim Package {#ch-custom-package}
|
||||
|
||||
As of v0.5, you may now specify the Neovim package that will be wrapped with
|
||||
your configuration. This is done with the [](#opt-vim.package) option.
|
||||
|
||||
```nix
|
||||
{inputs, pkgs, ...}: {
|
||||
# using the neovim-nightly overlay
|
||||
vim.package = inputs.neovim-overlay.packages.${pkgs.stdenv.system}.neovim;
|
||||
}
|
||||
```
|
||||
|
||||
The neovim-nightly-overlay always exposes an unwrapped package. If using a
|
||||
different source, you are highly recommended to get an "unwrapped" version of
|
||||
the neovim package, similar to `neovim-unwrapped` in nixpkgs.
|
||||
|
||||
```nix
|
||||
{ pkgs, ...}: {
|
||||
# using the neovim-nightly overlay
|
||||
vim.package = pkgs.neovim-unwrapped;
|
||||
}
|
||||
```
|
||||
|
|
@ -19,7 +19,7 @@ as a module.
|
|||
:::{.info}
|
||||
|
||||
To add a plugin to your runtime, you will need to add it to
|
||||
[](#opt-vim.startPlugins) list in your configuration. This is akin to cloning a
|
||||
{option}`vim.startPlugins` list in your configuration. This is akin to cloning a
|
||||
plugin to `~/.config/nvim`, but they are only ever placed in the Nix store and
|
||||
never exposed to the outside world for purity and full isolation.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
# Legacy Method {#sec-legacy-method}
|
||||
|
||||
Prior to version **0.5**, the method of adding new plugins was adding the plugin
|
||||
package to [](#opt-vim.startPlugins) and adding its configuration as a DAG under
|
||||
one of `vim.configRC` or [](#opt-vim.luaConfigRC). While `configRC` has been
|
||||
deprecated, users who have not yet updated to 0.5 or those who prefer a more
|
||||
hands-on approach may choose to use the old method where the load order of the
|
||||
plugins is explicitly determined by DAGs without internal abstractions.
|
||||
package to {option}`vim.startPlugins` and adding its configuration as a DAG
|
||||
under one of `vim.configRC` or {option}`vim.luaConfigRC`. While `configRC` has
|
||||
been deprecated, users who have not yet updated to 0.5 or those who prefer a
|
||||
more hands-on approach may choose to use the old method where the load order of
|
||||
the plugins is explicitly determined by DAGs without internal abstractions.
|
||||
|
||||
## Adding New Plugins {#sec-adding-new-plugins}
|
||||
|
||||
To add a plugin not available in **nvf** as a module to your configuration using
|
||||
the legacy method, you must add it to [](#opt-vim.startPlugins) in order to make
|
||||
it available to Neovim at runtime.
|
||||
the legacy method, you must add it to {option}`vim.startPlugins` in order to
|
||||
make it available to Neovim at runtime.
|
||||
|
||||
```nix
|
||||
{pkgs, ...}: {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
As of version **0.5**, we have a more extensive API for configuring plugins that
|
||||
should be preferred over the legacy method. This API is available as
|
||||
[](#opt-vim.extraPlugins). Instead of using DAGs exposed by the library
|
||||
{option}`vim.extraPlugins`. Instead of using DAGs exposed by the library
|
||||
_directly_, you may use the extra plugin module as follows:
|
||||
|
||||
```nix
|
||||
|
|
|
|||
|
|
@ -6,49 +6,89 @@ formatters, and `nvim-lint` linter integration. This gets you capabilities
|
|||
ranging from autocompletion to formatting to diagnostics. The following
|
||||
languages have sections under the `vim.languages` attribute.
|
||||
|
||||
- Rust: [vim.languages.rust.enable](#opt-vim.languages.rust.enable)
|
||||
- Nix: [vim.languages.nix.enable](#opt-vim.languages.nix.enable)
|
||||
- SQL: [vim.languages.sql.enable](#opt-vim.languages.sql.enable)
|
||||
- C/C++: [vim.languages.clang.enable](#opt-vim.languages.clang.enable)
|
||||
- Typescript/Javascript: [vim.languages.ts.enable](#opt-vim.languages.ts.enable)
|
||||
- Python: [vim.languages.python.enable](#opt-vim.languages.python.enable):
|
||||
- Zig: [vim.languages.zig.enable](#opt-vim.languages.zig.enable)
|
||||
- Markdown: [vim.languages.markdown.enable](#opt-vim.languages.markdown.enable)
|
||||
- HTML: [vim.languages.html.enable](#opt-vim.languages.html.enable)
|
||||
- Dart: [vim.languages.dart.enable](#opt-vim.languages.dart.enable)
|
||||
- Go: [vim.languages.go.enable](#opt-vim.languages.go.enable)
|
||||
- Lua: [vim.languages.lua.enable](#opt-vim.languages.lua.enable)
|
||||
- PHP: [vim.languages.php.enable](#opt-vim.languages.php.enable)
|
||||
- F#: [vim.languages.fsharp.enable](#opt-vim.languages.fsharp.enable)
|
||||
- Assembly: [vim.languages.assembly.enable](#opt-vim.languages.assembly.enable)
|
||||
- Astro: [vim.languages.astro.enable](#opt-vim.languages.astro.enable)
|
||||
- Bash: [vim.languages.bash.enable](#opt-vim.languages.bash.enable)
|
||||
- Clang: [vim.languages.clang.enable](#opt-vim.languages.clang.enable)
|
||||
- Clojure: [vim.languages.clojure.enable](#opt-vim.languages.clojure.enable)
|
||||
- C#: [vim.languages.csharp.enable](#opt-vim.languages.csharp.enable)
|
||||
- CSS: [vim.languages.css.enable](#opt-vim.languages.css.enable)
|
||||
- CUE: [vim.languages.cue.enable](#opt-vim.languages.cue.enable)
|
||||
- Elixir: [vim.languages.elixir.enable](#opt-vim.languages.elixir.enable)
|
||||
- Gleam: [vim.languages.gleam.enable](#opt-vim.languages.gleam.enable)
|
||||
- HCL: [vim.languages.hcl.enable](#opt-vim.languages.hcl.enable)
|
||||
- Helm: [vim.languages.helm.enable](#opt-vim.languages.helm.enable)
|
||||
- Julia: [vim.languages.julia.enable](#opt-vim.languages.julia.enable)
|
||||
- Kotlin: [vim.languages.kotlin.enable](#opt-vim.languages.kotlin.enable)
|
||||
- Nim: [vim.languages.nim.enable](#opt-vim.languages.nim.enable)
|
||||
- Nu: [vim.languages.nu.enable](#opt-vim.languages.nu.enable)
|
||||
- OCaml: [vim.languages.ocaml.enable](#opt-vim.languages.ocaml.enable)
|
||||
- Odin: [vim.languages.odin.enable](#opt-vim.languages.odin.enable)
|
||||
- R: [vim.languages.r.enable](#opt-vim.languages.r.enable)
|
||||
- Ruby: [vim.languages.ruby.enable](#opt-vim.languages.ruby.enable)
|
||||
- Scala: [vim.languages.scala.enable](#opt-vim.languages.scala.enable)
|
||||
- Svelte: [vim.languages.svelte.enable](#opt-vim.languages.svelte.enable)
|
||||
- Tailwind: [vim.languages.tailwind.enable](#opt-vim.languages.tailwind.enable)
|
||||
- Rust:
|
||||
[vim.languages.rust.enable](./options.html#option-vim-languages-rust-enable)
|
||||
- Nix:
|
||||
[vim.languages.nix.enable](./options.html#option-vim-languages-nix-enable)
|
||||
- SQL:
|
||||
[vim.languages.sql.enable](./options.html#option-vim-languages-sql-enable)
|
||||
- C/C++:
|
||||
[vim.languages.clang.enable](./options.html#option-vim-languages-clang-enable)
|
||||
- Typescript/Javascript:
|
||||
[vim.languages.ts.enable](./options.html#option-vim-languages-ts-enable)
|
||||
- Python:
|
||||
[vim.languages.python.enable](./options.html#option-vim-languages-python-enable):
|
||||
- Zig:
|
||||
[vim.languages.zig.enable](./options.html#option-vim-languages-zig-enable)
|
||||
- Markdown:
|
||||
[vim.languages.markdown.enable](./options.html#option-vim-languages-markdown-enable)
|
||||
- HTML:
|
||||
[vim.languages.html.enable](./options.html#option-vim-languages-html-enable)
|
||||
- Dart:
|
||||
[vim.languages.dart.enable](./options.html#option-vim-languages-dart-enable)
|
||||
- Go: [vim.languages.go.enable](./options.html#option-vim-languages-go-enable)
|
||||
- Lua:
|
||||
[vim.languages.lua.enable](./options.html#option-vim-languages-lua-enable)
|
||||
- PHP:
|
||||
[vim.languages.php.enable](./options.html#option-vim-languages-php-enable)
|
||||
- F#:
|
||||
[vim.languages.fsharp.enable](./options.html#option-vim-languages-fsharp-enable)
|
||||
- Assembly:
|
||||
[vim.languages.assembly.enable](./options.html#option-vim-languages-assembly-enable)
|
||||
- Astro:
|
||||
[vim.languages.astro.enable](./options.html#option-vim-languages-astro-enable)
|
||||
- Bash:
|
||||
[vim.languages.bash.enable](./options.html#option-vim-languages-bash-enable)
|
||||
- Clang:
|
||||
[vim.languages.clang.enable](./options.html#option-vim-languages-clang-enable)
|
||||
- Clojure:
|
||||
[vim.languages.clojure.enable](./options.html#option-vim-languages-clojure-enable)
|
||||
- C#:
|
||||
[vim.languages.csharp.enable](./options.html#option-vim-languages-csharp-enable)
|
||||
- CSS:
|
||||
[vim.languages.css.enable](./options.html#option-vim-languages-css-enable)
|
||||
- CUE:
|
||||
[vim.languages.cue.enable](./options.html#option-vim-languages-cue-enable)
|
||||
- Elixir:
|
||||
[vim.languages.elixir.enable](./options.html#option-vim-languages-elixir-enable)
|
||||
- Gleam:
|
||||
[vim.languages.gleam.enable](./options.html#option-vim-languages-gleam-enable)
|
||||
- HCL:
|
||||
[vim.languages.hcl.enable](./options.html#option-vim-languages-hcl-enable)
|
||||
- Helm:
|
||||
[vim.languages.helm.enable](./options.html#option-vim-languages-helm-enable)
|
||||
- Julia:
|
||||
[vim.languages.julia.enable](./options.html#option-vim-languages-julia-enable)
|
||||
- Kotlin:
|
||||
[vim.languages.kotlin.enable](./options.html#option-vim-languages-kotlin-enable)
|
||||
- Nim:
|
||||
[vim.languages.nim.enable](./options.html#option-vim-languages-nim-enable)
|
||||
- Nu: [vim.languages.nu.enable](./options.html#option-vim-languages-nu-enable)
|
||||
- OCaml:
|
||||
[vim.languages.ocaml.enable](./options.html#option-vim-languages-ocaml-enable)
|
||||
- Odin:
|
||||
[vim.languages.odin.enable](./options.html#option-vim-languages-odin-enable)
|
||||
- R: [vim.languages.r.enable](./options.html#option-vim-languages-r-enable)
|
||||
- Ruby:
|
||||
[vim.languages.ruby.enable](./options.html#option-vim-languages-ruby-enable)
|
||||
- Scala:
|
||||
[vim.languages.scala.enable](./options.html#option-vim-languages-scala-enable)
|
||||
- Svelte:
|
||||
[vim.languages.svelte.enable](./options.html#option-vim-languages-svelte-enable)
|
||||
- Tailwind:
|
||||
[vim.languages.tailwind.enable](./options.html#option-vim-languages-tailwind-enable)
|
||||
- Terraform:
|
||||
[vim.languages.terraform.enable](#opt-vim.languages.terraform.enable)
|
||||
- Typst: [vim.languages.typst.enable](#opt-vim.languages.typst.enable)
|
||||
- Vala: [vim.languages.vala.enable](#opt-vim.languages.vala.enable)
|
||||
- WGSL: [vim.languages.wgsl.enable](#opt-vim.languages.wgsl.enable)
|
||||
- YAML: [vim.languages.yaml.enable](#opt-vim.languages.yaml.enable)
|
||||
[vim.languages.terraform.enable](./options.html#option-vim-languages-terraform-enable)
|
||||
- Tex:
|
||||
[vim.languages.tex.enable](./options.html#option-vim-languages-tex-enable)
|
||||
- Typst:
|
||||
[vim.languages.typst.enable](./options.html#option-vim-languages-typst-enable)
|
||||
- Vala:
|
||||
[vim.languages.vala.enable](./options.html#option-vim-languages-vala-enable)
|
||||
- WGSL:
|
||||
[vim.languages.wgsl.enable](./options.html#option-vim-languages-wgsl-enable)
|
||||
- YAML:
|
||||
[vim.languages.yaml.enable](./options.html#option-vim-languages-yaml-enable)
|
||||
|
||||
Adding support for more languages, and improving support for existing ones are
|
||||
great places where you can contribute with a PR.
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
# Overriding plugins {#ch-overriding-plugins}
|
||||
|
||||
The [additional plugins section](#sec-additional-plugins) details the addition
|
||||
of new plugins to nvf under regular circumstances, i.e. while making a pull
|
||||
request to the project. You may _override_ those plugins in your config to
|
||||
change source versions, e.g., to use newer versions of plugins that are not yet
|
||||
updated in **nvf**.
|
||||
The [additional plugins section](./hacking.html#sec-additional-plugins) details
|
||||
the addition of new plugins to nvf under regular circumstances, i.e. while
|
||||
making a pull request to the project. You may _override_ those plugins in your
|
||||
config to change source versions, e.g., to use newer versions of plugins that
|
||||
are not yet updated in **nvf**.
|
||||
|
||||
```nix
|
||||
vim.pluginOverrides = {
|
||||
|
|
@ -22,7 +22,7 @@ vim.pluginOverrides = {
|
|||
};
|
||||
```
|
||||
|
||||
This will override the source for the `neodev.nvim` plugin that is used in nvf
|
||||
This will override the source for the `lazydev.nvim` plugin that is used in nvf
|
||||
with your own plugin.
|
||||
|
||||
::: {.warning}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,586 @@ ideally also include relevant context in which an issue occurs or a feature
|
|||
should be implemented. If you wish to make a contribution, but feel stuck -
|
||||
please do not be afraid to submit a pull request, we will help you get it in.
|
||||
|
||||
```{=include=} sections
|
||||
hacking/getting-started.md
|
||||
hacking/guidelines.md
|
||||
hacking/testing.md
|
||||
hacking/keybinds.md
|
||||
hacking/additional-plugins.md
|
||||
## Getting Started {#sec-contrib-getting-started}
|
||||
|
||||
You, naturally, would like to start by forking the repository to get started. If
|
||||
you are new to Git and GitHub, do have a look at GitHub's
|
||||
[Fork a repo guide](https://help.github.com/articles/fork-a-repo/) for
|
||||
instructions on how you can do this. Once you have a fork of **nvf**, you should
|
||||
create a separate branch based on the most recent `main` branch. Give your
|
||||
branch a reasonably descriptive name (e.g. `feature/debugger` or
|
||||
`fix/pesky-bug`) and you are ready to work on your changes
|
||||
|
||||
Implement your changes and commit them to the newly created branch and when you
|
||||
are happy with the result, and positive that it fulfills our
|
||||
[Contributing Guidelines](#sec-guidelines), push the branch to GitHub and
|
||||
[create a pull request](https://help.github.com/articles/creating-a-pull-request).
|
||||
The default pull request template available on the **nvf** repository will guide
|
||||
you through the rest of the process, and we'll gently nudge you in the correct
|
||||
direction if there are any mistakes.
|
||||
|
||||
## Guidelines {#sec-guidelines}
|
||||
|
||||
If your contribution tightly follows the guidelines, then there is a good chance
|
||||
it will be merged without too much trouble. Some of the guidelines will be
|
||||
strictly enforced, others will remain as gentle nudges towards the correct
|
||||
direction. As we have no automated system enforcing those guidelines, please try
|
||||
to double check your changes before making your pull request in order to avoid
|
||||
"faulty" code slipping by.
|
||||
|
||||
If you are uncertain how these rules affect the change you would like to make
|
||||
then feel free to start a discussion in the
|
||||
[discussions tab](https://github.com/NotAShelf/nvf/discussions) ideally (but not
|
||||
necessarily) before you start developing.
|
||||
|
||||
### Adding Documentation {#sec-guidelines-documentation}
|
||||
|
||||
[Nixpkgs Flavoured Markdown]: https://github.com/NixOS/nixpkgs/blob/master/doc/README.md#syntax
|
||||
|
||||
Almost all changes warrant updates to the documentation: at the very least, you
|
||||
must update the changelog. Both the manual and module options use
|
||||
[Nixpkgs Flavoured Markdown].
|
||||
|
||||
The HTML version of this manual containing both the module option descriptions
|
||||
and the documentation of **nvf** (such as this page) can be generated and opened
|
||||
by typing the following in a shell within a clone of the **nvf** Git repository:
|
||||
|
||||
```console
|
||||
$ nix build .#docs-html
|
||||
$ xdg-open $PWD/result/share/doc/nvf/index.html
|
||||
```
|
||||
|
||||
### Formatting Code {#sec-guidelines-formatting}
|
||||
|
||||
Make sure your code is formatted as described in
|
||||
[code-style section](#sec-guidelines-code-style). To maintain consistency
|
||||
throughout the project you are encouraged to browse through existing code and
|
||||
adopt its style also in new code.
|
||||
|
||||
### Formatting Commits {#sec-guidelines-commit-message-style}
|
||||
|
||||
Similar to [code style guidelines](#sec-guidelines-code-style) we encourage a
|
||||
consistent commit message format as described in
|
||||
[commit style guidelines](#sec-guidelines-commit-style).
|
||||
|
||||
### Commit Style {#sec-guidelines-commit-style}
|
||||
|
||||
The commits in your pull request should be reasonably self-contained. Which
|
||||
means each and every commit in a pull request should make sense both on its own
|
||||
and in general context. That is, a second commit should not resolve an issue
|
||||
that is introduced in an earlier commit. In particular, you will be asked to
|
||||
amend any commit that introduces syntax errors or similar problems even if they
|
||||
are fixed in a later commit.
|
||||
|
||||
The commit messages should follow the
|
||||
[seven rules](https://chris.beams.io/posts/git-commit/#seven-rule), except for
|
||||
"Capitalize the subject line". We also ask you to include the affected code
|
||||
component or module in the first line. A commit message ideally, but not
|
||||
necessarily, follow the given template from home-manager's own documentation
|
||||
|
||||
```
|
||||
{component}: {description}
|
||||
|
||||
{long description}
|
||||
```
|
||||
|
||||
where `{component}` refers to the code component (or module) your change
|
||||
affects, `{description}` is a very brief description of your change, and
|
||||
`{long description}` is an optional clarifying description. As a rare exception,
|
||||
if there is no clear component, or your change affects many components, then the
|
||||
`{component}` part is optional. See
|
||||
[example commit message](#sec-guidelines-ex-commit-message) for a commit message
|
||||
that fulfills these requirements.
|
||||
|
||||
#### Example Commit {#sec-guidelines-ex-commit-message}
|
||||
|
||||
The commit
|
||||
[69f8e47e9e74c8d3d060ca22e18246b7f7d988ef](https://github.com/nix-community/home-manager/commit/69f8e47e9e74c8d3d060ca22e18246b7f7d988ef)
|
||||
in home-manager contains the following commit message.
|
||||
|
||||
```
|
||||
starship: allow running in Emacs if vterm is used
|
||||
|
||||
The vterm buffer is backed by libvterm and can handle Starship prompts
|
||||
without issues.
|
||||
```
|
||||
|
||||
Similarly, if you are contributing to **nvf**, you would include the scope of
|
||||
the commit followed by the description:
|
||||
|
||||
```
|
||||
languages/ruby: init module
|
||||
|
||||
Adds a language module for Ruby, adds appropriate formatters and Treesitter grammars
|
||||
```
|
||||
|
||||
Long description can be omitted if the change is too simple to warrant it. A
|
||||
minor fix in spelling or a formatting change does not warrant long description,
|
||||
however, a module addition or removal does as you would like to provide the
|
||||
relevant context, i.e. the reasoning behind it, for your commit.
|
||||
|
||||
Finally, when adding a new module, say `modules/foo.nix`, we use the fixed
|
||||
commit format `foo: add module`. You can, of course, still include a long
|
||||
description if you wish.
|
||||
|
||||
In case of nested modules, i.e `modules/languages/java.nix` you are recommended
|
||||
to contain the parent as well - for example `languages/java: some major change`.
|
||||
|
||||
### Code Style {#sec-guidelines-code-style}
|
||||
|
||||
#### Treewide {#sec-code-style-treewide}
|
||||
|
||||
Keep lines at a reasonable width, ideally 80 characters or less. This also
|
||||
applies to string literals and module descriptions and documentation.
|
||||
|
||||
#### Nix {#sec-code-style-nix}
|
||||
|
||||
[alejandra]: https://github.com/kamadorueda/alejandra
|
||||
|
||||
**nvf** is formatted by the [alejandra] tool and the formatting is checked in
|
||||
the pull request and push workflows. Run the `nix fmt` command inside the
|
||||
project repository before submitting your pull request.
|
||||
|
||||
While Alejandra is mostly opinionated on how code looks after formatting,
|
||||
certain changes are done at the user's discretion based on how the original code
|
||||
was structured.
|
||||
|
||||
Please use one line code for attribute sets that contain only one subset. For
|
||||
example:
|
||||
|
||||
```nix
|
||||
# parent modules should always be unfolded
|
||||
# which means module = { value = ... } instead of module.value = { ... }
|
||||
module = {
|
||||
value = mkEnableOption "some description" // { default = true; }; # merges can be done inline where possible
|
||||
|
||||
# same as parent modules, unfold submodules
|
||||
subModule = {
|
||||
# this is an option that contains more than one nested value
|
||||
# Note: try to be careful about the ordering of `mkOption` arguments.
|
||||
# General rule of thumb is to order from least to most likely to change.
|
||||
# This is, for most cases, type < default < description.
|
||||
# Example, if present, would be between default and description
|
||||
someOtherValue = mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Some other description";
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
If you move a line down after the merge operator, Alejandra will automatically
|
||||
unfold the whole merged attrset for you, which we **do not** want.
|
||||
|
||||
```nix
|
||||
module = {
|
||||
key = mkEnableOption "some description" // {
|
||||
default = true; # we want this to be inline
|
||||
}; # ...
|
||||
}
|
||||
```
|
||||
|
||||
For lists, it is mostly up to your own discretion how you want to format them,
|
||||
but please try to unfold lists if they contain multiple items and especially if
|
||||
they are to include comments.
|
||||
|
||||
```nix
|
||||
# this is ok
|
||||
acceptableList = [
|
||||
item1 # comment
|
||||
item2
|
||||
item3 # some other comment
|
||||
item4
|
||||
];
|
||||
|
||||
# this is not ok
|
||||
listToBeAvoided = [item1 item2 /* comment */ item3 item4];
|
||||
|
||||
# this is ok
|
||||
acceptableList = [item1 item2];
|
||||
|
||||
# this is also ok if the list is expected to contain more elements
|
||||
acceptableList= [
|
||||
item1
|
||||
item2
|
||||
# more items if needed...
|
||||
];
|
||||
```
|
||||
|
||||
## Testing Changes {#sec-testing-changes}
|
||||
|
||||
Once you have made your changes, you will need to test them thoroughly. If it is
|
||||
a module, add your module option to `configuration.nix` (located in the root of
|
||||
this project) inside `neovimConfiguration`. Enable it, and then run the maximal
|
||||
configuration with `nix run .#maximal -Lv` to check for build errors. If neovim
|
||||
opens in the current directory without any error messages (you can check the
|
||||
output of `:messages` inside neovim to see if there are any errors), then your
|
||||
changes are good to go. Open your pull request, and it will be reviewed as soon
|
||||
as possible.
|
||||
|
||||
If it is not a new module, but a change to an existing one, then make sure the
|
||||
module you have changed is enabled in the maximal configuration by editing
|
||||
`configuration.nix`, and then run it with `nix run .#maximal -Lv`. Same
|
||||
procedure as adding a new module will apply here.
|
||||
|
||||
## Keybinds {#sec-keybinds}
|
||||
|
||||
As of 0.4, there exists an API for writing your own keybinds and a couple of
|
||||
useful utility functions are available in the
|
||||
[extended standard library](https://github.com/NotAShelf/nvf/tree/main/lib). The
|
||||
following section contains a general overview to how you may utilize said
|
||||
functions.
|
||||
|
||||
## Custom Key Mappings Support for a Plugin {#sec-custom-key-mappings}
|
||||
|
||||
To set a mapping, you should define it in `vim.keymaps`.
|
||||
|
||||
An example, simple keybinding, can look like this:
|
||||
|
||||
```nix
|
||||
{
|
||||
vim.keymaps = [
|
||||
{
|
||||
key = "<leader>wq";
|
||||
mode = ["n"];
|
||||
action = ":wq<CR>";
|
||||
silent = true;
|
||||
desc = "Save file and quit";
|
||||
}
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
There are many settings available in the options. Please refer to the
|
||||
[documentation](./options.html#option-vim-keymaps) to see a list of them.
|
||||
|
||||
**nvf** provides a helper function, so that you don't have to write the mapping
|
||||
attribute sets every time:
|
||||
|
||||
- `mkKeymap`, which mimics neovim's `vim.keymap.set` function
|
||||
|
||||
You can read the source code of some modules to see them in action, but the
|
||||
usage should look something like this:
|
||||
|
||||
```nix
|
||||
# plugindefinition.nix
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options.vim.plugin = {
|
||||
enable = mkEnableOption "Enable plugin";
|
||||
|
||||
# Mappings should always be inside an attrset called mappings
|
||||
mappings = {
|
||||
workspaceDiagnostics = mkMappingOption "Workspace diagnostics [trouble]" "<leader>lwd";
|
||||
documentDiagnostics = mkMappingOption "Document diagnostics [trouble]" "<leader>ld";
|
||||
lspReferences = mkMappingOption "LSP References [trouble]" "<leader>lr";
|
||||
quickfix = mkMappingOption "QuickFix [trouble]" "<leader>xq";
|
||||
locList = mkMappingOption "LOCList [trouble]" "<leader>xl";
|
||||
symbols = mkMappingOption "Symbols [trouble]" "<leader>xs";
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
```nix
|
||||
# config.nix
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) mkKeymap;
|
||||
|
||||
cfg = config.vim.plugin;
|
||||
|
||||
keys = cfg.mappings;
|
||||
inherit (options.vim.lsp.trouble) mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.keymaps = [
|
||||
(mkKeymap "n" keys.workspaceDiagnostics "<cmd>Trouble toggle diagnostics<CR>" {desc = mappings.workspaceDiagnostics.description;})
|
||||
(mkKeymap "n" keys.documentDiagnostics "<cmd>Trouble toggle diagnostics filter.buf=0<CR>" {desc = mappings.documentDiagnostics.description;})
|
||||
(mkKeymap "n" keys.lspReferences "<cmd>Trouble toggle lsp_references<CR>" {desc = mappings.lspReferences.description;})
|
||||
(mkKeymap "n" keys.quickfix "<cmd>Trouble toggle quickfix<CR>" {desc = mappings.quickfix.description;})
|
||||
(mkKeymap "n" keys.locList "<cmd>Trouble toggle loclist<CR>" {desc = mappings.locList.description;})
|
||||
(mkKeymap "n" keys.symbols "<cmd>Trouble toggle symbols<CR>" {desc = mappings.symbols.description;})
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> If you have come across a plugin that has an API that doesn't seem to easily
|
||||
> allow custom keybindings, don't be scared to implement a draft PR. We'll help
|
||||
> you get it done.
|
||||
|
||||
## Adding Plugins {#sec-additional-plugins}
|
||||
|
||||
There are two methods for adding new Neovim plugins to **nvf**. npins is the
|
||||
faster option that should be preferred if the plugin consists of pure Lua or
|
||||
Vimscript code. In which case there is no building required, and we can easily
|
||||
handle the copying of plugin files. Alternative method, which is required when
|
||||
plugins try to build their own libraries (e.g., in Rust or C) that need to be
|
||||
built with Nix to function correctly.
|
||||
|
||||
### With npins {#sec-npins-for-plugins}
|
||||
|
||||
npins is the standard method of adding new plugins to **nvf**. You simply need
|
||||
the repository URL for the plugin, and can add it as a source to be built
|
||||
automatically with one command. To add a new Neovim plugin, use `npins`. For
|
||||
example:
|
||||
|
||||
```bash
|
||||
nix-shell -p npins # or nix shell nixpkgs#npins if using flakes
|
||||
```
|
||||
|
||||
Then run:
|
||||
|
||||
```bash
|
||||
npins add --name <plugin name> github <owner> <repo> -b <branch>
|
||||
```
|
||||
|
||||
::: {.note}
|
||||
|
||||
Be sure to replace any non-alphanumeric characters with `-` for `--name`. For
|
||||
example
|
||||
|
||||
```bash
|
||||
npins add --name lazydev-nvim github folke lazydev.nvim -b main
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
Once the `npins` command is done, you can start referencing the plugin as a
|
||||
**string**.
|
||||
|
||||
```nix
|
||||
{
|
||||
config.vim.startPlugins = ["lazydev-nvim"];
|
||||
}
|
||||
```
|
||||
|
||||
### Packaging Complex Plugins {#sec-pkgs-for-plugins}
|
||||
|
||||
[blink.cmp]: https://github.com/Saghen/blink.cmp
|
||||
|
||||
Some plugins require additional packages to be built and substituted to function
|
||||
correctly. For example [blink.cmp] requires its own fuzzy matcher library, built
|
||||
with Rust, to be installed or else defaults to a much slower Lua implementation.
|
||||
In the Blink documentation, you are advised to build with `cargo` but that is
|
||||
not ideal since we are leveraging the power of Nix. In this case the ideal
|
||||
solution is to write a derivation for the plugin.
|
||||
|
||||
We use `buildRustPackage` to build the library from the repository root, and
|
||||
copy everything in the `postInstall` phase.
|
||||
|
||||
```nix
|
||||
postInstall = ''
|
||||
cp -r {lua,plugin} "$out"
|
||||
|
||||
mkdir -p "$out/doc"
|
||||
cp 'doc/'*'.txt' "$out/doc/"
|
||||
|
||||
mkdir -p "$out/target"
|
||||
mv "$out/lib" "$out/target/release"
|
||||
'';
|
||||
```
|
||||
|
||||
In a similar fashion, you may utilize `stdenv.mkDerivation` and other Nixpkgs
|
||||
builders to build your library from source, and copy the relevant files and Lua
|
||||
plugin files in the `postInstall` phase. Do note, however, that you still need
|
||||
to fetch the plugin sources somehow. npins is, once again, the recommended
|
||||
option to fetch the plugin sources. Refer to the previous section on how to use
|
||||
npins to add a new plugin.
|
||||
|
||||
Plugins built from source must go into the `flake/pkgs/by-name` overlay. It will
|
||||
automatically create flake outputs for individual packages. Lastly, you must add
|
||||
your package to the plugin builder (`pluginBuilders`) function manually in
|
||||
`modules/wrapper/build/config.nix`. Once done, you may refer to your plugin as a
|
||||
**string**.
|
||||
|
||||
```nix
|
||||
{
|
||||
config.vim.startPlugins = ["blink-cmp"];
|
||||
}
|
||||
```
|
||||
|
||||
### Modular setup options {#sec-modular-setup-options}
|
||||
|
||||
Most plugins is initialized with a call to `require('plugin').setup({...})`.
|
||||
|
||||
We use a special function that lets you easily add support for such setup
|
||||
options in a modular way: `mkPluginSetupOption`.
|
||||
|
||||
Once you have added the source of the plugin as shown above, you can define the
|
||||
setup options like this:
|
||||
|
||||
```nix
|
||||
# in modules/.../your-plugin/your-plugin.nix
|
||||
|
||||
{lib, ...}:
|
||||
let
|
||||
inherit (lib.types) bool int;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.your-plugin = {
|
||||
setupOpts = mkPluginSetupOption "plugin name" {
|
||||
enable_feature_a = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
# ...
|
||||
};
|
||||
|
||||
number_option = mkOption {
|
||||
type = int;
|
||||
default = 3;
|
||||
# ...
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
```nix
|
||||
# in modules/.../your-plugin/config.nix
|
||||
{lib, config, ...}:
|
||||
let
|
||||
cfg = config.vim.your-plugin;
|
||||
in {
|
||||
vim.luaConfigRC = lib.nvim.dag.entryAnywhere ''
|
||||
require('plugin-name').setup(${lib.nvim.lua.toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
This above config will result in this Lua script:
|
||||
|
||||
```lua
|
||||
require('plugin-name').setup({
|
||||
enable_feature_a = false,
|
||||
number_option = 3,
|
||||
})
|
||||
```
|
||||
|
||||
Now users can set any of the pre-defined option field, and can also add their
|
||||
own fields!
|
||||
|
||||
```nix
|
||||
# in user's config
|
||||
{
|
||||
vim.your-plugin.setupOpts = {
|
||||
enable_feature_a = true;
|
||||
number_option = 4;
|
||||
another_field = "hello";
|
||||
size = { # nested fields work as well
|
||||
top = 10;
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Details of toLuaObject {#sec-details-of-toluaobject}
|
||||
|
||||
As you've seen above, `toLuaObject` is used to convert our nix attrSet
|
||||
`cfg.setupOpts`, into a lua table. Here are some rules of the conversion:
|
||||
|
||||
1. Nix `null` converts to lua `nil`
|
||||
2. Number and strings convert to their lua counterparts
|
||||
3. Nix attribute sets (`{}`) and lists (`[]`) convert into Lua dictionaries and
|
||||
tables respectively. Here is an example of Nix -> Lua conversion.
|
||||
- `{foo = "bar"}` -> `{["foo"] = "bar"}`
|
||||
- `["foo" "bar"]` -> `{"foo", "bar"}`
|
||||
4. You can write raw Lua code using `lib.generators.mkLuaInline`. This function
|
||||
is part of nixpkgs, and is accessible without relying on **nvf**'s extended
|
||||
library.
|
||||
- `mkLuaInline "function add(a, b) return a + b end"` will yield the
|
||||
following result:
|
||||
|
||||
```nix
|
||||
{
|
||||
_type = "lua-inline";
|
||||
expr = "function add(a, b) return a + b end";
|
||||
}
|
||||
```
|
||||
|
||||
The above expression will be interpreted as a Lua expression in the final
|
||||
config. Without the `mkLuaInline` function, you will only receive a string
|
||||
literal. You can use it to feed plugin configuration tables Lua functions
|
||||
that return specific values as expected by the plugins.
|
||||
|
||||
```nix
|
||||
{
|
||||
vim.your-plugin.setupOpts = {
|
||||
on_init = lib.generators.mkLuaInline ''
|
||||
function()
|
||||
print('we can write lua!')
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Lazy plugins {#sec-lazy-plugins}
|
||||
|
||||
If the plugin can be lazy-loaded, `vim.lazy.plugins` should be used to add it.
|
||||
Lazy plugins are managed by `lz.n`.
|
||||
|
||||
```nix
|
||||
# in modules/.../your-plugin/config.nix
|
||||
{config, ...}: let
|
||||
cfg = config.vim.your-plugin;
|
||||
in {
|
||||
vim.lazy.plugins.your-plugin = {
|
||||
# Instead of vim.startPlugins, use this:
|
||||
package = "your-plugin";
|
||||
|
||||
# ıf your plugin uses the `require('your-plugin').setup{...}` pattern
|
||||
setupModule = "your-plugin";
|
||||
inherit (cfg) setupOpts;
|
||||
|
||||
# Events that trigger this plugin to be loaded
|
||||
event = ["DirChanged"];
|
||||
cmd = ["YourPluginCommand"];
|
||||
|
||||
# Plugin Keymaps
|
||||
keys = [
|
||||
# We'll cover this in detail in the 'keybinds' section
|
||||
{
|
||||
key = "<leader>d";
|
||||
mode = "n";
|
||||
action = ":YourPluginCommand";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
This results in the following lua code:
|
||||
|
||||
```lua
|
||||
require('lz.n').load({
|
||||
{
|
||||
"name-of-your-plugin",
|
||||
after = function()
|
||||
require('your-plugin').setup({
|
||||
--[[ your setupOpts ]]--
|
||||
})
|
||||
end,
|
||||
|
||||
event = {"DirChanged"},
|
||||
cmd = {"YourPluginCommand"},
|
||||
keys = {
|
||||
{"<leader>d", ":YourPluginCommand", mode = {"n"}},
|
||||
},
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
[`vim.lazy.plugins` spec]: ./options.html#option-vim-lazy-plugins
|
||||
|
||||
A full list of options can be found in the [`vim.lazy.plugins` spec] on the
|
||||
rendered manual.
|
||||
|
|
|
|||
|
|
@ -1,266 +0,0 @@
|
|||
# Adding Plugins {#sec-additional-plugins}
|
||||
|
||||
There are two methods for adding new Neovim plugins to **nvf**. npins is the
|
||||
faster option that should be preferred if the plugin consists of pure Lua or
|
||||
Vimscript code. In which case there is no building required, and we can easily
|
||||
handle the copying of plugin files. Alternative method, which is required when
|
||||
plugins try to build their own libraries (e.g., in Rust or C) that need to be
|
||||
built with Nix to function correctly.
|
||||
|
||||
## With npins {#sec-npins-for-plugins}
|
||||
|
||||
npins is the standard method of adding new plugins to **nvf**. You simply need
|
||||
the repository URL for the plugin, and can add it as a source to be built
|
||||
automatically with one command. To add a new Neovim plugin, use `npins`. For
|
||||
example:
|
||||
|
||||
```bash
|
||||
nix-shell -p npins # or nix shell nixpkgs#npins if using flakes
|
||||
```
|
||||
|
||||
Then run:
|
||||
|
||||
```bash
|
||||
npins add --name <plugin name> github <owner> <repo> -b <branch>
|
||||
```
|
||||
|
||||
::: {.note}
|
||||
|
||||
Be sure to replace any non-alphanumeric characters with `-` for `--name`. For
|
||||
example
|
||||
|
||||
```bash
|
||||
npins add --name lazydev-nvim github folke lazydev.nvim -b main
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
Once the `npins` command is done, you can start referencing the plugin as a
|
||||
**string**.
|
||||
|
||||
```nix
|
||||
{
|
||||
config.vim.startPlugins = ["lazydev-nvim"];
|
||||
}
|
||||
```
|
||||
|
||||
## Packaging Complex Plugins {#sec-pkgs-for-plugins}
|
||||
|
||||
[blink.cmp]: https://github.com/Saghen/blink.cmp
|
||||
|
||||
Some plugins require additional packages to be built and substituted to function
|
||||
correctly. For example [blink.cmp] requires its own fuzzy matcher library, built
|
||||
with Rust, to be installed or else defaults to a much slower Lua implementation.
|
||||
In the Blink documentation, you are advised to build with `cargo` but that is
|
||||
not ideal since we are leveraging the power of Nix. In this case the ideal
|
||||
solution is to write a derivation for the plugin.
|
||||
|
||||
We use `buildRustPackage` to build the library from the repository root, and
|
||||
copy everything in the `postInstall` phase.
|
||||
|
||||
```nix
|
||||
postInstall = ''
|
||||
cp -r {lua,plugin} "$out"
|
||||
|
||||
mkdir -p "$out/doc"
|
||||
cp 'doc/'*'.txt' "$out/doc/"
|
||||
|
||||
mkdir -p "$out/target"
|
||||
mv "$out/lib" "$out/target/release"
|
||||
'';
|
||||
```
|
||||
|
||||
In a similar fashion, you may utilize `stdenv.mkDerivation` and other Nixpkgs
|
||||
builders to build your library from source, and copy the relevant files and Lua
|
||||
plugin files in the `postInstall` phase. Do note, however, that you still need
|
||||
to fetch the plugin sources somehow. npins is, once again, the recommended
|
||||
option to fetch the plugin sources. Refer to the previous section on how to use
|
||||
npins to add a new plugin.
|
||||
|
||||
Plugins built from source must go into the `flake/pkgs/by-name` overlay. It will
|
||||
automatically create flake outputs for individual packages. Lastly, you must add
|
||||
your package to the plugin builder (`pluginBuilders`) function manually in
|
||||
`modules/wrapper/build/config.nix`. Once done, you may refer to your plugin as a
|
||||
**string**.
|
||||
|
||||
```nix
|
||||
{
|
||||
config.vim.startPlugins = ["blink-cmp"];
|
||||
}
|
||||
```
|
||||
|
||||
## Modular setup options {#sec-modular-setup-options}
|
||||
|
||||
Most plugins is initialized with a call to `require('plugin').setup({...})`.
|
||||
|
||||
We use a special function that lets you easily add support for such setup
|
||||
options in a modular way: `mkPluginSetupOption`.
|
||||
|
||||
Once you have added the source of the plugin as shown above, you can define the
|
||||
setup options like this:
|
||||
|
||||
```nix
|
||||
# in modules/.../your-plugin/your-plugin.nix
|
||||
|
||||
{lib, ...}:
|
||||
let
|
||||
inherit (lib.types) bool int;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.your-plugin = {
|
||||
setupOpts = mkPluginSetupOption "plugin name" {
|
||||
enable_feature_a = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
# ...
|
||||
};
|
||||
|
||||
number_option = mkOption {
|
||||
type = int;
|
||||
default = 3;
|
||||
# ...
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
```nix
|
||||
# in modules/.../your-plugin/config.nix
|
||||
{lib, config, ...}:
|
||||
let
|
||||
cfg = config.vim.your-plugin;
|
||||
in {
|
||||
vim.luaConfigRC = lib.nvim.dag.entryAnywhere ''
|
||||
require('plugin-name').setup(${lib.nvim.lua.toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
This above config will result in this Lua script:
|
||||
|
||||
```lua
|
||||
require('plugin-name').setup({
|
||||
enable_feature_a = false,
|
||||
number_option = 3,
|
||||
})
|
||||
```
|
||||
|
||||
Now users can set any of the pre-defined option field, and can also add their
|
||||
own fields!
|
||||
|
||||
```nix
|
||||
# in user's config
|
||||
{
|
||||
vim.your-plugin.setupOpts = {
|
||||
enable_feature_a = true;
|
||||
number_option = 4;
|
||||
another_field = "hello";
|
||||
size = { # nested fields work as well
|
||||
top = 10;
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Details of toLuaObject {#sec-details-of-toluaobject}
|
||||
|
||||
As you've seen above, `toLuaObject` is used to convert our nix attrSet
|
||||
`cfg.setupOpts`, into a lua table. Here are some rules of the conversion:
|
||||
|
||||
1. Nix `null` converts to lua `nil`
|
||||
2. Number and strings convert to their lua counterparts
|
||||
3. Nix attribute sets (`{}`) and lists (`[]`) convert into Lua dictionaries and
|
||||
tables respectively. Here is an example of Nix -> Lua conversion.
|
||||
- `{foo = "bar"}` -> `{["foo"] = "bar"}`
|
||||
- `["foo" "bar"]` -> `{"foo", "bar"}`
|
||||
4. You can write raw Lua code using `lib.generators.mkLuaInline`. This function
|
||||
is part of nixpkgs, and is accessible without relying on **nvf**'s extended
|
||||
library.
|
||||
- `mkLuaInline "function add(a, b) return a + b end"` will yield the
|
||||
following result:
|
||||
|
||||
```nix
|
||||
{
|
||||
_type = "lua-inline";
|
||||
expr = "function add(a, b) return a + b end";
|
||||
}
|
||||
```
|
||||
|
||||
The above expression will be interpreted as a Lua expression in the final
|
||||
config. Without the `mkLuaInline` function, you will only receive a string
|
||||
literal. You can use it to feed plugin configuration tables Lua functions
|
||||
that return specific values as expected by the plugins.
|
||||
|
||||
```nix
|
||||
{
|
||||
vim.your-plugin.setupOpts = {
|
||||
on_init = lib.generators.mkLuaInline ''
|
||||
function()
|
||||
print('we can write lua!')
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Lazy plugins {#sec-lazy-plugins}
|
||||
|
||||
If the plugin can be lazy-loaded, `vim.lazy.plugins` should be used to add it.
|
||||
Lazy plugins are managed by `lz.n`.
|
||||
|
||||
```nix
|
||||
# in modules/.../your-plugin/config.nix
|
||||
{config, ...}: let
|
||||
cfg = config.vim.your-plugin;
|
||||
in {
|
||||
vim.lazy.plugins.your-plugin = {
|
||||
# Instead of vim.startPlugins, use this:
|
||||
package = "your-plugin";
|
||||
|
||||
# ıf your plugin uses the `require('your-plugin').setup{...}` pattern
|
||||
setupModule = "your-plugin";
|
||||
inherit (cfg) setupOpts;
|
||||
|
||||
# Events that trigger this plugin to be loaded
|
||||
event = ["DirChanged"];
|
||||
cmd = ["YourPluginCommand"];
|
||||
|
||||
# Plugin Keymaps
|
||||
keys = [
|
||||
# We'll cover this in detail in the 'keybinds' section
|
||||
{
|
||||
key = "<leader>d";
|
||||
mode = "n";
|
||||
action = ":YourPluginCommand";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
This results in the following lua code:
|
||||
|
||||
```lua
|
||||
require('lz.n').load({
|
||||
{
|
||||
"name-of-your-plugin",
|
||||
after = function()
|
||||
require('your-plugin').setup({
|
||||
--[[ your setupOpts ]]--
|
||||
})
|
||||
end,
|
||||
|
||||
event = {"DirChanged"},
|
||||
cmd = {"YourPluginCommand"},
|
||||
keys = {
|
||||
{"<leader>d", ":YourPluginCommand", mode = {"n"}},
|
||||
},
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
[`vim.lazy.plugins` spec]: https://notashelf.github.io/nvf/options.html#opt-vim.lazy.plugins
|
||||
|
||||
A full list of options can be found in the [`vim.lazy.plugins` spec] on the
|
||||
rendered manual.
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
# Getting Started {#sec-contrib-getting-started}
|
||||
|
||||
You, naturally, would like to start by forking the repository to get started. If
|
||||
you are new to Git and GitHub, do have a look at GitHub's
|
||||
[Fork a repo guide](https://help.github.com/articles/fork-a-repo/) for
|
||||
instructions on how you can do this. Once you have a fork of **nvf**, you should
|
||||
create a separate branch based on the most recent `main` branch. Give your
|
||||
branch a reasonably descriptive name (e.g. `feature/debugger` or
|
||||
`fix/pesky-bug`) and you are ready to work on your changes
|
||||
|
||||
Implement your changes and commit them to the newly created branch and when you
|
||||
are happy with the result, and positive that it fulfills our
|
||||
[Contributing Guidelines](#sec-guidelines), push the branch to GitHub and
|
||||
[create a pull request](https://help.github.com/articles/creating-a-pull-request).
|
||||
The default pull request template available on the **nvf** repository will guide
|
||||
you through the rest of the process, and we'll gently nudge you in the correct
|
||||
direction if there are any mistakes.
|
||||
|
|
@ -1,188 +0,0 @@
|
|||
# Guidelines {#sec-guidelines}
|
||||
|
||||
If your contribution tightly follows the guidelines, then there is a good chance
|
||||
it will be merged without too much trouble. Some of the guidelines will be
|
||||
strictly enforced, others will remain as gentle nudges towards the correct
|
||||
direction. As we have no automated system enforcing those guidelines, please try
|
||||
to double check your changes before making your pull request in order to avoid
|
||||
"faulty" code slipping by.
|
||||
|
||||
If you are uncertain how these rules affect the change you would like to make
|
||||
then feel free to start a discussion in the
|
||||
[discussions tab](https://github.com/NotAShelf/nvf/discussions) ideally (but not
|
||||
necessarily) before you start developing.
|
||||
|
||||
## Adding Documentation {#sec-guidelines-documentation}
|
||||
|
||||
[Nixpkgs Flavoured Markdown]: https://github.com/NixOS/nixpkgs/blob/master/doc/README.md#syntax
|
||||
|
||||
Almost all changes warrant updates to the documentation: at the very least, you
|
||||
must update the changelog. Both the manual and module options use
|
||||
[Nixpkgs Flavoured Markdown].
|
||||
|
||||
The HTML version of this manual containing both the module option descriptions
|
||||
and the documentation of **nvf** (such as this page) can be generated and opened
|
||||
by typing the following in a shell within a clone of the **nvf** Git repository:
|
||||
|
||||
```console
|
||||
$ nix build .#docs-html
|
||||
$ xdg-open $PWD/result/share/doc/nvf/index.html
|
||||
```
|
||||
|
||||
## Formatting Code {#sec-guidelines-formatting}
|
||||
|
||||
Make sure your code is formatted as described in
|
||||
[code-style section](#sec-guidelines-code-style). To maintain consistency
|
||||
throughout the project you are encouraged to browse through existing code and
|
||||
adopt its style also in new code.
|
||||
|
||||
## Formatting Commits {#sec-guidelines-commit-message-style}
|
||||
|
||||
Similar to [code style guidelines](#sec-guidelines-code-style) we encourage a
|
||||
consistent commit message format as described in
|
||||
[commit style guidelines](#sec-guidelines-commit-style).
|
||||
|
||||
## Commit Style {#sec-guidelines-commit-style}
|
||||
|
||||
The commits in your pull request should be reasonably self-contained. Which
|
||||
means each and every commit in a pull request should make sense both on its own
|
||||
and in general context. That is, a second commit should not resolve an issue
|
||||
that is introduced in an earlier commit. In particular, you will be asked to
|
||||
amend any commit that introduces syntax errors or similar problems even if they
|
||||
are fixed in a later commit.
|
||||
|
||||
The commit messages should follow the
|
||||
[seven rules](https://chris.beams.io/posts/git-commit/#seven-rule), except for
|
||||
"Capitalize the subject line". We also ask you to include the affected code
|
||||
component or module in the first line. A commit message ideally, but not
|
||||
necessarily, follow the given template from home-manager's own documentation
|
||||
|
||||
```
|
||||
{component}: {description}
|
||||
|
||||
{long description}
|
||||
```
|
||||
|
||||
where `{component}` refers to the code component (or module) your change
|
||||
affects, `{description}` is a very brief description of your change, and
|
||||
`{long description}` is an optional clarifying description. As a rare exception,
|
||||
if there is no clear component, or your change affects many components, then the
|
||||
`{component}` part is optional. See
|
||||
[example commit message](#sec-guidelines-ex-commit-message) for a commit message
|
||||
that fulfills these requirements.
|
||||
|
||||
## Example Commit {#sec-guidelines-ex-commit-message}
|
||||
|
||||
The commit
|
||||
[69f8e47e9e74c8d3d060ca22e18246b7f7d988ef](https://github.com/nix-community/home-manager/commit/69f8e47e9e74c8d3d060ca22e18246b7f7d988ef)
|
||||
in home-manager contains the following commit message.
|
||||
|
||||
```
|
||||
starship: allow running in Emacs if vterm is used
|
||||
|
||||
The vterm buffer is backed by libvterm and can handle Starship prompts
|
||||
without issues.
|
||||
```
|
||||
|
||||
Similarly, if you are contributing to **nvf**, you would include the scope of
|
||||
the commit followed by the description:
|
||||
|
||||
```
|
||||
languages/ruby: init module
|
||||
|
||||
Adds a language module for Ruby, adds appropriate formatters and Treesitter grammars
|
||||
```
|
||||
|
||||
Long description can be omitted if the change is too simple to warrant it. A
|
||||
minor fix in spelling or a formatting change does not warrant long description,
|
||||
however, a module addition or removal does as you would like to provide the
|
||||
relevant context, i.e. the reasoning behind it, for your commit.
|
||||
|
||||
Finally, when adding a new module, say `modules/foo.nix`, we use the fixed
|
||||
commit format `foo: add module`. You can, of course, still include a long
|
||||
description if you wish.
|
||||
|
||||
In case of nested modules, i.e `modules/languages/java.nix` you are recommended
|
||||
to contain the parent as well - for example `languages/java: some major change`.
|
||||
|
||||
## Code Style {#sec-guidelines-code-style}
|
||||
|
||||
### Treewide {#sec-code-style-treewide}
|
||||
|
||||
Keep lines at a reasonable width, ideally 80 characters or less. This also
|
||||
applies to string literals and module descriptions and documentation.
|
||||
|
||||
### Nix {#sec-code-style-nix}
|
||||
|
||||
[alejandra]: https://github.com/kamadorueda/alejandra
|
||||
|
||||
**nvf** is formatted by the [alejandra] tool and the formatting is checked in
|
||||
the pull request and push workflows. Run the `nix fmt` command inside the
|
||||
project repository before submitting your pull request.
|
||||
|
||||
While Alejandra is mostly opinionated on how code looks after formatting,
|
||||
certain changes are done at the user's discretion based on how the original code
|
||||
was structured.
|
||||
|
||||
Please use one line code for attribute sets that contain only one subset. For
|
||||
example:
|
||||
|
||||
```nix
|
||||
# parent modules should always be unfolded
|
||||
# which means module = { value = ... } instead of module.value = { ... }
|
||||
module = {
|
||||
value = mkEnableOption "some description" // { default = true; }; # merges can be done inline where possible
|
||||
|
||||
# same as parent modules, unfold submodules
|
||||
subModule = {
|
||||
# this is an option that contains more than one nested value
|
||||
# Note: try to be careful about the ordering of `mkOption` arguments.
|
||||
# General rule of thumb is to order from least to most likely to change.
|
||||
# This is, for most cases, type < default < description.
|
||||
# Example, if present, would be between default and description
|
||||
someOtherValue = mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Some other description";
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
If you move a line down after the merge operator, Alejandra will automatically
|
||||
unfold the whole merged attrset for you, which we **do not** want.
|
||||
|
||||
```nix
|
||||
module = {
|
||||
key = mkEnableOption "some description" // {
|
||||
default = true; # we want this to be inline
|
||||
}; # ...
|
||||
}
|
||||
```
|
||||
|
||||
For lists, it is mostly up to your own discretion how you want to format them,
|
||||
but please try to unfold lists if they contain multiple items and especially if
|
||||
they are to include comments.
|
||||
|
||||
```nix
|
||||
# this is ok
|
||||
acceptableList = [
|
||||
item1 # comment
|
||||
item2
|
||||
item3 # some other comment
|
||||
item4
|
||||
];
|
||||
|
||||
# this is not ok
|
||||
listToBeAvoided = [item1 item2 /* comment */ item3 item4];
|
||||
|
||||
# this is ok
|
||||
acceptableList = [item1 item2];
|
||||
|
||||
# this is also ok if the list is expected to contain more elements
|
||||
acceptableList= [
|
||||
item1
|
||||
item2
|
||||
# more items if needed...
|
||||
];
|
||||
```
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
# Keybinds {#sec-keybinds}
|
||||
|
||||
As of 0.4, there exists an API for writing your own keybinds and a couple of
|
||||
useful utility functions are available in the
|
||||
[extended standard library](https://github.com/NotAShelf/nvf/tree/main/lib). The
|
||||
following section contains a general overview to how you may utilize said
|
||||
functions.
|
||||
|
||||
## Custom Key Mappings Support for a Plugin {#sec-custom-key-mappings}
|
||||
|
||||
To set a mapping, you should define it in `vim.keymaps`.
|
||||
|
||||
An example, simple keybinding, can look like this:
|
||||
|
||||
```nix
|
||||
{
|
||||
vim.keymaps = [
|
||||
{
|
||||
key = "<leader>wq";
|
||||
mode = ["n"];
|
||||
action = ":wq<CR>";
|
||||
silent = true;
|
||||
desc = "Save file and quit";
|
||||
}
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
There are many settings available in the options. Please refer to the
|
||||
[documentation](https://notashelf.github.io/nvf/options.html#opt-vim.keymaps) to
|
||||
see a list of them.
|
||||
|
||||
**nvf** provides a helper function, so that you don't have to write the mapping
|
||||
attribute sets every time:
|
||||
|
||||
- `mkKeymap`, which mimics neovim's `vim.keymap.set` function
|
||||
|
||||
You can read the source code of some modules to see them in action, but the
|
||||
usage should look something like this:
|
||||
|
||||
```nix
|
||||
# plugindefinition.nix
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options.vim.plugin = {
|
||||
enable = mkEnableOption "Enable plugin";
|
||||
|
||||
# Mappings should always be inside an attrset called mappings
|
||||
mappings = {
|
||||
workspaceDiagnostics = mkMappingOption "Workspace diagnostics [trouble]" "<leader>lwd";
|
||||
documentDiagnostics = mkMappingOption "Document diagnostics [trouble]" "<leader>ld";
|
||||
lspReferences = mkMappingOption "LSP References [trouble]" "<leader>lr";
|
||||
quickfix = mkMappingOption "QuickFix [trouble]" "<leader>xq";
|
||||
locList = mkMappingOption "LOCList [trouble]" "<leader>xl";
|
||||
symbols = mkMappingOption "Symbols [trouble]" "<leader>xs";
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
```nix
|
||||
# config.nix
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) mkKeymap;
|
||||
|
||||
cfg = config.vim.plugin;
|
||||
|
||||
keys = cfg.mappings;
|
||||
inherit (options.vim.lsp.trouble) mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.keymaps = [
|
||||
(mkKeymap "n" keys.workspaceDiagnostics "<cmd>Trouble toggle diagnostics<CR>" {desc = mappings.workspaceDiagnostics.description;})
|
||||
(mkKeymap "n" keys.documentDiagnostics "<cmd>Trouble toggle diagnostics filter.buf=0<CR>" {desc = mappings.documentDiagnostics.description;})
|
||||
(mkKeymap "n" keys.lspReferences "<cmd>Trouble toggle lsp_references<CR>" {desc = mappings.lspReferences.description;})
|
||||
(mkKeymap "n" keys.quickfix "<cmd>Trouble toggle quickfix<CR>" {desc = mappings.quickfix.description;})
|
||||
(mkKeymap "n" keys.locList "<cmd>Trouble toggle loclist<CR>" {desc = mappings.locList.description;})
|
||||
(mkKeymap "n" keys.symbols "<cmd>Trouble toggle symbols<CR>" {desc = mappings.symbols.description;})
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
::: {.note}
|
||||
|
||||
If you have come across a plugin that has an API that doesn't seem to easily
|
||||
allow custom keybindings, don't be scared to implement a draft PR. We'll help
|
||||
you get it done.
|
||||
|
||||
:::
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
# Testing Changes {#sec-testing-changes}
|
||||
|
||||
Once you have made your changes, you will need to test them thoroughly. If it is
|
||||
a module, add your module option to `configuration.nix` (located in the root of
|
||||
this project) inside `neovimConfiguration`. Enable it, and then run the maximal
|
||||
configuration with `nix run .#maximal -Lv` to check for build errors. If neovim
|
||||
opens in the current directory without any error messages (you can check the
|
||||
output of `:messages` inside neovim to see if there are any errors), then your
|
||||
changes are good to go. Open your pull request, and it will be reviewed as soon
|
||||
as possible.
|
||||
|
||||
If it is not a new module, but a change to an existing one, then make sure the
|
||||
module you have changed is enabled in the maximal configuration by editing
|
||||
`configuration.nix`, and then run it with `nix run .#maximal -Lv`. Same
|
||||
procedure as adding a new module will apply here.
|
||||
|
|
@ -1,4 +1,18 @@
|
|||
# Try it out {#ch-try-it-out}
|
||||
# Introduction {#nvf-manual}
|
||||
|
||||
Version @NVF_VERSION@
|
||||
|
||||
## Preface {#ch-preface}
|
||||
|
||||
### What is nvf {#sec-what-is-it}
|
||||
|
||||
**nvf** is a highly modular, configurable, extensible and easy to use Neovim
|
||||
configuration framework built and designed to be used with Nix. Boasting
|
||||
flexibility, robustness and ease of use, this projecct allows you to configure a
|
||||
fully featured Neovim instance with a few lines of Nix with lots of options for
|
||||
advanced users as well.
|
||||
|
||||
## Try it out {#ch-try-it-out}
|
||||
|
||||
Thanks to the portability of Nix, you can try out nvf without actually
|
||||
installing it to your machine. Below are the commands you may run to try out
|
||||
|
|
@ -29,10 +43,11 @@ $ nix run github:notashelf/nvf#maximal
|
|||
|
||||
### Available Configurations {#sec-available-configs}
|
||||
|
||||
::: {.info}
|
||||
|
||||
The below configurations are provided for demonstration purposes, and are
|
||||
**not** designed to be installed as is. You may
|
||||
> [!NOTE]
|
||||
> The below configurations are provided for demonstration purposes, and are
|
||||
> **not** designed to be installed as is. You may refer to the installation
|
||||
> steps below and the helpful tips section for details on creating your own
|
||||
> configurations.
|
||||
|
||||
#### Nix {#sec-configs-nix}
|
||||
|
||||
|
|
@ -42,6 +57,7 @@ default package, you will build Neovim with this config.
|
|||
|
||||
```bash
|
||||
$ nix run github:notashelf/nvf#nix test.nix
|
||||
# => This will open a file called `test.nix` with Nix LSP and syntax highlighting
|
||||
```
|
||||
|
||||
This command will start Neovim with some opinionated plugin configurations, and
|
||||
|
|
@ -57,16 +73,29 @@ mind, however, that this will pull a lot of dependencies.
|
|||
|
||||
```bash
|
||||
$ nix run github:notashelf/nvf#maximal -- test.nix
|
||||
# => This will open a file called `test.nix` with a variety of plugins available
|
||||
```
|
||||
|
||||
It uses the same configuration template with the [Nix](#sec-configs-nix)
|
||||
configuration, but supports many more languages, and enables more utility,
|
||||
companion or fun plugins.
|
||||
|
||||
::: {.warning}
|
||||
> [!WARNING]
|
||||
> Running the maximal config will download _a lot_ of packages as it is
|
||||
> downloading language servers, formatters, and more. If CPU time and bandwidth
|
||||
> are concerns, please use the default package instead.
|
||||
|
||||
Running the maximal config will download _a lot_ of packages as it is
|
||||
downloading language servers, formatters, and more. If CPU time and bandwidth
|
||||
are concerns, please use the default package instead.
|
||||
## Installing nvf {#ch-installation}
|
||||
|
||||
:::
|
||||
[module installation section]: #ch-module-installation
|
||||
|
||||
There are multiple ways of installing nvf on your system. You may either choose
|
||||
the standalone installation method, which does not depend on a module system and
|
||||
may be done on any system that has the Nix package manager or the appropriate
|
||||
modules for NixOS and home-manager as described in the
|
||||
[module installation section].
|
||||
|
||||
```{=include=}
|
||||
installation/custom-configuration.md
|
||||
installation/modules.md
|
||||
```
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
# Installing nvf {#ch-installation}
|
||||
|
||||
[module installation section]: #ch-module-installation
|
||||
|
||||
There are multiple ways of installing nvf on your system. You may either choose
|
||||
the standalone installation method, which does not depend on a module system and
|
||||
may be done on any system that has the Nix package manager or the appropriate
|
||||
modules for NixOS and home-manager as described in the
|
||||
[module installation section].
|
||||
|
||||
```{=include=} chapters
|
||||
installation/custom-configuration.md
|
||||
installation/modules.md
|
||||
```
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
# nvf manual {#nvf-manual}
|
||||
|
||||
## Version @NVF_VERSION@
|
||||
|
||||
```{=include=} preface
|
||||
preface.md
|
||||
try-it-out.md
|
||||
```
|
||||
|
||||
```{=include=} parts
|
||||
installation.md
|
||||
configuring.md
|
||||
tips.md
|
||||
```
|
||||
|
||||
```{=include=} chapters
|
||||
hacking.md
|
||||
```
|
||||
|
||||
```{=include=} appendix html:into-file=//quirks.html
|
||||
quirks.md
|
||||
```
|
||||
|
||||
```{=include=} appendix html:into-file=//options.html
|
||||
options.md
|
||||
```
|
||||
|
||||
```{=include=} appendix html:into-file=//release-notes.html
|
||||
release-notes/release-notes.md
|
||||
```
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
# nvf Configuration Options {#ch-options}
|
||||
|
||||
Below are the module options provided by nvf, in no particular order. Most
|
||||
options will include useful comments, warnings or setup tips on how a module
|
||||
option is meant to be used as well as examples in complex cases.
|
||||
|
||||
An offline version of this page is bundled with nvf as a part of the manpages
|
||||
which you can access with `man 5 nvf`. Please let us know if you believe any of
|
||||
the options below are missing useful examples.
|
||||
|
||||
<!--
|
||||
In the manual, individual options may be referenced in Hyperlinks as follows:
|
||||
[](#opt-vim.*) If changing the prefix here, do keep in mind the #opt- suffix will have
|
||||
to be changed everywhere.
|
||||
-->
|
||||
|
||||
```{=include=} options
|
||||
id-prefix: opt-
|
||||
list-id: nvf-options
|
||||
source: @OPTIONS_JSON@
|
||||
```
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
# Preface {#ch-preface}
|
||||
|
||||
## What is nvf {#sec-what-is-it}
|
||||
|
||||
nvf is a highly modular, configurable, extensible and easy to use Neovim
|
||||
configuration in Nix. Designed for flexibility and ease of use, nvf allows you
|
||||
to easily configure your fully featured Neovim instance with a few lines of Nix.
|
||||
|
||||
## Bugs & Suggestions {#sec-bugs-suggestions}
|
||||
|
||||
[issue tracker]: https://github.com/notashelf/nvf/issues
|
||||
[discussions tab]: https://github.com/notashelf/nvf/discussions
|
||||
[pull requests tab]: https://github.com/notashelf/nvf/pulls
|
||||
|
||||
If you notice any issues with nvf, or this documentation, then please consider
|
||||
reporting them over at the [issue tracker]. Issues tab, in addition to the
|
||||
[discussions tab] is a good place as any to request new features.
|
||||
|
||||
You may also consider submitting bugfixes, feature additions and upstreamed
|
||||
changes that you think are critical over at the [pull requests tab].
|
||||
|
|
@ -5,9 +5,41 @@ be it a result of generating Lua from Nix, or the state of packaging. This page,
|
|||
in turn, will list any known modules or plugins that are known to misbehave, and
|
||||
possible workarounds that you may apply.
|
||||
|
||||
<!-- If adding a new known quirk, please create a new page in quirks/ and include
|
||||
the name of the file here.-->
|
||||
## NodeJS {#ch-quirks-nodejs}
|
||||
|
||||
```{=include=} chapters
|
||||
quirks/nodejs.md
|
||||
```
|
||||
### eslint-plugin-prettier {#sec-eslint-plugin-prettier}
|
||||
|
||||
When working with NodeJS, everything works as expected, but some projects have
|
||||
settings that can fool nvf.
|
||||
|
||||
If [this plugin](https://github.com/prettier/eslint-plugin-prettier) or similar
|
||||
is included, you might get a situation where your eslint configuration diagnoses
|
||||
your formatting according to its own config (usually `.eslintrc.js`).
|
||||
|
||||
The issue there is your formatting is made via prettierd.
|
||||
|
||||
This results in auto-formatting relying on your prettier config, while your
|
||||
eslint config diagnoses formatting
|
||||
[which it's not supposed to](https://prettier.io/docs/en/comparison.html))
|
||||
|
||||
In the end, you get discrepancies between what your editor does and what it
|
||||
wants.
|
||||
|
||||
Solutions are:
|
||||
|
||||
1. Don't add a formatting config to eslint, and separate prettier and eslint.
|
||||
2. PR this repo to add an ESLint formatter and configure nvf to use it.
|
||||
|
||||
## Bugs & Suggestions {#ch-bugs-suggestions}
|
||||
|
||||
[issue tracker]: https://github.com/notashelf/nvf/issues
|
||||
[discussions tab]: https://github.com/notashelf/nvf/discussions
|
||||
[pull requests tab]: https://github.com/notashelf/nvf/pulls
|
||||
|
||||
Some quirks are not exactly quirks, but bugs in the module systeme. If you
|
||||
notice any issues with nvf, or this documentation, then please consider
|
||||
reporting them over at the [issue tracker]. Issues tab, in addition to the
|
||||
[discussions tab] is a good place as any to request new features.
|
||||
|
||||
You may also consider submitting bugfixes, feature additions and upstreamed
|
||||
changes that you think are critical over at the [pull requests tab].
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
# NodeJS {#ch-quirks-nodejs}
|
||||
|
||||
## eslint-plugin-prettier {#sec-eslint-plugin-prettier}
|
||||
|
||||
When working with NodeJS, everything works as expected, but some projects have
|
||||
settings that can fool nvf.
|
||||
|
||||
If [this plugin](https://github.com/prettier/eslint-plugin-prettier) or similar
|
||||
is included, you might get a situation where your eslint configuration diagnoses
|
||||
your formatting according to its own config (usually `.eslintrc.js`).
|
||||
|
||||
The issue there is your formatting is made via prettierd.
|
||||
|
||||
This results in auto-formatting relying on your prettier config, while your
|
||||
eslint config diagnoses formatting
|
||||
[which it's not supposed to](https://prettier.io/docs/en/comparison.html))
|
||||
|
||||
In the end, you get discrepancies between what your editor does and what it
|
||||
wants.
|
||||
|
||||
Solutions are:
|
||||
|
||||
1. Don't add a formatting config to eslint, and separate prettier and eslint.
|
||||
2. PR this repo to add an ESLint formatter and configure nvf to use it.
|
||||
15
docs/manual/release-notes.md
Normal file
15
docs/manual/release-notes.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Release Notes {#ch-release-notes}
|
||||
|
||||
This section lists the release notes for tagged version of **nvf** and the
|
||||
current main current main branch
|
||||
|
||||
```{=include=} chapters
|
||||
release-notes/rl-0.1.md
|
||||
release-notes/rl-0.2.md
|
||||
release-notes/rl-0.3.md
|
||||
release-notes/rl-0.4.md
|
||||
release-notes/rl-0.5.md
|
||||
release-notes/rl-0.6.md
|
||||
release-notes/rl-0.7.md
|
||||
release-notes/rl-0.8.md
|
||||
```
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# Release 0.1 {#sec-release-0.1}
|
||||
# Release 0.1 {#sec-release-0-1}
|
||||
|
||||
This is the current master branch and information here is not final. These are
|
||||
changes from the v0.1 tag.
|
||||
|
|
@ -7,7 +7,7 @@ Special thanks to [home-manager](https://github.com/nix-community/home-manager/)
|
|||
for this release. Docs/manual generation, the new module evaluation system, and
|
||||
DAG implementation are from them.
|
||||
|
||||
## Changelog {#sec-release-0.1-changelog}
|
||||
## Changelog {#sec-release-0-1-changelog}
|
||||
|
||||
[jordanisaacs](https://github.com/jordanisaacs):
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ DAG implementation are from them.
|
|||
longer defined. If you use hare and would like it added back, please file an
|
||||
issue.
|
||||
|
||||
- [](#opt-vim.startPlugins) & [](#opt-vim.optPlugins) are now an enum of
|
||||
- {option}`vim.startPlugins` & {option} `vim-optPlugins` are now an enum of
|
||||
`string` for options sourced from the flake inputs. Users can still provide
|
||||
vim plugin packages.
|
||||
|
||||
|
|
@ -28,13 +28,13 @@ DAG implementation are from them.
|
|||
[relevant discourse post]: https://discourse.nixos.org/t/psa-if-you-are-on-unstable-try-out-nvim-treesitter-withallgrammars/23321?u=snowytrees
|
||||
|
||||
- Treesitter grammars are now configurable with
|
||||
[](#opt-vim.treesitter.grammars). Utilizes the nixpkgs `nvim-treesitter`
|
||||
{option}`vim.treesitter.grammars`. Utilizes the nixpkgs `nvim-treesitter`
|
||||
plugin rather than a custom input in order to take advantage of build support
|
||||
of pinned versions. See the [relevant discourse post] for more information.
|
||||
Packages can be found under the `vimPlugins.nvim-treesitter.builtGrammars`
|
||||
namespace.
|
||||
|
||||
- `vim.configRC` and [](#opt-vim.luaConfigRC) are now of type DAG lines. This
|
||||
- `vim.configRC` and {option}`vim.luaConfigRC` are now of type DAG lines. This
|
||||
allows for ordering of the config. Usage is the same is in home-manager's
|
||||
`home.activation` option.
|
||||
|
||||
|
|
@ -44,5 +44,6 @@ vim.luaConfigRC = lib.nvim.dag.entryAnywhere "config here"
|
|||
|
||||
[MoritzBoehme](https://github.com/MoritzBoehme):
|
||||
|
||||
- `catppuccin` theme is now available as a neovim theme [](#opt-vim.theme.style)
|
||||
and Lualine theme [](#opt-vim.statusline.lualine.theme).
|
||||
- `catppuccin` theme is now available as a neovim theme
|
||||
{option}`vim.theme.style` and Lualine theme
|
||||
{option}`vim.statusline.lualine.theme`.
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
# Release 0.2 {#sec-release-0.2}
|
||||
# Release 0.2 {#sec-release-0-2}
|
||||
|
||||
Release notes for release 0.2
|
||||
|
||||
## Changelog {#sec-release-0.2-changelog}
|
||||
## Changelog {#sec-release-0-2-changelog}
|
||||
|
||||
[notashelf](https://github.com/notashelf):
|
||||
|
||||
|
|
@ -10,55 +10,39 @@ Release notes for release 0.2
|
|||
default, while `minimap.vim` is available with its code-minimap dependency.
|
||||
- A complementary plugin, `obsidian.nvim` and the Neovim alternative for Emacs'
|
||||
orgmode with `orgmode.nvim` have been added. Both will be disabled by default.
|
||||
|
||||
- Smooth scrolling for ANY movement command is now available with
|
||||
`cinnamon.nvim`
|
||||
|
||||
- You will now notice a dashboard on startup. This is provided by the
|
||||
`alpha.nvim` plugin. You can use any of the three available dashboard plugins,
|
||||
or disable them entirely.
|
||||
|
||||
- There is now a scrollbar on active buffers, which can highlight errors by
|
||||
hooking to your LSPs. This is on by default, but can be toggled off under
|
||||
`vim.visuals` if seen necessary.
|
||||
|
||||
- Discord Rich Presence has been added through `presence.nvim` for those who
|
||||
want to flex that they are using the _superior_ text editor.
|
||||
|
||||
- An icon picker is now available with telescope integration. You can use
|
||||
`:IconPickerInsert` or `:IconPickerYank` to add icons to your code.
|
||||
|
||||
- A general-purpose cheatsheet has been added through `cheatsheet.nvim`. Forget
|
||||
no longer!
|
||||
|
||||
- `ccc.nvim` has been added to the default plugins to allow picking colors with
|
||||
ease.
|
||||
|
||||
- Most UI components of Neovim have been replaced through the help of
|
||||
`noice.nvim`. There are also notifications and custom UI elements available
|
||||
for Neovim messages and prompts.
|
||||
|
||||
- A (floating by default) terminal has been added through `toggleterm.nvim`.
|
||||
|
||||
- Harness the power of ethical (`tabnine.nvim`) and not-so-ethical
|
||||
(`copilot.lua`) AI by those new assistant plugins. Both are off by default,
|
||||
TabNine needs to be wrapped before it's working.
|
||||
|
||||
- Experimental mouse gestures have been added through `gesture.nvim`. See plugin
|
||||
page and the relevant module for more details on how to use.
|
||||
|
||||
- Re-open last visited buffers via `nvim-session-manager`. Disabled by default
|
||||
as deleting buffers seems to be problematic at the moment.
|
||||
|
||||
- Most of NvimTree's configuration options have been changed with some options
|
||||
being toggled to off by default.
|
||||
|
||||
- Lualine had its configuration simplified and style toned down. Less color,
|
||||
more info.
|
||||
|
||||
- Modules where multiple plugin configurations were in the same directory have
|
||||
been simplified. Each plugin inside a single module gets its directory to be
|
||||
imported.
|
||||
|
||||
- Separate config options with the same parent attribute have been merged into
|
||||
one for simplicity.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# Release 0.3 {#sec-release-0.3}
|
||||
# Release 0.3 {#sec-release-0-3}
|
||||
|
||||
Release 0.3 had to come out before I wanted it to due to Neovim 0.9 dropping
|
||||
into nixpkgs-unstable. The Treesitter changes have prompted a Treesitter rework,
|
||||
|
|
@ -7,7 +7,7 @@ those are downstreamed from the original repository. The feature requests that
|
|||
was originally planned for 0.3 have been moved to 0.4, which should come out
|
||||
soon.
|
||||
|
||||
## Changelog {#sec-release-0.3-changelog}
|
||||
## Changelog {#sec-release-0-3-changelog}
|
||||
|
||||
- We have transitioned to flake-parts, from flake-utils to extend the
|
||||
flexibility of this flake. This means the flake structure is different than
|
||||
|
|
@ -39,7 +39,7 @@ soon.
|
|||
[discourse]: https://discourse.nixos.org/t/psa-if-you-are-on-unstable-try-out-nvim-treesitter-withallgrammars/23321?u=snowytrees
|
||||
|
||||
- Treesitter grammars are now configurable with
|
||||
[](#opt-vim.treesitter.grammars). Utilizes the nixpkgs `nvim-treesitter`
|
||||
{option}`vim.treesitter.grammars`. Utilizes the nixpkgs `nvim-treesitter`
|
||||
plugin rather than a custom input in order to take advantage of build support
|
||||
of pinned versions. See [discourse] for more information. Packages can be
|
||||
found under the `pkgs.vimPlugins.nvim-treesitter.builtGrammars` attribute.
|
||||
|
|
@ -50,20 +50,20 @@ soon.
|
|||
|
||||
- A new section has been added for language support: `vim.languages.<language>`.
|
||||
|
||||
- The options `enableLSP` [](#opt-vim.languages.enableTreesitter), etc. will
|
||||
- The options `enableLSP` {option}`vim.languages.enableTreesitter`, etc. will
|
||||
enable the respective section for all languages that have been enabled.
|
||||
- All LSP languages have been moved here
|
||||
- `plantuml` and `markdown` have been moved here
|
||||
- A new section has been added for `html`. The old
|
||||
`vim.treesitter.autotagHtml` can be found at
|
||||
[](#opt-vim.languages.html.treesitter.autotagHtml).
|
||||
{option}`vim.languages.html.treesitter.autotagHtml`.
|
||||
|
||||
- `vim.git.gitsigns.codeActions` has been added, allowing you to turn on
|
||||
Gitsigns' code actions.
|
||||
|
||||
- Removed the plugins document in the docs. Was too unwieldy to keep updated.
|
||||
|
||||
- `vim.visual.lspkind` has been moved to [](#opt-vim.lsp.lspkind.enable)
|
||||
- `vim.visual.lspkind` has been moved to {option}`vim.lsp.lspkind.enable`
|
||||
|
||||
- Improved handling of completion formatting. When setting
|
||||
`vim.autocomplete.sources`, can also include optional menu mapping. And can
|
||||
|
|
@ -74,7 +74,7 @@ soon.
|
|||
by using `null` rather than `""` now.
|
||||
|
||||
- Transparency has been made optional and has been disabled by default.
|
||||
[](#opt-vim.theme.transparent) option can be used to enable or disable
|
||||
{option}`vim.theme.transparent` option can be used to enable or disable
|
||||
transparency for your configuration.
|
||||
|
||||
- Fixed deprecated configuration method for Tokyonight, and added new style
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# Release 0.4 {#sec-release-0.4}
|
||||
# Release 0.4 {#sec-release-0-4}
|
||||
|
||||
Following the release of v0.3, I have decided to release v0.4 with a massive new
|
||||
change: customizable keybinds. As of the 0.4 release, keybinds will no longer be
|
||||
|
|
@ -12,7 +12,7 @@ as `lazygit` integration and the new experimental Lua loader of Neovim 0.9
|
|||
thanks to our awesome contributors who made this update possible during my
|
||||
absence.
|
||||
|
||||
## Changelog {#sec-release-0.4-changelog}
|
||||
## Changelog {#sec-release-0-4-changelog}
|
||||
|
||||
[n3oney](https://github.com/n3oney):
|
||||
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
# Release 0.5 {#sec-release-0.5}
|
||||
# Release 0.5 {#sec-release-0-5}
|
||||
|
||||
Release notes for release 0.5
|
||||
|
||||
## Changelog {#sec-release-0.5-changelog}
|
||||
## Changelog {#sec-release-0-5-changelog}
|
||||
|
||||
[vagahbond](https://github.com/vagahbond):
|
||||
|
||||
|
|
@ -17,14 +15,14 @@ Release notes for release 0.5
|
|||
- Fixed a bug where cmp's close and scrollDocs mappings wasn't working
|
||||
|
||||
- Streamlined and simplified extra plugin API with the addition of
|
||||
[](#opt-vim.extraPlugins)
|
||||
{option}`vim.extraPlugins`
|
||||
|
||||
- Allow using command names in place of LSP packages to avoid automatic
|
||||
installation
|
||||
|
||||
- Add lua LSP and Treesitter support, and neodev.nvim plugin support
|
||||
|
||||
- Add [](#opt-vim.lsp.mappings.toggleFormatOnSave) keybind
|
||||
- Add {option}`vim.lsp.mappings.toggleFormatOnSave` keybind
|
||||
|
||||
[amanse](https://github.com/amanse):
|
||||
|
||||
|
|
@ -52,10 +50,10 @@ Release notes for release 0.5
|
|||
|
||||
- Added GitHub Copilot to nvim-cmp completion sources.
|
||||
|
||||
- Added [](#opt-vim.ui.borders.enable) for global and individual plugin border
|
||||
- Added {option}`vim.ui.borders.enable` for global and individual plugin border
|
||||
configuration.
|
||||
|
||||
- LSP integrated breadcrumbs with [](#opt-vim.ui.breadcrumbs.enable) through
|
||||
- LSP integrated breadcrumbs with {option}`vim.ui.breadcrumbs.enable` through
|
||||
nvim-navic
|
||||
|
||||
- LSP navigation helper with nvim-navbuddy, depends on nvim-navic (automatically
|
||||
|
|
@ -66,14 +64,14 @@ Release notes for release 0.5
|
|||
- Fixed mismatching Zig language description
|
||||
|
||||
- Added support for `statix` and `deadnix` through
|
||||
[](#opt-vim.languages.nix.extraDiagnostics.types)
|
||||
{option}`vim.languages.nix.extraDiagnostics.types`
|
||||
|
||||
- Added `lsp_lines` plugin for showing diagnostic messages
|
||||
|
||||
- Added a configuration option for choosing the leader key
|
||||
|
||||
- The package used for neovim is now customizable by the user, using
|
||||
[](#opt-vim.package). For best results, always use an unwrapped package
|
||||
{option}`vim.package`. For best results, always use an unwrapped package
|
||||
|
||||
- Added highlight-undo plugin for highlighting undo/redo targets
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# Release 0.6 {#sec-release-0.6}
|
||||
# Release 0.6 {#sec-release-0-6}
|
||||
|
||||
Release notes for release 0.6
|
||||
|
||||
|
|
@ -41,14 +41,14 @@ end
|
|||
vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap = true, silent = true })
|
||||
```
|
||||
|
||||
## Changelog {#sec-release-0.6-changelog}
|
||||
## Changelog {#sec-release-0-6-changelog}
|
||||
|
||||
[ksonj](https://github.com/ksonj):
|
||||
|
||||
- Added Terraform language support.
|
||||
|
||||
- Added `ChatGPT.nvim`, which can be enabled with
|
||||
[](#opt-vim.assistant.chatgpt.enable). Do keep in mind that this option
|
||||
{option}`vim.assistant.chatgpt.enable`. Do keep in mind that this option
|
||||
requires `OPENAI_API_KEY` environment variable to be set.
|
||||
|
||||
[donnerinoern](https://github.com/donnerinoern):
|
||||
|
|
@ -95,7 +95,7 @@ vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap =
|
|||
and also has been removed.
|
||||
|
||||
- `which-key.nvim` categories can now be customized through
|
||||
[vim.binds.whichKey.register](#opt-vim.binds.whichKey.register)
|
||||
[vim.binds.whichKey.register](./options.html#option-vim-binds-whichKey-register)
|
||||
|
||||
- Added `magick` to `vim.luaPackages` for `image.nvim`.
|
||||
|
||||
|
|
@ -125,10 +125,10 @@ vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap =
|
|||
|
||||
- Lualine module now allows customizing `always_divide_middle`, `ignore_focus`
|
||||
and `disabled_filetypes` through the new options:
|
||||
[vim.statusline.lualine.alwaysDivideMiddle](#opt-vim.statusline.lualine.alwaysDivideMiddle),
|
||||
[vim.statusline.lualine.ignoreFocus](#opt-vim.statusline.lualine.ignoreFocus)
|
||||
[vim.statusline.lualine.alwaysDivideMiddle](./options.html#option-vim-statusline-lualine-alwaysDivideMiddle),
|
||||
[vim.statusline.lualine.ignoreFocus](./options.html#option-vim-statusline-lualine-ignoreFocus)
|
||||
and
|
||||
[vim.statusline.lualine.disabledFiletypes](#opt-vim.statusline.lualine.disabledFiletypes).
|
||||
[vim.statusline.lualine.disabledFiletypes](./options.html#option-vim-statusline-lualine-disabledFiletypes).
|
||||
|
||||
- Updated all plugin inputs to their latest versions (**21.04.2024**) - this
|
||||
brought minor color changes to the Catppuccin theme.
|
||||
|
|
@ -159,10 +159,10 @@ vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap =
|
|||
arguments to take `luaBefore`, `luaConfig` and `luaAfter` as strings, which
|
||||
are then concatted inside a lua block.
|
||||
|
||||
- Added [](#opt-vim.luaConfigPre) and [](#opt-vim.luaConfigPost) for inserting
|
||||
verbatim Lua configuration before and after the resolved Lua DAG respectively.
|
||||
Both of those options take strings as the type, so you may read the contents
|
||||
of a Lua file from a given path.
|
||||
- Added {option}`vim.luaConfigPre` and {option} `vim-luaConfigPost` for
|
||||
inserting verbatim Lua configuration before and after the resolved Lua DAG
|
||||
respectively. Both of those options take strings as the type, so you may read
|
||||
the contents of a Lua file from a given path.
|
||||
|
||||
- Added `vim.spellchecking.ignoredFiletypes` and
|
||||
`vim.spellChecking.programmingWordlist.enable` for ignoring certain filetypes
|
||||
|
|
@ -172,12 +172,12 @@ vim.api.nvim_set_keymap('n', '<leader>a', ':lua camelToSnake()<CR>', { noremap =
|
|||
- Exposed `withRuby`, `withNodeJs`, `withPython3`, and `python3Packages` from
|
||||
the `makeNeovimConfig` function under their respective options.
|
||||
|
||||
- Added [](#opt-vim.extraPackages) for appending additional packages to the
|
||||
- Added {option}`vim.extraPackages` for appending additional packages to the
|
||||
wrapper PATH, making said packages available while inside the Neovim session.
|
||||
|
||||
- Made Treesitter options configurable, and moved treesitter-context to
|
||||
`setupOpts` while it is enabled.
|
||||
|
||||
- Added [](#opt-vim.notify.nvim-notify.setupOpts.render) which takes either a
|
||||
- Added {option}`vim.notify.nvim-notify.setupOpts.render` which takes either a
|
||||
string of enum, or a Lua function. The default is "compact", but you may
|
||||
change it according to nvim-notify documentation.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# Release 0.7 {#sec-release-0.7}
|
||||
# Release 0.7 {#sec-release-0-7}
|
||||
|
||||
Release notes for release 0.7
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ options that were under `vim` as convenient shorthands for `vim.o.*` options.
|
|||
|
||||
::: {.warning}
|
||||
|
||||
As v0.7 features the addition of [](#opt-vim.options), those options are now
|
||||
As v0.7 features the addition of {option}`vim.options`, those options are now
|
||||
considered as deprecated. You should migrate to the appropriate options in the
|
||||
`vim.options` submodule.
|
||||
|
||||
|
|
@ -108,14 +108,14 @@ The changes are, in no particular order:
|
|||
|
||||
- `colourTerm`, `mouseSupport`, `cmdHeight`, `updateTime`, `mapTime`,
|
||||
`cursorlineOpt`, `splitBelow`, `splitRight`, `autoIndent` and `wordWrap` have
|
||||
been mapped to their [](#opt-vim.options) equivalents. Please see the module
|
||||
been mapped to their {option}`vim.options` equivalents. Please see the module
|
||||
definition for the updated options.
|
||||
|
||||
- `tabWidth` has been **removed** as it lead to confusing behaviour. You can
|
||||
replicate the same functionality by setting `shiftwidth`, `tabstop` and
|
||||
`softtabstop` under `vim.options` as you see fit.
|
||||
|
||||
## Changelog {#sec-release-0.7-changelog}
|
||||
## Changelog {#sec-release-0-7-changelog}
|
||||
|
||||
[ItsSorae](https://github.com/ItsSorae):
|
||||
|
||||
|
|
@ -125,7 +125,7 @@ The changes are, in no particular order:
|
|||
[frothymarrow](https://github.com/frothymarrow):
|
||||
|
||||
- Modified type for
|
||||
[](#opt-vim.visuals.fidget-nvim.setupOpts.progress.display.overrides) from
|
||||
{option}`vim.visuals.fidget-nvim.setupOpts.progress.display.overrides` from
|
||||
`anything` to a `submodule` for better type checking.
|
||||
|
||||
- Fix null `vim.lsp.mappings` generating an error and not being filtered out.
|
||||
|
|
@ -134,7 +134,7 @@ The changes are, in no particular order:
|
|||
group for `Normal`, `NormalFloat`, `LineNr`, `SignColumn` and optionally
|
||||
`NvimTreeNormal` to `none`.
|
||||
|
||||
- Fix [](#opt-vim.ui.smartcolumn.setupOpts.custom_colorcolumn) using the wrong
|
||||
- Fix {option}`vim.ui.smartcolumn.setupOpts.custom_colorcolumn` using the wrong
|
||||
type `int` instead of the expected type `string`.
|
||||
|
||||
[horriblename](https://github.com/horriblename):
|
||||
|
|
@ -170,7 +170,7 @@ The changes are, in no particular order:
|
|||
|
||||
- Add [ocaml-lsp] support
|
||||
|
||||
- Fix misspelled "Emacs"
|
||||
- Fix "Emac" typo
|
||||
|
||||
- Add [new-file-template.nvim] to automatically fill new file contents using
|
||||
templates
|
||||
|
|
@ -216,18 +216,18 @@ The changes are, in no particular order:
|
|||
|
||||
- Remove `autopairs.type`, and rename `autopairs.enable` to
|
||||
`autopairs.nvim-autopairs.enable`. The new
|
||||
[](#opt-vim.autopairs.nvim-autopairs.enable) supports `setupOpts` format by
|
||||
{option}`vim.autopairs.nvim-autopairs.enable` supports `setupOpts` format by
|
||||
default.
|
||||
|
||||
- Refactor of `nvim-cmp` and completion related modules
|
||||
|
||||
- Remove `autocomplete.type` in favor of per-plugin enable options such as
|
||||
[](#opt-vim.autocomplete.nvim-cmp.enable).
|
||||
{option}`vim.autocomplete.nvim-cmp.enable`.
|
||||
- Deprecate legacy Vimsnip in favor of Luasnip, and integrate
|
||||
friendly-snippets for bundled snippets. [](#opt-vim.snippets.luasnip.enable)
|
||||
can be used to toggle Luasnip.
|
||||
friendly-snippets for bundled snippets.
|
||||
{option}`vim.snippets.luasnip.enable` can be used to toggle Luasnip.
|
||||
- Add sorting function options for completion sources under
|
||||
[](#opt-vim.autocomplete.nvim-cmp.setupOpts.sorting.comparators)
|
||||
{option}`vim.autocomplete.nvim-cmp.setupOpts.sorting.comparators`
|
||||
|
||||
- Add C# support under `vim.languages.csharp`, with support for both
|
||||
omnisharp-roslyn and csharp-language-server.
|
||||
|
|
@ -297,12 +297,12 @@ The changes are, in no particular order:
|
|||
Lualine. Only `vim.ui.breadcrumbs.lualine.winbar` is supported for the time
|
||||
being.
|
||||
|
||||
- [](#opt-vim.ui.breadcrumbs.lualine.winbar.enable) has been added to allow
|
||||
- {option}`vim.ui.breadcrumbs.lualine.winbar.enable` has been added to allow
|
||||
controlling the default behaviour of the `nvim-navic` component on Lualine,
|
||||
which used to occupy `winbar.lualine_c` as long as breadcrumbs are enabled.
|
||||
- `vim.ui.breadcrumbs.alwaysRender` has been renamed to
|
||||
[](#opt-vim.ui.breadcrumbs.lualine.winbar.alwaysRender) to be conform to the
|
||||
new format.
|
||||
{option}`vim.ui.breadcrumbs.lualine.winbar.alwaysRender` to be conform to
|
||||
the new format.
|
||||
|
||||
- Add [basedpyright](https://github.com/detachhead/basedpyright) as a Python LSP
|
||||
server and make it default.
|
||||
|
|
@ -310,10 +310,10 @@ The changes are, in no particular order:
|
|||
- Add [python-lsp-server](https://github.com/python-lsp/python-lsp-server) as an
|
||||
additional Python LSP server.
|
||||
|
||||
- Add [](#opt-vim.options) to set `vim.o` values in in your nvf configuration
|
||||
- Add {option}`vim.options` to set `vim.o` values in in your nvf configuration
|
||||
without using additional Lua. See option documentation for more details.
|
||||
|
||||
- Add [](#opt-vim.dashboard.dashboard-nvim.setupOpts) to allow user
|
||||
- Add {option}`vim.dashboard.dashboard-nvim.setupOpts` to allow user
|
||||
configuration for [dashboard.nvim](https://github.com/nvimdev/dashboard-nvim)
|
||||
|
||||
- Update `lualine.nvim` input and add missing themes:
|
||||
|
|
@ -321,7 +321,7 @@ The changes are, in no particular order:
|
|||
- Adds `ayu`, `gruvbox_dark`, `iceberg`, `moonfly`, `onedark`,
|
||||
`powerline_dark` and `solarized_light` themes.
|
||||
|
||||
- Add [](#opt-vim.spellcheck.extraSpellWords) to allow adding arbitrary
|
||||
- Add {option}`vim.spellcheck.extraSpellWords` to allow adding arbitrary
|
||||
spellfiles to Neovim's runtime with ease.
|
||||
|
||||
- Add combined nvf configuration (`config.vim`) into the final package's
|
||||
|
|
@ -375,9 +375,9 @@ The changes are, in no particular order:
|
|||
[nezia1](https://github.com/nezia1):
|
||||
|
||||
- Add [biome](https://github.com/biomejs/biome) support for Typescript, CSS and
|
||||
Svelte. Enable them via [](#opt-vim.languages.ts.format.type),
|
||||
[](#opt-vim.languages.css.format.type) and
|
||||
[](#opt-vim.languages.svelte.format.type) respectively.
|
||||
Svelte. Enable them via {option}`vim.languages.ts.format.type`,
|
||||
{option}`vim.languages.css.format.type` and
|
||||
{option}`vim.languages.svelte.format.type` respectively.
|
||||
- Replace [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt) with
|
||||
[nixfmt](https://github.com/NixOS/nixfmt) (nixfmt-rfc-style).
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# Release 0.8 {#sec-release-0.8}
|
||||
# Release 0.8 {#sec-release-0-8}
|
||||
|
||||
## Breaking changes
|
||||
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
- `vim.useSystemClipboard` has been deprecated as a part of removing most
|
||||
top-level convenience options, and should instead be configured in the new
|
||||
module interface. You may set [](#opt-vim.clipboard.registers) appropriately
|
||||
module interface. You may set {option}`vim.clipboard.registers` appropriately
|
||||
to configure Neovim to use the system clipboard.
|
||||
|
||||
- Changed which-key group used for gitsigns from `<leader>g` to `<leader>h` to
|
||||
|
|
@ -32,6 +32,8 @@
|
|||
autocmd event. If you were calling `default_on_attach()` in your LSP setup you
|
||||
can remove them now.
|
||||
|
||||
## Changelog {#sec-release-0-8-changelog}
|
||||
|
||||
[NotAShelf](https://github.com/notashelf):
|
||||
|
||||
[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
|
||||
|
|
@ -52,16 +54,16 @@
|
|||
- Add [render-markdown.nvim] under
|
||||
`languages.markdown.extensions.render-markdown-nvim`.
|
||||
|
||||
- Implement [](#opt-vim.git.gitsigns.setupOpts) for user-specified setup table
|
||||
- Implement {option}`vim.git.gitsigns.setupOpts` for user-specified setup table
|
||||
in gitsigns configuration.
|
||||
|
||||
- [](#opt-vim.options.mouse) no longer compares values to an enum of available
|
||||
- {option}`vim.options.mouse` no longer compares values to an enum of available
|
||||
mouse modes. This means you can provide any string without the module system
|
||||
warning you that it is invalid. Do keep in mind that this value is no longer
|
||||
checked, so you will be responsible for ensuring its validity.
|
||||
|
||||
- Deprecate `vim.enableEditorconfig` in favor of
|
||||
[](#opt-vim.globals.editorconfig).
|
||||
{option}`vim.globals.editorconfig`.
|
||||
|
||||
- Deprecate rnix-lsp as it has been abandoned and archived upstream.
|
||||
|
||||
|
|
@ -70,9 +72,9 @@
|
|||
your Editorconfig configuration, or use an autocommand to set indentation
|
||||
values for buffers with the Nix filetype.
|
||||
|
||||
- Add [](#opt-vim.lsp.lightbulb.autocmd.enable) for manually managing the
|
||||
- Add {option}`vim.lsp.lightbulb.autocmd.enable` for manually managing the
|
||||
previously managed lightbulb autocommand.
|
||||
- A warning will occur if [](#opt-vim.lsp.lightbulb.autocmd.enable) and
|
||||
- A warning will occur if {option} vim-lsp-lightbulb-autocmd-enable) and
|
||||
`vim.lsp.lightbulb.setupOpts.autocmd.enabled` are both set at the same time.
|
||||
Pick only one.
|
||||
|
||||
|
|
@ -83,7 +85,7 @@
|
|||
|
||||
- Add [yazi.nvim] as a companion plugin for Yazi, the terminal file manager.
|
||||
|
||||
- Add [](#opt-vim.autocmds) and [](#opt-vim.augroups) to allow declaring
|
||||
- Add {option}`vim.autocmds` and {option}`vim-augroups` to allow declaring
|
||||
autocommands via Nix.
|
||||
|
||||
- Fix plugin `setupOpts` for yanky.nvim and assert if shada is configured as a
|
||||
|
|
@ -105,7 +107,7 @@
|
|||
`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.
|
||||
{option}`vim.diagnostics.config` in nvf.
|
||||
|
||||
- Add `vim.clipboard` module for easily managing Neovim clipboard providers and
|
||||
relevant packages in a simple UI.
|
||||
|
|
@ -207,7 +209,7 @@
|
|||
- Add [fzf-lua](https://github.com/ibhagwan/fzf-lua) in `vim.fzf-lua`
|
||||
- Add [rainbow-delimiters](https://github.com/HiPhish/rainbow-delimiters.nvim)
|
||||
in `vim.visuals.rainbow-delimiters`
|
||||
- Add options to define highlights under [](#opt-vim.highlight)
|
||||
- Add options to define highlights under {option}`vim.highlight`
|
||||
|
||||
[kaktu5](https://github.com/kaktu5):
|
||||
|
||||
|
|
@ -223,8 +225,8 @@
|
|||
|
||||
[thamenato](https://github.com/thamenato):
|
||||
|
||||
[ruff]: (https://github.com/astral-sh/ruff)
|
||||
[cue]: (https://cuelang.org/)
|
||||
[ruff]: https://github.com/astral-sh/ruff
|
||||
[cue]: https://cuelang.org/
|
||||
|
||||
- Add [ruff] as a formatter option in `vim.languages.python.format.type`.
|
||||
- Add [cue] support under `vim.languages.cue`.
|
||||
|
|
@ -405,7 +407,7 @@
|
|||
|
||||
[aionoid](https://github.com/aionoid):
|
||||
|
||||
[avante-nvim]: https://github.com/yetone/avante.nvim
|
||||
[avante.nvim]: https://github.com/yetone/avante.nvim
|
||||
|
||||
- Fix [render-markdown.nvim] file_types option type to list, to accept merging.
|
||||
- Add [avante.nvim] plugin under `vim.assistant.avante-nvim`.
|
||||
|
|
@ -507,6 +509,7 @@
|
|||
- fix broken `neorg` grammars
|
||||
- remove obsolete warning in the `otter` module
|
||||
- add mainProgram attribute to vala language server wrapper
|
||||
- fix `crates-nvim`'s completions by using the in-program lsp
|
||||
|
||||
[JManch](https://github.com/JManch):
|
||||
|
||||
|
|
@ -550,7 +553,7 @@
|
|||
|
||||
[valterschutz](https://github.com/valterschutz):
|
||||
|
||||
[ruff]: (https://github.com/astral-sh/ruff)
|
||||
[ruff]: https://github.com/astral-sh/ruff
|
||||
|
||||
- Add [ruff-fix] as a formatter option in `vim.languages.python.format.type`.
|
||||
|
||||
|
|
@ -580,7 +583,16 @@
|
|||
[typst-concealer]: https://github.com/PartyWumpus/typst-concealer
|
||||
|
||||
- Add inline typst concealing support under `vim.languages.typst` using
|
||||
[typst-concealer]. [simon-wg](https://github.com/simon-wg):
|
||||
[typst-concealer].
|
||||
|
||||
[KrappRamiro](https://github.com/KrappRamiro):
|
||||
|
||||
[phaazon/hop.nvim]: https://github.com/hadronized/hop.nvim
|
||||
[smoka7/hop.nvim]: https://github.com/smoka7/hop.nvim
|
||||
|
||||
- Migrate [phaazon/hop.nvim] to [smoka7/hop.nvim]
|
||||
|
||||
[simon-wg](https://github.com/simon-wg):
|
||||
|
||||
- Update `python` language module to use correct lsp binary.
|
||||
- Fix `python` pyright and basedpyright language servers not using default on
|
||||
|
|
@ -598,3 +610,20 @@
|
|||
|
||||
- Enable `languages.ts.format` for `.js` files
|
||||
- Add [emmet-ls] to `html.lsp.servers`
|
||||
|
||||
[axelbdt](https://github.com/axelbdt):
|
||||
|
||||
[neocodeium]: https://github.com/monkoose/neocodeium
|
||||
|
||||
- Add [neocodeium] plugin in `vim.assistant.neocodeium` with `enable`,
|
||||
`setupOpts` and `keymaps`
|
||||
|
||||
[JudahZF](https://github.com/JudahZF):
|
||||
|
||||
- Added gitFiles mapping option to telescope
|
||||
|
||||
[Ring-A-Ding-Ding-Baby](https://github.com/Ring-A-Ding-Ding-Baby)
|
||||
|
||||
- Aligned `codelldb` adapter setup with [rustaceanvim]’s built-in logic.
|
||||
- Added `languages.rust.dap.backend` option to choose between `codelldb` and
|
||||
`lldb-dap` adapters.
|
||||
|
|
@ -6,7 +6,7 @@ documentation, configuring **nvf** with pure Lua and using custom plugin sources
|
|||
in **nvf** in this section. For general configuration tips, please see previous
|
||||
chapters.
|
||||
|
||||
```{=include=} chapters
|
||||
```{=include=}
|
||||
tips/debugging-nvf.md
|
||||
tips/offline-docs.md
|
||||
tips/pure-lua-config.md
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ startup.
|
|||
}
|
||||
```
|
||||
|
||||
[`vim.extraPlugins`]: https://notashelf.github.io/nvf/options.html#opt-vim.extraPlugins
|
||||
[`vim.extraPlugins`]: ./options.html#option-vim-extraPlugins
|
||||
|
||||
This will fetch aerial.nvim from nixpkgs, and add it to Neovim's runtime path to
|
||||
be loaded manually. Although for plugins that require manual setup, you are
|
||||
|
|
@ -43,7 +43,7 @@ encouraged to use [`vim.extraPlugins`].
|
|||
}
|
||||
```
|
||||
|
||||
[custom plugins section]: https://notashelf.github.io/nvf/index.xhtml#ch-custom-plugins
|
||||
[custom plugins section]: ./configuring.html#ch-custom-plugins
|
||||
|
||||
More details on the extraPlugins API is documented in the
|
||||
[custom plugins section].
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ manner.
|
|||
This will add the `nvim` directory, or rather, the _store path_ that will be
|
||||
realised after your flake gets copied to the Nix store, to Neovim's runtime
|
||||
directory. You may now create a `lua/myconfig` directory within this nvim
|
||||
directory, and call it with [](#opt-vim.luaConfigRC).
|
||||
directory, and call it with {option}`vim.luaConfigRC`.
|
||||
|
||||
```nix
|
||||
{pkgs, ...}: {
|
||||
|
|
@ -90,7 +90,7 @@ vim.keymap.set("n", " ", "<Nop>", { silent = true, remap = false })
|
|||
vim.g.mapleader = " "
|
||||
```
|
||||
|
||||
The following Nix configuration via [](#opt-vim.luaConfigRC) will allow loading
|
||||
The following Nix configuration via {option}`vim.luaConfigRC` will allow loading
|
||||
this
|
||||
|
||||
```nix
|
||||
|
|
@ -105,7 +105,7 @@ this
|
|||
}
|
||||
```
|
||||
|
||||
[DAG system]: https://notashelf.github.io/nvf/index.xhtml#ch-using-dags
|
||||
[DAG system]: ./configuring.html#ch-using-dags
|
||||
|
||||
After you load your custom configuration, you may use an `init.lua` located in
|
||||
your custom configuration directory to configure Neovim exactly as you would
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
# Release Notes {#ch-release-notes}
|
||||
|
||||
This section lists the release notes for tagged version of **nvf** and the
|
||||
current main current main branch
|
||||
|
||||
```{=include=} chapters
|
||||
rl-0.1.md
|
||||
rl-0.2.md
|
||||
rl-0.3.md
|
||||
rl-0.4.md
|
||||
rl-0.5.md
|
||||
rl-0.6.md
|
||||
rl-0.7.md
|
||||
```
|
||||
43
flake.lock
generated
43
flake.lock
generated
|
|
@ -51,13 +51,47 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"ndg": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1765720983,
|
||||
"narHash": "sha256-tWtukpABmux6EC/FuCJEgA1kmRjcRPtED44N+GGPq+4=",
|
||||
"owner": "feel-co",
|
||||
"repo": "ndg",
|
||||
"rev": "f399ace8bb8e1f705dd8942b24d207aa4d75c936",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "feel-co",
|
||||
"repo": "ndg",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1761880412,
|
||||
"narHash": "sha256-QoJjGd4NstnyOG4mm4KXF+weBzA2AH/7gn1Pmpfcb0A=",
|
||||
"lastModified": 1764242076,
|
||||
"narHash": "sha256-sKoIWfnijJ0+9e4wRvIgm/HgE27bzwQxcEmo2J/gNpI=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2fad6eac6077f03fe109c4d4eb171cf96791faa4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1764081664,
|
||||
"narHash": "sha256-sUoHmPr/EwXzRMpv1u/kH+dXuvJEyyF2Q7muE+t0EU4=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a7fc11be66bdfb5cdde611ee5ce381c183da8386",
|
||||
"rev": "dc205f7b4fdb04c8b7877b43edb7b73be7730081",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -72,7 +106,8 @@
|
|||
"flake-compat": "flake-compat",
|
||||
"flake-parts": "flake-parts",
|
||||
"mnw": "mnw",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"ndg": "ndg",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"systems": "systems"
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -105,5 +105,8 @@
|
|||
|
||||
# Alternate neovim-wrapper
|
||||
mnw.url = "github:Gerg-L/mnw";
|
||||
|
||||
# Alternative documentation generator
|
||||
ndg.url = "github:feel-co/ndg";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
lib,
|
||||
pins,
|
||||
openssl,
|
||||
pkg-config,
|
||||
|
|
@ -11,6 +12,8 @@
|
|||
}: let
|
||||
# From npins
|
||||
pin = pins.avante-nvim;
|
||||
|
||||
pname = "avante-nvim-lib";
|
||||
version = pin.branch;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
inherit (pin.repository) owner repo;
|
||||
|
|
@ -19,8 +22,7 @@
|
|||
};
|
||||
|
||||
avante-nvim-lib = rustPlatform.buildRustPackage {
|
||||
pname = "avante-nvim-lib";
|
||||
inherit version src;
|
||||
inherit pname version src;
|
||||
|
||||
cargoHash = "sha256-pTWCT2s820mjnfTscFnoSKC37RE7DAPKxP71QuM+JXQ=";
|
||||
|
||||
|
|
@ -43,6 +45,8 @@
|
|||
"--skip=test_roundtrip"
|
||||
"--skip=test_fetch_md"
|
||||
];
|
||||
|
||||
env.RUSTFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-C link-arg=-undefined -C link-arg=dynamic_lookup";
|
||||
};
|
||||
in
|
||||
vimUtils.buildVimPlugin {
|
||||
|
|
@ -64,7 +68,15 @@ in
|
|||
# Requires setup with corresponding provider
|
||||
"avante.providers.azure"
|
||||
"avante.providers.copilot"
|
||||
"avante.providers.vertex_claude"
|
||||
"avante.providers.gemini"
|
||||
"avante.providers.ollama"
|
||||
"avante.providers.vertex"
|
||||
"avante.providers.vertex_claude"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Neovim plugin designed to emulate the behaviour of the Cursor AI IDE";
|
||||
homepage = "https://github.com/yetone/avante.nvim";
|
||||
license = lib.licenses.asl20;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
writeShellScriptBin,
|
||||
}:
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "blink-cmp";
|
||||
version = "1.6.0";
|
||||
version = "1.8.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Saghen";
|
||||
repo = "blink.cmp";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-IHRYgKcYP+JDGu8Vtawgzlhq25vpROFqb8KmpfVMwCk=";
|
||||
hash = "sha256-JjlcPj7v9J+v1SDBYIub6jFEslLhZGHmsipV1atUAFo=";
|
||||
};
|
||||
|
||||
forceShare = [
|
||||
|
|
@ -29,11 +31,24 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
|||
mv "$out/lib" "$out/target/release"
|
||||
'';
|
||||
|
||||
cargoHash = "sha256-QsVCugYWRri4qu64wHnbJQZBhy4tQrr+gCYbXtRBlqE=";
|
||||
cargoHash = "sha256-Qdt8O7IGj2HySb1jxsv3m33ZxJg96Ckw26oTEEyQjfs=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
(writeShellScriptBin "git" "exit 1")
|
||||
];
|
||||
|
||||
env.RUSTC_BOOTSTRAP = true;
|
||||
env = {
|
||||
RUSTC_BOOTSTRAP = true;
|
||||
|
||||
# Those are the Linker args used by upstream. Without those, the build fails.
|
||||
# See:
|
||||
# <https://github.com/saghen/blink.cmp/blob/main/.cargo/config.toml#L1C1-L11C2>
|
||||
RUSTFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-C link-arg=-undefined -C link-arg=dynamic_lookup";
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Performant, batteries-included completion plugin for Neovim";
|
||||
homepage = "https://github.com/saghen/blink.cmp";
|
||||
changelog = "https://github.com/Saghen/blink.cmp/blob/v${finalAttrs.version}/CHANGELOG.md";
|
||||
};
|
||||
})
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@
|
|||
in {
|
||||
inherit (typesDag) dagOf;
|
||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
||||
inherit (typesLanguage) diagnostics mkGrammarOption;
|
||||
inherit (typesLanguage) diagnostics mkGrammarOption mkEnableTreesitterOption;
|
||||
inherit (customTypes) char hexColor mergelessListOf deprecatedSingleOrListOf;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{lib}: let
|
||||
inherit (lib.options) mkOption mkPackageOption;
|
||||
inherit (lib.attrsets) attrNames;
|
||||
inherit (lib.types) listOf either enum submodule package;
|
||||
inherit (lib.types) listOf either enum submodule package bool;
|
||||
|
||||
diagnosticSubmodule = _: {
|
||||
options = {
|
||||
|
|
@ -32,6 +32,13 @@
|
|||
mkPackageOption pkgs ["${grammar} treesitter"] {
|
||||
default = ["vimPlugins" "nvim-treesitter" "builtGrammars" grammar];
|
||||
};
|
||||
|
||||
mkEnableTreesitterOption = defaultCondition: language:
|
||||
mkOption {
|
||||
type = bool;
|
||||
default = defaultCondition;
|
||||
description = "Whether to enable ${language} treesitter";
|
||||
};
|
||||
in {
|
||||
inherit diagnostics diagnosticSubmodule mkGrammarOption;
|
||||
inherit diagnostics diagnosticSubmodule mkGrammarOption mkEnableTreesitterOption;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ in {
|
|||
clipboard = {
|
||||
enable = mkEnableOption ''
|
||||
clipboard management for Neovim. Users may still choose to manage their
|
||||
clipboard through [](#opt-vim.options) should they wish to avoid using
|
||||
clipboard through {option}`vim.options` should they wish to avoid using
|
||||
this module.
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ in {
|
|||
|
||||
To add your own language files, you may place your `spell` directory in either
|
||||
{file}`$XDG_CONFIG_HOME/nvf` or in a path that is included in the
|
||||
[additionalRuntimePaths](#opt-vim.additionalRuntimePaths) list provided by nvf.
|
||||
[additionalRuntimePaths](./options.html#option-vim-additionalRuntimePaths) list provided by nvf.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,5 +5,6 @@
|
|||
./codecompanion
|
||||
./supermaven-nvim
|
||||
./avante
|
||||
./neocodeium
|
||||
];
|
||||
}
|
||||
|
|
|
|||
33
modules/plugins/assistant/neocodeium/config.nix
Normal file
33
modules/plugins/assistant/neocodeium/config.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.nvim.binds) mkKeymap;
|
||||
cfg = config.vim.assistant.neocodeium;
|
||||
|
||||
inherit (options.vim.assistant.neocodeium) keymaps;
|
||||
mkNeoCodeiumKey = act: (mkKeymap "i" cfg.keymaps.${act} "function() require('neocodeium').${act}() end" {
|
||||
lua = true;
|
||||
desc = keymaps.${act}.description;
|
||||
});
|
||||
in {
|
||||
config = lib.mkIf cfg.enable {
|
||||
vim = {
|
||||
lazy.plugins.neocodeium = {
|
||||
package = "neocodeium";
|
||||
setupModule = "neocodeium";
|
||||
inherit (cfg) setupOpts;
|
||||
};
|
||||
keymaps = [
|
||||
(mkNeoCodeiumKey "accept")
|
||||
(mkNeoCodeiumKey "accept_word")
|
||||
(mkNeoCodeiumKey "accept_line")
|
||||
(mkNeoCodeiumKey "cycle_or_complete")
|
||||
(mkNeoCodeiumKey "cycle_or_complete_reverse")
|
||||
(mkNeoCodeiumKey "clear")
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/assistant/neocodeium/default.nix
Normal file
6
modules/plugins/assistant/neocodeium/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./neocodeium.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
155
modules/plugins/assistant/neocodeium/neocodeium.nix
Normal file
155
modules/plugins/assistant/neocodeium/neocodeium.nix
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
{lib, ...}: let
|
||||
inherit
|
||||
(lib.types)
|
||||
nullOr
|
||||
str
|
||||
bool
|
||||
int
|
||||
attrsOf
|
||||
listOf
|
||||
enum
|
||||
;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options.vim.assistant.neocodeium = {
|
||||
enable = mkEnableOption "NeoCodeium AI completion";
|
||||
|
||||
setupOpts = mkPluginSetupOption "NeoCodeium" {
|
||||
enabled = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Whether to start windsurf server. Can be manually enabled with `:NeoCodeium enable`";
|
||||
};
|
||||
|
||||
bin = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Path to custom windsurf server binary";
|
||||
};
|
||||
|
||||
manual = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "When true, autosuggestions are disabled. Use `require'neocodeium'.cycle_or_complete()` to show suggestions manually";
|
||||
};
|
||||
|
||||
server = {
|
||||
api_url = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "API URL to use (for Enterprise mode)";
|
||||
};
|
||||
portal_url = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Portal URL to use (for registering a user and downloading the binary)";
|
||||
};
|
||||
};
|
||||
|
||||
show_label = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Whether to show the number of suggestions label in the line number column";
|
||||
};
|
||||
|
||||
debounce = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Whether to enable suggestions debounce";
|
||||
};
|
||||
|
||||
max_lines = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
example = 10000;
|
||||
description = ''
|
||||
Maximum number of lines parsed from loaded buffers (current buffer always fully parsed).
|
||||
Set to `0` to disable parsing non-current buffers.
|
||||
Set to `-1` to parse all lines
|
||||
'';
|
||||
};
|
||||
|
||||
silent = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Whether to disable non-important messages";
|
||||
};
|
||||
|
||||
disable_in_special_buftypes = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Whether to disable suggestions in special buftypes like `nofile`";
|
||||
};
|
||||
|
||||
log_level = mkOption {
|
||||
type = nullOr (enum [
|
||||
"trace"
|
||||
"debug"
|
||||
"info"
|
||||
"warn"
|
||||
"error"
|
||||
]);
|
||||
default = null;
|
||||
example = "warn";
|
||||
description = "Log level";
|
||||
};
|
||||
|
||||
single_line = {
|
||||
enabled = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Whether to enable single line mode. Multi-line suggestions collapse into a single line";
|
||||
};
|
||||
label = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "...";
|
||||
description = "Label indicating that there is multi-line suggestion";
|
||||
};
|
||||
};
|
||||
|
||||
filter = mkOption {
|
||||
type = nullOr luaInline;
|
||||
default = null;
|
||||
description = ''
|
||||
Function that returns `true` if a buffer should be enabled and `false` if disabled.
|
||||
You can still enable disabled buffer with `:NeoCodeium enable_buffer`
|
||||
'';
|
||||
};
|
||||
|
||||
filetypes = mkOption {
|
||||
type = nullOr (attrsOf bool);
|
||||
default = null;
|
||||
example = {
|
||||
help = false;
|
||||
gitcommit = false;
|
||||
};
|
||||
description = ''
|
||||
Filetypes to disable suggestions in.
|
||||
You can still enable disabled buffer with `:NeoCodeium enable_buffer`
|
||||
'';
|
||||
};
|
||||
|
||||
root_dir = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
example = [
|
||||
".git"
|
||||
"package.json"
|
||||
];
|
||||
description = "List of directories and files to detect workspace root directory for Windsurf Chat";
|
||||
};
|
||||
};
|
||||
|
||||
keymaps = {
|
||||
accept = mkMappingOption "Accept suggestion" "<A-f>";
|
||||
accept_word = mkMappingOption "Accept word" "<A-w>";
|
||||
accept_line = mkMappingOption "Accept line" "<A-a>";
|
||||
cycle_or_complete = mkMappingOption "Cycle or complete" "<A-e>";
|
||||
cycle_or_complete_reverse = mkMappingOption "Cycle or complete (reverse)" "<A-r>";
|
||||
clear = mkMappingOption "Clear suggestion" "<A-c>";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
# This function acts as a template for creating new builders.
|
||||
# It enforces providing all the parameters required for creating
|
||||
# a new builder for it to be able to work in the existing code.
|
||||
#
|
||||
# The first layer requirements are as follows:
|
||||
{
|
||||
# This is the name of the builder, it will only be used internally and
|
||||
# should match the <name>.nix file that the builder is implemented in.
|
||||
name,
|
||||
#
|
||||
# Module attribute set. This is the attribute set that the module that is
|
||||
# defining a builder is passed as its input.
|
||||
moduleInheritancePackage,
|
||||
#
|
||||
# These are the standard options for the builder 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 build command is called.
|
||||
# This is a function that will take in the cfg of its own builder.
|
||||
# i.e. will be called as "args cfg.build.builders.${name}"
|
||||
args,
|
||||
...
|
||||
}: 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;
|
||||
in {
|
||||
# These are the options for the builder. It will accept any options
|
||||
# provided to it but some options are mandatory:
|
||||
options.vim.languages.tex.build.builders.${name} = ({
|
||||
# The enable option. This one is self explanatory.
|
||||
enable,
|
||||
#
|
||||
# This is the package option for the builder.
|
||||
package,
|
||||
#
|
||||
# This is the executable that will be used to call the builder.
|
||||
# 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 builder have been enabled
|
||||
# before making any config.
|
||||
config = mkIf (cfg.enable && cfg.build.builders.${name}.enable) {
|
||||
vim.languages.tex.build.builder = {
|
||||
inherit name;
|
||||
package = cfg.build.builders.${name}.package;
|
||||
executable = cfg.build.builders.${name}.executable;
|
||||
args = args cfg.build.builders.${name};
|
||||
};
|
||||
};
|
||||
}
|
||||
70
modules/plugins/formatter/conform-nvim/builders/default.nix
Normal file
70
modules/plugins/formatter/conform-nvim/builders/default.nix
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) enum listOf package str;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
inherit (builtins) attrNames filter isAttrs hasAttr elemAt length;
|
||||
|
||||
cfg = config.vim.languages.tex;
|
||||
in {
|
||||
imports = [
|
||||
./latexmk.nix
|
||||
./tectonic.nix
|
||||
];
|
||||
|
||||
options.vim.languages.tex.build.builder = {
|
||||
name = mkOption {
|
||||
type = enum (attrNames cfg.build.builders);
|
||||
default = "latexmk";
|
||||
description = ''
|
||||
The tex builder to use.
|
||||
|
||||
This is just the default custom option. By setting any of the
|
||||
builders to true, this will be overwritten by that builder's
|
||||
parameters.
|
||||
Setting this parameter to the name of a declared builder will
|
||||
not automatically enable that builder.
|
||||
'';
|
||||
};
|
||||
args = mkOption {
|
||||
type = listOf str;
|
||||
default = [
|
||||
"-pdf"
|
||||
"%f"
|
||||
];
|
||||
description = ''
|
||||
The list of args to pass to the builder.
|
||||
|
||||
This is just the default custom option. By setting any of the
|
||||
builders to true, this will be overwritten by that builder's
|
||||
parameters.
|
||||
'';
|
||||
};
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = pkgs.texlive.withPackages (ps: [ps.latexmk]);
|
||||
description = ''
|
||||
The tex builder package to use.
|
||||
|
||||
This is just the default custom option. By setting any of the
|
||||
builders to true, this will be overwritten by that builder's
|
||||
parameters.
|
||||
'';
|
||||
};
|
||||
executable = mkOption {
|
||||
type = str;
|
||||
default = "latexmk";
|
||||
description = ''
|
||||
The tex builder executable to use.
|
||||
|
||||
This is just the default custom option. By setting any of the
|
||||
builders to true, this will be overwritten by that builder's
|
||||
parameters.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
57
modules/plugins/formatter/conform-nvim/builders/latexmk.nix
Normal file
57
modules/plugins/formatter/conform-nvim/builders/latexmk.nix
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
# TODO: I need testing.
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
} @ moduleInheritancePackage: let
|
||||
# The name of the builder
|
||||
name = "latexmk";
|
||||
|
||||
# The builder template
|
||||
template = import ./builderTemplate.nix;
|
||||
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) bool package str;
|
||||
in (
|
||||
template {
|
||||
inherit name moduleInheritancePackage;
|
||||
|
||||
options = {
|
||||
enable = mkEnableOption "Whether to enable Tex Compilation Via latexmk";
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = pkgs.texlive.withPackages (ps: [ps.latexmk]);
|
||||
description = "latexmk package";
|
||||
};
|
||||
|
||||
executable = mkOption {
|
||||
type = str;
|
||||
default = "latexmk";
|
||||
description = "The executable name from the build package that will be used to build/compile the tex.";
|
||||
};
|
||||
|
||||
# Flag options
|
||||
pdfOutput = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
example = false;
|
||||
description = "Insure the output file is a pdf.";
|
||||
};
|
||||
};
|
||||
|
||||
args = builderCfg: (
|
||||
# Flags
|
||||
(
|
||||
if builderCfg.pdfOutput
|
||||
then ["-pdf"]
|
||||
else []
|
||||
)
|
||||
# Base args
|
||||
++ [
|
||||
"-quiet"
|
||||
"%f"
|
||||
]
|
||||
);
|
||||
}
|
||||
)
|
||||
203
modules/plugins/formatter/conform-nvim/builders/tectonic.nix
Normal file
203
modules/plugins/formatter/conform-nvim/builders/tectonic.nix
Normal file
|
|
@ -0,0 +1,203 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
} @ moduleInheritancePackage: let
|
||||
# The name of the builder
|
||||
name = "tectonic";
|
||||
|
||||
# The builder template
|
||||
template = import ./builderTemplate.nix;
|
||||
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) enum ints listOf package str;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
inherit (builtins) concatLists elem map toString;
|
||||
|
||||
cfg = config.vim.languages.tex;
|
||||
in (
|
||||
template {
|
||||
inherit name moduleInheritancePackage;
|
||||
|
||||
options = {
|
||||
enable = mkEnableOption "Whether to enable Tex Compilation Via Tectonic";
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = pkgs.tectonic;
|
||||
description = "tectonic package";
|
||||
};
|
||||
|
||||
executable = mkOption {
|
||||
type = str;
|
||||
default = "tectonic";
|
||||
description = "The executable name from the build package that will be used to build/compile the tex.";
|
||||
};
|
||||
|
||||
# -- Flags --
|
||||
keepIntermediates = mkBool false ''
|
||||
Keep the intermediate files generated during processing.
|
||||
|
||||
If texlab is reporting build errors when there shouldn't be, disable this option.
|
||||
'';
|
||||
keepLogs = mkBool true ''
|
||||
Keep the log files generated during processing.
|
||||
|
||||
Without the keepLogs flag, texlab won't be able to report compilation warnings.
|
||||
'';
|
||||
onlyCached = mkBool false "Use only resource files cached locally";
|
||||
synctex = mkBool true "Generate SyncTeX data";
|
||||
untrustedInput = mkBool false "Input is untrusted -- disable all known-insecure features";
|
||||
|
||||
# -- Options --
|
||||
reruns = mkOption {
|
||||
type = ints.unsigned;
|
||||
default = 0;
|
||||
example = 2;
|
||||
description = ''
|
||||
Rerun the TeX engine exactly this many times after the first.
|
||||
|
||||
Setting this value to 0 will disable setting this option.
|
||||
'';
|
||||
};
|
||||
|
||||
bundle = mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
description = "Use this directory or Zip-format bundle file to find resource files instead of the default";
|
||||
};
|
||||
|
||||
webBundle = mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
description = "Use this URL to find resource files instead of the default";
|
||||
};
|
||||
|
||||
outfmt = mkOption {
|
||||
type = enum [
|
||||
"pdf"
|
||||
"html"
|
||||
"xdv"
|
||||
"aux"
|
||||
"fmt"
|
||||
""
|
||||
];
|
||||
default = "";
|
||||
description = "The kind of output to generate";
|
||||
};
|
||||
|
||||
hidePaths = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
example = [
|
||||
"./secrets.tex"
|
||||
"./passwords.tex"
|
||||
];
|
||||
description = "Tell the engine that no file at <hide_path> exists, if it tries to read it.";
|
||||
};
|
||||
|
||||
format = mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
description = "The name of the \"format\" file used to initialize the TeX engine";
|
||||
};
|
||||
|
||||
color = mkOption {
|
||||
type = enum [
|
||||
"always"
|
||||
"auto"
|
||||
"never"
|
||||
""
|
||||
];
|
||||
default = "";
|
||||
example = "always";
|
||||
description = "Enable/disable colorful log output";
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
Add extra command line options to include in the tectonic build command.
|
||||
Extra options added here will not overwrite the options set in as nvf options.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
args = builderCfg: (
|
||||
# Base args
|
||||
[
|
||||
"-X"
|
||||
"compile"
|
||||
"%f"
|
||||
]
|
||||
# Flags
|
||||
++ (
|
||||
if builderCfg.keepIntermediates
|
||||
then ["--keep-intermediates"]
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if builderCfg.keepLogs
|
||||
then ["--keep-logs"]
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if builderCfg.onlyCached
|
||||
then ["--only-cached"]
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if builderCfg.synctex
|
||||
then ["--synctex"]
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if builderCfg.untrustedInput
|
||||
then ["--untrusted"]
|
||||
else []
|
||||
)
|
||||
# Options
|
||||
++ (
|
||||
if builderCfg.reruns > 0
|
||||
then ["--reruns" "${toString builderCfg.reruns}"]
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if builderCfg.bundle != ""
|
||||
then ["--bundle" "${toString builderCfg.bundle}"]
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if builderCfg.webBundle != ""
|
||||
then ["--web-bundle" "${toString builderCfg.webBundle}"]
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if builderCfg.outfmt != ""
|
||||
then ["--outfmt" "${toString builderCfg.outfmt}"]
|
||||
else []
|
||||
)
|
||||
++ (concatLists (map (x: ["--hide" x]) builderCfg.hidePaths))
|
||||
++ (
|
||||
if builderCfg.format != ""
|
||||
then ["--format" "${toString builderCfg.format}"]
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if builderCfg.color != ""
|
||||
then ["--color" "${toString builderCfg.color}"]
|
||||
else []
|
||||
)
|
||||
# Still options but these are not defined by builder specific options but
|
||||
# instead synchronize options between the global build options and builder
|
||||
# specific options
|
||||
++ (
|
||||
if !(elem cfg.build.pdfDirectory ["." ""])
|
||||
then ["--outdir" "${cfg.build.pdfDirectory}"]
|
||||
else []
|
||||
)
|
||||
);
|
||||
}
|
||||
)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
self,
|
||||
inputs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
|
|
@ -43,10 +43,10 @@
|
|||
|
||||
defaultFormat = ["prettier"];
|
||||
formats = let
|
||||
parser = "${self.packages.${pkgs.stdenv.system}.prettier-plugin-astro}/index.js";
|
||||
parser = "${inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.prettier-plugin-astro}/index.js";
|
||||
in {
|
||||
prettier = {
|
||||
command = getExe pkgs.nodePackages.prettier;
|
||||
command = getExe pkgs.prettier;
|
||||
options.ft_parsers.astro = "astro";
|
||||
prepend_args = ["--plugin=${parser}"];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ in {
|
|||
./svelte.nix
|
||||
./tailwind.nix
|
||||
./terraform.nix
|
||||
./tex
|
||||
./ts.nix
|
||||
./typst.nix
|
||||
./zig.nix
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ in {
|
|||
option, since there is no way to provide only the LSP server.
|
||||
|
||||
If you want to avoid that, you have to change
|
||||
[vim.lsp.servers.julials.cmd](#opt-vim.lsp.servers._name_.cmd) to use
|
||||
{option}`vim.lsp.servers.julials.cmd` to use
|
||||
the Julia binary in {env}`PATH`, and add the `LanguageServer`
|
||||
package to Julia in your devshells.
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.attrsets) attrNames;
|
||||
inherit (lib.types) bool package str listOf either enum;
|
||||
inherit (lib.types) bool package str listOf either enum int;
|
||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption deprecatedSingleOrListOf;
|
||||
|
|
@ -87,6 +87,19 @@ in {
|
|||
type = package;
|
||||
default = pkgs.lldb;
|
||||
};
|
||||
|
||||
adapter = mkOption {
|
||||
type = enum ["lldb-dap" "codelldb"];
|
||||
default = "codelldb";
|
||||
description = ''
|
||||
Select which LLDB-based debug adapter to use:
|
||||
|
||||
- "codelldb": use the CodeLLDB adapter from the vadimcn.vscode-lldb extension.
|
||||
- "lldb-dap": use the LLDB DAP implementation shipped with LLVM (lldb-dap).
|
||||
|
||||
The default "codelldb" backend generally provides a better debugging experience for Rust.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
extensions = {
|
||||
|
|
@ -94,19 +107,26 @@ in {
|
|||
enable = mkEnableOption "crates.io dependency management [crates-nvim]";
|
||||
|
||||
setupOpts = mkPluginSetupOption "crates-nvim" {
|
||||
completion.cmp.enable = mkOption {
|
||||
type = bool;
|
||||
default = config.vim.autocomplete.nvim-cmp.enable;
|
||||
defaultText = "{option}`config.vim.autocomplete.nvim-cmp.enable`";
|
||||
description = ''
|
||||
Whether to add crates.nvim as a source for completion plugins. The following
|
||||
plugins are supported by crates.nvim:
|
||||
|
||||
* nvim-cmp
|
||||
* coq.nvim
|
||||
|
||||
However nvf only supports auto-setup for nvim-cmp.
|
||||
'';
|
||||
lsp = {
|
||||
enabled = mkEnableOption "crates.nvim's in-process language server" // {default = cfg.extensions.crates-nvim.enable;};
|
||||
actions = mkEnableOption "actions for crates-nvim's in-process language server" // {default = cfg.extensions.crates-nvim.enable;};
|
||||
completion = mkEnableOption "completion for crates-nvim's in-process language server" // {default = cfg.extensions.crates-nvim.enable;};
|
||||
hover = mkEnableOption "hover actions for crates-nvim's in-process language server" // {default = cfg.extensions.crates-nvim.enable;};
|
||||
};
|
||||
completion = {
|
||||
crates = {
|
||||
enabled = mkEnableOption "completion for crates-nvim's in-process language server" // {default = cfg.extensions.crates-nvim.enable;};
|
||||
max_results = mkOption {
|
||||
description = "The maximum number of search results to display";
|
||||
type = int;
|
||||
default = 8;
|
||||
};
|
||||
min_chars = mkOption {
|
||||
description = "The minimum number of characters to type before completions begin appearing";
|
||||
type = int;
|
||||
default = 3;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -184,10 +204,19 @@ in {
|
|||
|
||||
${optionalString cfg.dap.enable ''
|
||||
dap = {
|
||||
adapter = {
|
||||
adapter = ${
|
||||
if cfg.dap.adapter == "lldb-dap"
|
||||
then ''
|
||||
{
|
||||
type = "executable",
|
||||
command = "${cfg.dap.package}/bin/lldb-dap",
|
||||
name = "rustacean_lldb",
|
||||
}''
|
||||
else let
|
||||
codelldb = pkgs.vscode-extensions.vadimcn.vscode-lldb.adapter;
|
||||
codelldbPath = "${codelldb}/bin/codelldb";
|
||||
liblldbPath = "${codelldb}/share/lldb/lib/liblldb.so";
|
||||
in ''require("rustaceanvim.config").get_codelldb_adapter("${codelldbPath}", "${liblldbPath}")''
|
||||
},
|
||||
},
|
||||
''}
|
||||
|
|
@ -197,25 +226,13 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.extensions.crates-nvim.enable {
|
||||
vim = let
|
||||
withCompletion = cfg.extensions.crates-nvim.setupOpts.completion.cmp.enable;
|
||||
in
|
||||
mkMerge [
|
||||
vim = mkMerge [
|
||||
{
|
||||
startPlugins = ["crates-nvim"];
|
||||
pluginRC.rust-crates = entryAnywhere ''
|
||||
require("crates").setup(${toLuaObject cfg.extensions.crates-nvim.setupOpts})
|
||||
'';
|
||||
}
|
||||
|
||||
# FIXME: this will not be necessary once crates.nvim creates a new release that
|
||||
# ships improvements to the in-progress LSP module. If updating > 0.7.1, remember
|
||||
# to update this section.
|
||||
# See:
|
||||
# <https://github.com/saecki/crates.nvim/wiki/Documentation-unstable#auto-completion>
|
||||
(mkIf withCompletion {
|
||||
autocomplete.nvim-cmp.sources = {crates = "[Crates]";};
|
||||
})
|
||||
];
|
||||
})
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
self,
|
||||
inputs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
defaultFormat = ["prettier"];
|
||||
formats = let
|
||||
prettierPlugin = self.packages.${pkgs.stdenv.system}.prettier-plugin-svelte;
|
||||
prettierPlugin = inputs.self.packages.${pkgs.stdenv.system}.prettier-plugin-svelte;
|
||||
prettierPluginPath = "${prettierPlugin}/lib/node_modules/prettier-plugin-svelte/plugin.js";
|
||||
in {
|
||||
prettier = {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
# This function acts as a template for creating new builders.
|
||||
# It enforces providing all the parameters required for creating
|
||||
# a new builder for it to be able to work in the existing code.
|
||||
#
|
||||
# The first layer requirements are as follows:
|
||||
{
|
||||
# This is the name of the builder, it will only be used internally and
|
||||
# should match the <name>.nix file that the builder is implemented in.
|
||||
name,
|
||||
#
|
||||
# Module attribute set. This is the attribute set that the module that is
|
||||
# defining a builder is passed as its input.
|
||||
moduleInheritancePackage,
|
||||
#
|
||||
# These are the standard options for the builder 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 build command is called.
|
||||
# This is a function that will take in the cfg of its own builder.
|
||||
# i.e. will be called as "args cfg.build.builders.${name}"
|
||||
args,
|
||||
...
|
||||
}: 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;
|
||||
in {
|
||||
# These are the options for the builder. It will accept any options
|
||||
# provided to it but some options are mandatory:
|
||||
options.vim.languages.tex.build.builders.${name} = ({
|
||||
# The enable option. This one is self explanatory.
|
||||
enable,
|
||||
#
|
||||
# This is the package option for the builder.
|
||||
package,
|
||||
#
|
||||
# This is the executable that will be used to call the builder.
|
||||
# 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 builder have been enabled
|
||||
# before making any config.
|
||||
config = mkIf (cfg.enable && cfg.build.builders.${name}.enable) {
|
||||
vim.languages.tex.build.builder = {
|
||||
inherit name;
|
||||
package = cfg.build.builders.${name}.package;
|
||||
executable = cfg.build.builders.${name}.executable;
|
||||
args = args cfg.build.builders.${name};
|
||||
};
|
||||
};
|
||||
}
|
||||
69
modules/plugins/languages/tex/build/builders/default.nix
Normal file
69
modules/plugins/languages/tex/build/builders/default.nix
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) enum listOf package str;
|
||||
inherit (builtins) attrNames;
|
||||
|
||||
cfg = config.vim.languages.tex;
|
||||
in {
|
||||
imports = [
|
||||
./latexmk.nix
|
||||
./tectonic.nix
|
||||
];
|
||||
|
||||
options.vim.languages.tex.build.builder = {
|
||||
name = mkOption {
|
||||
type = enum (attrNames cfg.build.builders);
|
||||
default = "latexmk";
|
||||
description = ''
|
||||
The tex builder to use.
|
||||
|
||||
This is just the default custom option. By setting any of the
|
||||
builders to true, this will be overwritten by that builder's
|
||||
parameters.
|
||||
Setting this parameter to the name of a declared builder will
|
||||
not automatically enable that builder.
|
||||
'';
|
||||
};
|
||||
args = mkOption {
|
||||
type = listOf str;
|
||||
default = [
|
||||
"-pdf"
|
||||
"%f"
|
||||
];
|
||||
description = ''
|
||||
The list of args to pass to the builder.
|
||||
|
||||
This is just the default custom option. By setting any of the
|
||||
builders to true, this will be overwritten by that builder's
|
||||
parameters.
|
||||
'';
|
||||
};
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = pkgs.texlive.withPackages (ps: [ps.latexmk]);
|
||||
description = ''
|
||||
The tex builder package to use.
|
||||
|
||||
This is just the default custom option. By setting any of the
|
||||
builders to true, this will be overwritten by that builder's
|
||||
parameters.
|
||||
'';
|
||||
};
|
||||
executable = mkOption {
|
||||
type = str;
|
||||
default = "latexmk";
|
||||
description = ''
|
||||
The tex builder executable to use.
|
||||
|
||||
This is just the default custom option. By setting any of the
|
||||
builders to true, this will be overwritten by that builder's
|
||||
parameters.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
59
modules/plugins/languages/tex/build/builders/latexmk.nix
Normal file
59
modules/plugins/languages/tex/build/builders/latexmk.nix
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
# TODO: I need testing.
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
} @ moduleInheritancePackage: let
|
||||
# The name of the builder
|
||||
name = "latexmk";
|
||||
|
||||
# The builder template
|
||||
template = import ./builderTemplate.nix;
|
||||
|
||||
inherit (lib) optionals;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) bool package str;
|
||||
in (
|
||||
template {
|
||||
inherit name moduleInheritancePackage;
|
||||
|
||||
options = {
|
||||
enable = mkEnableOption "Tex Compilation Via latexmk";
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = pkgs.texlive.withPackages (ps: [ps.latexmk]);
|
||||
description = "latexmk package";
|
||||
};
|
||||
|
||||
executable = mkOption {
|
||||
type = str;
|
||||
default = "latexmk";
|
||||
description = ''
|
||||
The executable name from the build package that will be used to
|
||||
build/compile the tex.
|
||||
'';
|
||||
};
|
||||
|
||||
# Flag options
|
||||
pdfOutput = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
example = false;
|
||||
description = "Insure the output file is a pdf.";
|
||||
};
|
||||
};
|
||||
|
||||
# Optional flags must come before the base args because of how the latexmk
|
||||
# command works
|
||||
args = builderCfg: (
|
||||
# Flags
|
||||
(optionals builderCfg.pdfOutput ["-pdf"])
|
||||
# Base args
|
||||
++ [
|
||||
"-quiet"
|
||||
"%f"
|
||||
]
|
||||
);
|
||||
}
|
||||
)
|
||||
229
modules/plugins/languages/tex/build/builders/tectonic.nix
Normal file
229
modules/plugins/languages/tex/build/builders/tectonic.nix
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
} @ moduleInheritancePackage: let
|
||||
# The name of the builder
|
||||
name = "tectonic";
|
||||
|
||||
# The builder template
|
||||
template = import ./builderTemplate.nix;
|
||||
|
||||
inherit (lib) optionals;
|
||||
inherit (lib.options) mkOption mkEnableOption mkPackageOption;
|
||||
inherit (lib.types) enum ints listOf str nullOr;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
inherit (builtins) concatLists elem map toString attrNames filter isList;
|
||||
|
||||
notNull = x: x != null;
|
||||
forceCheck = x: true;
|
||||
toList = x:
|
||||
if isList x
|
||||
then x
|
||||
else [x];
|
||||
|
||||
cfg = config.vim.languages.tex;
|
||||
in (
|
||||
template {
|
||||
inherit name moduleInheritancePackage;
|
||||
|
||||
options = {
|
||||
enable = mkEnableOption "Tex Compilation Via Tectonic";
|
||||
|
||||
package = mkPackageOption pkgs "tectonic" {};
|
||||
|
||||
executable = mkOption {
|
||||
type = str;
|
||||
default = "tectonic";
|
||||
description = ''
|
||||
The executable name from the build package that will be used to
|
||||
build/compile the tex.
|
||||
'';
|
||||
};
|
||||
|
||||
# -- Flags --
|
||||
keepIntermediates = mkBool false ''
|
||||
Whether to keep the intermediate files generated during processing.
|
||||
|
||||
If texlab is reporting build errors when there shouldn't be, disable
|
||||
this option.
|
||||
'';
|
||||
keepLogs = mkBool true ''
|
||||
Whether to keep the log files generated during processing.
|
||||
|
||||
Without the keepLogs flag, texlab won't be able to report compilation
|
||||
warnings.
|
||||
'';
|
||||
onlyCached = mkBool false ''
|
||||
Whether to use only resource files cached locally
|
||||
'';
|
||||
synctex = mkBool true "Whether to generate SyncTeX data";
|
||||
untrustedInput = mkBool false ''
|
||||
Whether to disable all known-insecure features if the input is untrusted
|
||||
'';
|
||||
|
||||
# -- Options --
|
||||
reruns = mkOption {
|
||||
type = ints.unsigned;
|
||||
default = 0;
|
||||
example = 2;
|
||||
description = ''
|
||||
How many times to *rerun* the TeX build engine.
|
||||
The build engine (if a builder is enabled) will always run at least
|
||||
once.
|
||||
|
||||
Setting this value to 0 will disable setting this option.
|
||||
'';
|
||||
};
|
||||
|
||||
bundle = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
The directory or Zip-format bundle file to find resource files instead
|
||||
of the default.
|
||||
'';
|
||||
};
|
||||
|
||||
webBundle = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Use this URL to find resource files instead of the default.
|
||||
'';
|
||||
};
|
||||
|
||||
outfmt = mkOption {
|
||||
type = nullOr (enum [
|
||||
"pdf"
|
||||
"html"
|
||||
"xdv"
|
||||
"aux"
|
||||
"fmt"
|
||||
]);
|
||||
default = null;
|
||||
description = ''
|
||||
The kind of output to generate.
|
||||
|
||||
Setting this to `null` (default) will let tectonic decide the most
|
||||
appropriate output format, which usually be a pdf.
|
||||
'';
|
||||
};
|
||||
|
||||
hidePaths = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
example = [
|
||||
"./secrets.tex"
|
||||
"./passwords.tex"
|
||||
];
|
||||
description = ''
|
||||
Tell the engine that no file at `<path/to/hide>` exists, if it tries
|
||||
to read it.
|
||||
'';
|
||||
};
|
||||
|
||||
format = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
The name of the \"format\" file used to initialize the TeX engine.
|
||||
'';
|
||||
};
|
||||
|
||||
color = mkOption {
|
||||
type = nullOr (enum [
|
||||
"always"
|
||||
"auto"
|
||||
"never"
|
||||
]);
|
||||
default = null;
|
||||
example = "always";
|
||||
description = "Enable/disable colorful log output";
|
||||
};
|
||||
|
||||
extraOptions = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
Add extra command line options to include in the tectonic build
|
||||
command.
|
||||
Extra options added here will not overwrite the options set in as nvf
|
||||
options.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# args = builderCfg: (
|
||||
# # Base args
|
||||
# [
|
||||
# "-X"
|
||||
# "compile"
|
||||
# "%f"
|
||||
# ]
|
||||
# # Flags
|
||||
# ++ (optionals builderCfg.keepIntermediates ["--keep-intermediates"])
|
||||
# ++ (optionals builderCfg.keepLogs ["--keep-logs"])
|
||||
# ++ (optionals builderCfg.onlyCached ["--only-cached"])
|
||||
# ++ (optionals builderCfg.synctex ["--synctex"])
|
||||
# ++ (optionals builderCfg.untrustedInput ["--untrusted"])
|
||||
# # Options
|
||||
# ++ (optionals (builderCfg.reruns > 0) ["--reruns" "${toString builderCfg.reruns}"])
|
||||
# ++ (optionals (builderCfg.bundle != null) ["--bundle" "${toString builderCfg.bundle}"])
|
||||
# ++ (optionals (builderCfg.webBundle != null) ["--web-bundle" "${toString builderCfg.webBundle}"])
|
||||
# ++ (optionals (builderCfg.outfmt != null) ["--outfmt" "${toString builderCfg.outfmt}"])
|
||||
# ++ (concatLists (map (x: ["--hide" x]) builderCfg.hidePaths))
|
||||
# ++ (optionals (builderCfg.format != null) ["--format" "${toString builderCfg.format}"])
|
||||
# ++ (optionals (builderCfg.color != null) ["--color" "${toString builderCfg.color}"])
|
||||
# # Still options but these are not defined by builder specific options but
|
||||
# # instead synchronize options between the global build options and builder
|
||||
# # specific options
|
||||
# ++ (optionals (!(elem cfg.build.pdfDirectory ["." ""])) ["--outdir" "${cfg.build.pdfDirectory}"])
|
||||
# );
|
||||
|
||||
args = builderCfg: let
|
||||
option = setCheck: flag: {inherit setCheck flag;};
|
||||
args = {
|
||||
baseArgs = ["-X" "compile" "%f"];
|
||||
|
||||
flags = {
|
||||
keepIntermediates = "--keep-intermediates";
|
||||
keepLogs = "--keep-logs";
|
||||
onlyCached = "--only-cached";
|
||||
synctex = "--synctex";
|
||||
untrustedInput = "--untrusted";
|
||||
};
|
||||
|
||||
options = {
|
||||
reruns = option (x: x > 0) "--reruns";
|
||||
bundle = option notNull "--bundle";
|
||||
webBundle = option notNull "--web-bundle";
|
||||
outfmt = option notNull "--outfmt";
|
||||
format = option notNull "--format";
|
||||
color = option notNull "--color";
|
||||
hidePaths = option forceCheck "--hide";
|
||||
};
|
||||
|
||||
externalOptions = concatLists [
|
||||
(optionals (!(elem cfg.build.pdfDirectory ["." ""])) ["--outdir" "${cfg.build.pdfDirectory}"])
|
||||
];
|
||||
};
|
||||
|
||||
flags = map (flag: args.flags.${flag}) (filter (flag: builderCfg.${flag}) (attrNames args.flags));
|
||||
options = let
|
||||
getOptionFlagsList = opt:
|
||||
concatLists (
|
||||
map
|
||||
(y: [args.options."${opt}".flag "${toString y}"])
|
||||
(toList builderCfg."${opt}")
|
||||
);
|
||||
processOption = opt:
|
||||
optionals
|
||||
(args.options."${opt}".setCheck builderCfg."${opt}")
|
||||
(getOptionFlagsList opt);
|
||||
in (concatLists (map processOption (attrNames args.options)));
|
||||
in
|
||||
concatLists (with args; [baseArgs flags options externalOptions]);
|
||||
}
|
||||
)
|
||||
140
modules/plugins/languages/tex/build/default.nix
Normal file
140
modules/plugins/languages/tex/build/default.nix
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) filter isAttrs hasAttr attrNames length elemAt;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) str nullOr;
|
||||
|
||||
cfg = config.vim.languages.tex;
|
||||
|
||||
enabledBuildersCount = let
|
||||
# This function will sort through the builder options and count how many
|
||||
# builders have been enabled.
|
||||
getEnabledBuildersCount = {
|
||||
enabledBuildersCount ? 0,
|
||||
index ? 0,
|
||||
builderNamesList ? (
|
||||
filter (
|
||||
x: let
|
||||
y = cfg.build.builders.${x};
|
||||
in (isAttrs y && hasAttr "enable" y)
|
||||
) (attrNames cfg.build.builders)
|
||||
),
|
||||
}: let
|
||||
currentBuilderName = elemAt builderNamesList index;
|
||||
currentBuilder = cfg.build.builders.${currentBuilderName};
|
||||
nextIndex = index + 1;
|
||||
newEnabledBuildersCount =
|
||||
if currentBuilder.enable
|
||||
then enabledBuildersCount + 1
|
||||
else enabledBuildersCount;
|
||||
in
|
||||
if length builderNamesList > nextIndex
|
||||
then
|
||||
getEnabledBuildersCount {
|
||||
inherit builderNamesList;
|
||||
enabledBuildersCount = newEnabledBuildersCount;
|
||||
index = nextIndex;
|
||||
}
|
||||
else newEnabledBuildersCount;
|
||||
in (getEnabledBuildersCount {});
|
||||
in {
|
||||
imports = [
|
||||
./builders
|
||||
];
|
||||
|
||||
options.vim.languages.tex.build = {
|
||||
enable = mkBool (enabledBuildersCount == 1) ''
|
||||
Whether to enable configuring the builder.
|
||||
|
||||
By enabling any of the builders, this option will be automatically set.
|
||||
If you enable more than one builder then an error will be thrown.
|
||||
'';
|
||||
|
||||
forwardSearchAfter = mkBool false ''
|
||||
Set this property to `true` if you want to execute a forward search after
|
||||
a build.
|
||||
|
||||
This can also be thought of as enabling auto updating for your pdf viewer.
|
||||
'';
|
||||
|
||||
onSave = mkBool false ''
|
||||
Set this property to `true` if you want to compile the project after
|
||||
saving a file.
|
||||
'';
|
||||
|
||||
useFileList = mkBool false ''
|
||||
When set to `true`, the server will use the `.fls` files produced by the
|
||||
TeX engine as an additional input for the project detection.
|
||||
|
||||
Note that enabling this property might have an impact on performance.
|
||||
'';
|
||||
|
||||
auxDirectory = mkOption {
|
||||
type = str;
|
||||
default = ".";
|
||||
description = ''
|
||||
When not using latexmk, provides a way to define the directory
|
||||
containing the `.aux` files.
|
||||
Note that you need to set the aux directory in `latex.build.args` too.
|
||||
|
||||
When using a latexmkrc file, texlab will automatically infer the correct
|
||||
setting.
|
||||
'';
|
||||
};
|
||||
|
||||
logDirectory = mkOption {
|
||||
type = str;
|
||||
default = ".";
|
||||
description = ''
|
||||
When not using latexmk, provides a way to define the directory
|
||||
containing the build log files.
|
||||
Note that you need to change the output directory in your build
|
||||
arguments too.
|
||||
|
||||
When using a latexmkrc file, texlab will automatically infer the correct
|
||||
setting.
|
||||
'';
|
||||
};
|
||||
|
||||
pdfDirectory = mkOption {
|
||||
type = str;
|
||||
default = ".";
|
||||
description = ''
|
||||
When not using latexmk, provides a way to define the directory
|
||||
containing the output files.
|
||||
Note that you need to set the output directory in `latex.build.args`
|
||||
too.
|
||||
|
||||
When using a latexmkrc file, texlab will automatically infer the correct
|
||||
setting.
|
||||
'';
|
||||
};
|
||||
|
||||
filename = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Allows overriding the default file name of the build artifact.
|
||||
This setting is used to find the correct PDF file to open during forward
|
||||
search.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (enabledBuildersCount > 0) {
|
||||
assertions = [
|
||||
{
|
||||
assertion = enabledBuildersCount < 2;
|
||||
message = ''
|
||||
The nvf-tex-language implementation does not support having more than
|
||||
1 builders enabled.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
78
modules/plugins/languages/tex/default.nix
Normal file
78
modules/plugins/languages/tex/default.nix
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) enum;
|
||||
|
||||
cfg = config.vim.languages.tex;
|
||||
in {
|
||||
imports = [
|
||||
./build
|
||||
./lsp
|
||||
./pdfViewer
|
||||
./treesitter.nix
|
||||
];
|
||||
|
||||
options.vim.languages.tex = {
|
||||
enable = mkEnableOption "Tex support";
|
||||
|
||||
extraOpts = {
|
||||
texFlavor = {
|
||||
enable = mkBool false ''
|
||||
Whether to set the `vim.g.tex_flavor` (`g:tex_flavor`) option in
|
||||
your Lua config.
|
||||
|
||||
When opening a `.tex` file vim will try to automatically try to
|
||||
determine the file type from the three options: `plaintex` (for
|
||||
plain TeX), `context` (for ConTeXt), or `tex` (for LaTeX).
|
||||
This can either be done by a indicator line of the form `%&<format>`
|
||||
on the first line or, if absent, vim will search the file for
|
||||
keywords to try and determine the filetype. If no filetype can be
|
||||
determined automatically then by default it will fallback to
|
||||
plaintex.
|
||||
|
||||
This option will enable setting the tex flavor in your lua config
|
||||
and you can set its value using the
|
||||
`vim.languages.tex.lsp.extraOpts.texFlavor.flavor = <flavor>` in
|
||||
your nvf config.
|
||||
|
||||
Setting this option to `false` will omit the
|
||||
`vim.g.tex_flavor = <flavor>` line from your lua config entirely
|
||||
(unless you manually set it elsewhere of course).
|
||||
'';
|
||||
|
||||
flavor = mkOption {
|
||||
type = enum [
|
||||
"plaintex"
|
||||
"context"
|
||||
"tex"
|
||||
];
|
||||
default = "plaintex";
|
||||
example = "tex";
|
||||
description = ''
|
||||
The flavor to set as a fallback for when vim cannot automatically
|
||||
determine the tex flavor when opening a `.tex` document.
|
||||
|
||||
The options are: `plaintex` (for plain TeX), `context` (for
|
||||
ConTeXt), or `tex` (for LaTeX).
|
||||
|
||||
This can be particularly useful for when using
|
||||
`vim.utility.new-file-template` options for creating templates when
|
||||
no context has yet been added to a new file.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
# Extra Lua config options
|
||||
(mkIf cfg.extraOpts.texFlavor.enable {
|
||||
vim.globals.tex_flavor = lib.mkDefault "${cfg.extraOpts.texFlavor.flavor}";
|
||||
})
|
||||
]);
|
||||
}
|
||||
24
modules/plugins/languages/tex/lsp/default.nix
Normal file
24
modules/plugins/languages/tex/lsp/default.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (builtins) any attrValues;
|
||||
|
||||
cfg = config.vim.languages.tex;
|
||||
in {
|
||||
imports = [
|
||||
./texlab.nix
|
||||
];
|
||||
|
||||
config =
|
||||
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
|
||||
};
|
||||
}
|
||||
598
modules/plugins/languages/tex/lsp/texlab.nix
Normal file
598
modules/plugins/languages/tex/lsp/texlab.nix
Normal file
|
|
@ -0,0 +1,598 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) isString map;
|
||||
inherit (lib) optionalAttrs;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
inherit (lib.options) mkOption mkPackageOption;
|
||||
inherit
|
||||
(lib.types)
|
||||
attrs
|
||||
either
|
||||
enum
|
||||
ints
|
||||
listOf
|
||||
nullOr
|
||||
package
|
||||
path
|
||||
str
|
||||
submodule
|
||||
;
|
||||
|
||||
cfg = config.vim.languages.tex;
|
||||
texlabCfg = cfg.lsp.texlab;
|
||||
builderCfg = cfg.build.builder;
|
||||
|
||||
# Get the enabled pdf viewer.
|
||||
pdfViewer = import ../pdfViewer/getEnabledPdfViewer.nix {inherit lib config;};
|
||||
in {
|
||||
options.vim.languages.tex.lsp.texlab = {
|
||||
enable = mkBool config.vim.lsp.enable ''
|
||||
Whether to enable Tex LSP support (texlab).
|
||||
'';
|
||||
|
||||
package = mkPackageOption pkgs "texlab" {};
|
||||
|
||||
chktex = {
|
||||
enable = mkBool false "Whether to enable linting via chktex";
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = pkgs.texlive.withPackages (ps: [ps.chktex]);
|
||||
description = ''
|
||||
The chktex package to use.
|
||||
Must have the `chktex` executable.
|
||||
'';
|
||||
};
|
||||
|
||||
onOpenAndSave = mkBool false ''
|
||||
Lint using chktex after opening and saving a file.
|
||||
'';
|
||||
|
||||
onEdit = mkBool false "Lint using chktex after editing a file.";
|
||||
|
||||
additionalArgs = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
Additional command line arguments that are passed to chktex after
|
||||
editing a file.
|
||||
Don't redefine the `-I` and `-f` flags as they are set by the server.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
completion.matcher = mkOption {
|
||||
type = enum [
|
||||
"fuzzy"
|
||||
"fuzzy-ignore-case"
|
||||
"prefix"
|
||||
"prefix-ignore-case"
|
||||
];
|
||||
default = "fuzzy-ignore-case";
|
||||
description = ''
|
||||
Modifies the algorithm used to filter the completion items returned to
|
||||
the client.
|
||||
Possibles values are:
|
||||
- `fuzzy`: Fuzzy string matching (case sensitive).
|
||||
- `fuzzy-ignore-case`: Fuzzy string matching (case insensitive).
|
||||
- `prefix`: Filter out items that do not start with the search text
|
||||
(case sensitive).
|
||||
- `prefix-ignore-case`: Filter out items that do not start with the
|
||||
search text (case insensitive).
|
||||
'';
|
||||
};
|
||||
|
||||
diagnostics = {
|
||||
delay = mkOption {
|
||||
type = ints.positive;
|
||||
default = 300;
|
||||
description = "Delay in milliseconds before reporting diagnostics.";
|
||||
};
|
||||
|
||||
allowedPatterns = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
A list of regular expressions used to filter the list of reported
|
||||
diagnostics.
|
||||
If specified, only diagnostics that match at least one of the
|
||||
specified patterns are sent to the client.
|
||||
|
||||
See also `texlab.diagnostics.ignoredPatterns`.
|
||||
|
||||
Hint: If both allowedPatterns and ignoredPatterns are set, then
|
||||
allowed patterns are applied first. Afterwards, the results are
|
||||
filtered with the ignored patterns.
|
||||
'';
|
||||
};
|
||||
|
||||
ignoredPatterns = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
A list of regular expressions used to filter the list of reported
|
||||
diagnostics.
|
||||
If specified, only diagnostics that match none of the specified
|
||||
patterns are sent to the client.
|
||||
|
||||
See also `texlab.diagnostics.allowedPatterns`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
experimental = {
|
||||
followPackageLinks = mkBool false ''
|
||||
If set to `true`, dependencies of custom packages are resolved and
|
||||
included in the dependency graph.
|
||||
'';
|
||||
|
||||
mathEnvironments = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
Allows extending the list of environments which the server considers
|
||||
as math environments (for example `align*` or `equation`).
|
||||
'';
|
||||
};
|
||||
|
||||
enumEnvironments = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
Allows extending the list of environments which the server considers
|
||||
as enumeration environments (for example `enumerate` or `itemize`).
|
||||
'';
|
||||
};
|
||||
|
||||
verbatimEnvironments = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
Allows extending the list of environments which the server considers
|
||||
as verbatim environments (for example `minted` or `lstlisting`).
|
||||
This can be used to suppress diagnostics from environments that do
|
||||
not contain LaTeX code.
|
||||
'';
|
||||
};
|
||||
|
||||
citationCommands = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
Allows extending the list of commands which the server considers as
|
||||
citation commands (for example `\cite`).
|
||||
|
||||
Hint: Additional commands need to be written without a leading `\`
|
||||
(e.g. `foo` instead of `\foo`).
|
||||
'';
|
||||
};
|
||||
|
||||
labelDefinitionCommands = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
Allows extending the list of `\label`-like commands.
|
||||
|
||||
Hint: Additional commands need to be written without a leading `\`
|
||||
(e.g. `foo` instead of `\foo`).
|
||||
'';
|
||||
};
|
||||
|
||||
labelReferenceCommands = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
Allows extending the list of `\ref`-like commands.
|
||||
|
||||
Hint: Additional commands need to be written without a leading `\`
|
||||
(e.g. `foo` instead of `\foo`).
|
||||
'';
|
||||
};
|
||||
|
||||
labelReferenceRangeCommands = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
Allows extending the list of `\crefrange`-like commands.
|
||||
|
||||
Hint: Additional commands need to be written without a leading `\`
|
||||
(e.g. `foo` instead of `\foo`).
|
||||
'';
|
||||
};
|
||||
|
||||
labelDefinitionPrefixes = mkOption {
|
||||
type = listOf (listOf str);
|
||||
default = [];
|
||||
description = ''
|
||||
Allows associating a label definition command with a custom prefix.
|
||||
Consider,
|
||||
```
|
||||
\newcommand{\theorem}[1]{\label{theorem:#1}}
|
||||
\theorem{foo}
|
||||
```
|
||||
Then setting `texlab.experimental.labelDefinitionPrefixes` to
|
||||
`[["theorem", "theorem:"]]` and adding `theorem` to
|
||||
`texlab.experimental.labelDefinitionCommands` will make the server
|
||||
recognize the `theorem:foo` label.
|
||||
'';
|
||||
};
|
||||
|
||||
labelReferencePrefixes = mkOption {
|
||||
type = listOf (listOf str);
|
||||
default = [];
|
||||
description = ''
|
||||
Allows associating a label reference command with a custom prefix.
|
||||
See `texlab.experimental.labelDefinitionPrefixes` for more details.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
extraLuaSettings = mkOption {
|
||||
type = attrs;
|
||||
default = {};
|
||||
example = {
|
||||
foo = "bar";
|
||||
baz = 314;
|
||||
};
|
||||
description = ''
|
||||
For any options that do not have options provided through nvf this can
|
||||
be used to add them.
|
||||
Options already declared in nvf config will NOT be overridden.
|
||||
|
||||
Options will be placed in:
|
||||
```
|
||||
lspconfig.texlab.setup {
|
||||
settings = {
|
||||
texlab = {
|
||||
...
|
||||
<nvf defined options>
|
||||
...
|
||||
<extraLuaSettings>
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
||||
forwardSearch = {
|
||||
enable = mkBool false ''
|
||||
Whether to enable forward search.
|
||||
|
||||
Enable this option if you want to have the compiled document appear in
|
||||
your chosen PDF viewer.
|
||||
|
||||
For some options see [here](https://github.com/latex-lsp/texlab/wiki/Previewing).
|
||||
Note this is not all the options, but can act as a guide to help you
|
||||
along with custom configs.
|
||||
'';
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = pdfViewer.package;
|
||||
description = ''
|
||||
The package to use as your PDF viewer.
|
||||
This viewer needs to support Synctex.
|
||||
|
||||
By default it is set to the package of the pdfViewer option.
|
||||
'';
|
||||
};
|
||||
|
||||
executable = mkOption {
|
||||
type = str;
|
||||
default = pdfViewer.executable;
|
||||
description = ''
|
||||
Defines the executable of the PDF previewer. The previewer needs to
|
||||
support SyncTeX.
|
||||
|
||||
By default it is set to the executable of the pdfViewer option.
|
||||
'';
|
||||
};
|
||||
|
||||
args = mkOption {
|
||||
type = listOf str;
|
||||
default = pdfViewer.args;
|
||||
description = ''
|
||||
Defines additional arguments that are passed to the configured
|
||||
previewer to perform the forward search.
|
||||
The placeholders `%f`, `%p`, `%l` will be replaced by the server.
|
||||
|
||||
By default it is set to the args of the pdfViewer option.
|
||||
|
||||
Placeholders:
|
||||
- `%f`: The path of the current TeX file.
|
||||
- `%p`: The path of the current PDF file.
|
||||
- `%l`: The current line number.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
formatter = {
|
||||
formatterLineLength = mkOption {
|
||||
type = ints.unsigned;
|
||||
default = 80;
|
||||
description = ''
|
||||
Defines the maximum amount of characters per line when formatting
|
||||
BibTeX files.
|
||||
|
||||
Setting this value to 0 will disable this option.
|
||||
'';
|
||||
};
|
||||
|
||||
bibtexFormatter = mkOption {
|
||||
type = enum [
|
||||
"texlab"
|
||||
"latexindent"
|
||||
];
|
||||
default = "texlab";
|
||||
description = ''
|
||||
Defines the formatter to use for BibTeX formatting.
|
||||
Possible values are either texlab or latexindent.
|
||||
'';
|
||||
};
|
||||
|
||||
latexFormatter = mkOption {
|
||||
type = enum [
|
||||
"texlab"
|
||||
"latexindent"
|
||||
];
|
||||
default = "latexindent";
|
||||
description = ''
|
||||
Defines the formatter to use for LaTeX formatting.
|
||||
Possible values are either texlab or latexindent.
|
||||
Note that texlab is not implemented yet.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
inlayHints = {
|
||||
labelDefinitions = mkBool true ''
|
||||
When enabled, the server will return inlay hints for `\label`-like
|
||||
commands.
|
||||
'';
|
||||
|
||||
labelReferences = mkBool true ''
|
||||
When enabled, the server will return inlay hints for `\ref`-like
|
||||
commands.
|
||||
'';
|
||||
|
||||
maxLength = mkOption {
|
||||
type = nullOr ints.positive;
|
||||
default = null;
|
||||
description = ''
|
||||
When set, the server will truncate the text of the inlay hints to the
|
||||
specified length.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
latexindent = {
|
||||
local = mkOption {
|
||||
type = nullOr (either str path);
|
||||
default = null;
|
||||
description = ''
|
||||
Defines the path of a file containing the latexindent configuration.
|
||||
This corresponds to the `--local=file.yaml` flag of latexindent.
|
||||
By default the configuration inside the project root directory is
|
||||
used.
|
||||
'';
|
||||
};
|
||||
|
||||
modifyLineBreaks = mkBool false ''
|
||||
Modifies linebreaks before, during, and at the end of code blocks when
|
||||
formatting with latexindent.
|
||||
This corresponds to the `--modifylinebreaks` flag of latexindent.
|
||||
'';
|
||||
|
||||
replacement = mkOption {
|
||||
type = nullOr (enum [
|
||||
"-r"
|
||||
"-rv"
|
||||
"-rr"
|
||||
]);
|
||||
default = null;
|
||||
description = ''
|
||||
Defines an additional replacement flag that is added when calling
|
||||
latexindent.
|
||||
This can be one of the following:
|
||||
- `-r`
|
||||
- `-rv`
|
||||
- `-rr`
|
||||
- `null`
|
||||
By default no replacement flag is passed.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
symbols = {
|
||||
enable = mkBool false "Whether to enable setting symbols config.";
|
||||
|
||||
allowedPatterns = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
A list of regular expressions used to filter the list of reported
|
||||
document symbols.
|
||||
If specified, only symbols that match at least one of the specified
|
||||
patterns are sent to the client.
|
||||
Symbols are filtered recursively so nested symbols can still be sent
|
||||
to the client even though the parent node is removed from the results.
|
||||
|
||||
See also `texlab.symbols.ignoredPatterns`.
|
||||
|
||||
Hint: If both `allowedPatterns` and `ignoredPatterns` are set, then
|
||||
allowed patterns are applied first. Afterwards, the results are
|
||||
filtered with the ignored patterns.
|
||||
'';
|
||||
};
|
||||
|
||||
ignoredPatterns = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
A list of regular expressions used to filter the list of reported
|
||||
document symbols.
|
||||
If specified, only symbols that match none of the specified patterns
|
||||
are sent to the client.
|
||||
|
||||
See also `texlab.symbols.allowedPatterns`.
|
||||
'';
|
||||
};
|
||||
|
||||
customEnvironments = mkOption {
|
||||
type = listOf (submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = str;
|
||||
description = "The name of the environment.";
|
||||
};
|
||||
displayName = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
The name shown in the document symbols.
|
||||
Defaults to the value of `name`.
|
||||
'';
|
||||
};
|
||||
label = mkBool false ''
|
||||
If set to `true`, the server will try to match a label to
|
||||
environment and append its number.
|
||||
'';
|
||||
};
|
||||
});
|
||||
default = [];
|
||||
example = [
|
||||
{
|
||||
name = "foo";
|
||||
displayName = "bar";
|
||||
label = false;
|
||||
}
|
||||
];
|
||||
description = ''
|
||||
A list of objects that allows extending the list of environments that
|
||||
are part of the document symbols.
|
||||
|
||||
See also `texlab.symbols.allowedPatterns`.
|
||||
|
||||
Type: listOf submodule:
|
||||
- name:
|
||||
- type: str
|
||||
- description: The name of the environment.
|
||||
- required
|
||||
- displayName:
|
||||
- type: nullOr str
|
||||
- description: The name shown in the document symbols.
|
||||
- default: <name>
|
||||
- label:
|
||||
- type: boolean
|
||||
- description: If set, the server will try to match a label to
|
||||
environment and append its number.
|
||||
- default: false
|
||||
|
||||
Note: This functionality may not be working, please follow
|
||||
https://github.com/latex-lsp/texlab/pull/1311 for status updates.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (
|
||||
let
|
||||
# ----- Setup Config -----
|
||||
# Command to start the LSP
|
||||
setupConfig.cmd = ["${texlabCfg.package}/bin/texlab"];
|
||||
|
||||
# Create texlab settings section
|
||||
setupConfig.settings.texlab = (
|
||||
{
|
||||
# -- Completion --
|
||||
completion.matcher = texlabCfg.completion.matcher;
|
||||
|
||||
# -- Diagnostics --
|
||||
diagnosticsDelay = texlabCfg.diagnostics.delay;
|
||||
diagnostics = {
|
||||
inherit (texlabCfg.diagnostics) allowedPatterns ignoredPatterns;
|
||||
};
|
||||
|
||||
# -- Experimental --
|
||||
experimental = texlabCfg.experimental;
|
||||
|
||||
# -- Formatters --
|
||||
inherit (texlabCfg.formatter) formatterLineLength bibtexFormatter latexFormatter;
|
||||
|
||||
# -- Inlay Hints --
|
||||
inlayHints = texlabCfg.inlayHints;
|
||||
|
||||
# -- Latex Indent --
|
||||
latexindent = texlabCfg.latexindent;
|
||||
}
|
||||
#
|
||||
# -- Build --
|
||||
// (optionalAttrs cfg.build.enable {
|
||||
build = {
|
||||
inherit
|
||||
(cfg.build)
|
||||
onSave
|
||||
useFileList
|
||||
auxDirectory
|
||||
logDirectory
|
||||
pdfDirectory
|
||||
filename
|
||||
forwardSearchAfter
|
||||
;
|
||||
inherit (builderCfg) args;
|
||||
executable = "${builderCfg.package}/bin/${builderCfg.executable}";
|
||||
};
|
||||
})
|
||||
#
|
||||
# -- Chktex --
|
||||
// (optionalAttrs texlabCfg.chktex.enable {
|
||||
chktex = {
|
||||
inherit (texlabCfg.chktex) onOpenAndSave onEdit additionalArgs;
|
||||
};
|
||||
})
|
||||
#
|
||||
# -- Forward Search --
|
||||
// (optionalAttrs texlabCfg.forwardSearch.enable {
|
||||
forwardSearch = {
|
||||
inherit (texlabCfg.forwardSearch) args;
|
||||
executable = "${texlabCfg.forwardSearch.package}/bin/${texlabCfg.forwardSearch.executable}";
|
||||
};
|
||||
})
|
||||
#
|
||||
# -- Symbols --
|
||||
// (optionalAttrs texlabCfg.symbols.enable {
|
||||
symbols = {
|
||||
inherit (texlabCfg.symbols) allowedPatterns ignoredPatterns;
|
||||
|
||||
customEnvironments =
|
||||
map (x: {
|
||||
inherit (x) name label;
|
||||
displayName =
|
||||
if isString x.displayName
|
||||
then x.displayName
|
||||
else x.name;
|
||||
})
|
||||
texlabCfg.symbols.customEnvironments;
|
||||
};
|
||||
})
|
||||
#
|
||||
# -- Extra Settings --
|
||||
// texlabCfg.extraLuaSettings
|
||||
);
|
||||
in (mkMerge [
|
||||
(mkIf texlabCfg.enable {
|
||||
vim.lsp.lspconfig.sources.texlab = "lspconfig.texlab.setup(${lib.nvim.lua.toLuaObject setupConfig})";
|
||||
})
|
||||
|
||||
(mkIf texlabCfg.chktex.enable {
|
||||
vim.extraPackages = [texlabCfg.chktex.package];
|
||||
})
|
||||
])
|
||||
);
|
||||
}
|
||||
112
modules/plugins/languages/tex/pdfViewer/default.nix
Normal file
112
modules/plugins/languages/tex/pdfViewer/default.nix
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) str package listOf;
|
||||
|
||||
cfg = config.vim.languages.tex;
|
||||
|
||||
pdfViewer = {name, ...}: {
|
||||
options = {
|
||||
enable = lib.mkEnableOption "${builtins.toString name} pdf viewer";
|
||||
|
||||
name = mkOption {
|
||||
type = str;
|
||||
example = "okular";
|
||||
description = ''
|
||||
The name of the pdf viewer to use.
|
||||
|
||||
This value will be automatically set when any of the viewers are
|
||||
enabled.
|
||||
|
||||
This value will be automatically set to the value of the parent
|
||||
attribute set. ex. `...tex.pdfViewer.<name>.name = "$${name}"`
|
||||
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 {
|
||||
type = package;
|
||||
example = pkgs.kdePackages.okular;
|
||||
description = "The package of the pdf viewer to use.";
|
||||
};
|
||||
|
||||
executable = mkOption {
|
||||
type = str;
|
||||
default = "${builtins.toString name}";
|
||||
description = ''
|
||||
The executable for the pdf viewer to use.
|
||||
|
||||
It will be called as `<package_path>/bin/<executable>`.
|
||||
|
||||
By default, the name of the pdf viewer will be used.
|
||||
'';
|
||||
};
|
||||
|
||||
args = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
The command line arguments to use when calling the pdf viewer command.
|
||||
|
||||
These will be called as
|
||||
`<package_path>/bin/<executable> <arg1> <arg2> ...`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# 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"
|
||||
];
|
||||
};
|
||||
};
|
||||
description = ''
|
||||
Define the pdf viewer to use for viewing compiled tex documents.
|
||||
'';
|
||||
};
|
||||
|
||||
config = let
|
||||
# List form of all pdf viewers.
|
||||
pdfViewers = builtins.attrValues cfg.pdfViewer;
|
||||
|
||||
countPdfViewers = viewers: (lib.lists.count (x: x.enable) viewers);
|
||||
in {
|
||||
assertions = [
|
||||
{
|
||||
# Assert that there is only one enabled pdf viewer.
|
||||
assertion = (countPdfViewers pdfViewers) < 2;
|
||||
message = ''
|
||||
The nvf-tex-language implementation does not support having more than
|
||||
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
|
||||
|
|
@ -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"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
35
modules/plugins/languages/tex/treesitter.nix
Normal file
35
modules/plugins/languages/tex/treesitter.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
mkEnableTreesitterOption = lib.nvim.types.mkEnableTreesitterOption config.vim.languages.enableTreesitter;
|
||||
|
||||
cfg = config.vim.languages.tex;
|
||||
in {
|
||||
options.vim.languages.tex.treesitter = {
|
||||
latex = {
|
||||
enable = mkEnableTreesitterOption "latex";
|
||||
package = mkGrammarOption pkgs "latex";
|
||||
};
|
||||
bibtex = {
|
||||
enable = mkEnableTreesitterOption "bibtex";
|
||||
package = mkGrammarOption pkgs "bibtex";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.latex.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.latex.package];
|
||||
})
|
||||
(mkIf cfg.treesitter.bibtex.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.bibtex.package];
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ in {
|
|||
default = "outer";
|
||||
description = ''
|
||||
Which context lines to discard if
|
||||
[](#opt-vim.treesitter.context.setupOpts.max_lines) is exceeded.
|
||||
{option}`vim.treesitter.context.setupOpts.max_lines` is exceeded.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["hop-nvim"];
|
||||
vim.startPlugins = ["hop.nvim"];
|
||||
|
||||
vim.maps.normal = mkSetBinding mappings.hop "<cmd> HopPattern<CR>";
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ in {
|
|||
(mkKeymap "n" keys.open "<cmd>Telescope<CR>" {desc = mappings.open.description;})
|
||||
(mkKeymap "n" keys.resume "<cmd>Telescope resume<CR>" {desc = mappings.resume.description;})
|
||||
|
||||
(mkKeymap "n" keys.gitFiles "<cmd>Telescope git_files<CR>" {desc = mappings.gitFiles.description;})
|
||||
(mkKeymap "n" keys.gitCommits "<cmd>Telescope git_commits<CR>" {desc = mappings.gitCommits.description;})
|
||||
(mkKeymap "n" keys.gitBufferCommits "<cmd>Telescope git_bcommits<CR>" {desc = mappings.gitBufferCommits.description;})
|
||||
(mkKeymap "n" keys.gitBranches "<cmd>Telescope git_branches<CR>" {desc = mappings.gitBranches.description;})
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
default = ["${pkgs.fd}/bin/fd"];
|
||||
description = ''
|
||||
Command to use for finding files. If using an executable from {env}`PATH` then you must
|
||||
make sure that the package is available in [](#opt-vim.extraPackages).
|
||||
make sure that the package is available in {option}`vim.extraPackages`.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -208,6 +208,7 @@ in {
|
|||
open = mkMappingOption "Open [Telescope]" "<leader>ft";
|
||||
resume = mkMappingOption "Resume (previous search) [Telescope]" "<leader>fr";
|
||||
|
||||
gitFiles = mkMappingOption "Git files [Telescope]" "<leader>fvf";
|
||||
gitCommits = mkMappingOption "Git commits [Telescope]" "<leader>fvcw";
|
||||
gitBufferCommits = mkMappingOption "Git buffer commits [Telescope]" "<leader>fvcb";
|
||||
gitBranches = mkMappingOption "Git branches [Telescope]" "<leader>fvb";
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ in {
|
|||
overrides = mkOption {
|
||||
description = ''
|
||||
Overrides the default configuration for a notification group defined
|
||||
in [](#opt-vim.visuals.fidget-nvim.setupOpts.notification.configs).
|
||||
in {option}`vim.visuals.fidget-nvim.setupOpts.notification.configs`.
|
||||
|
||||
If any of the fields are null, the value from the default
|
||||
configuration is used.
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ in {
|
|||
internally to add plugins to Neovim's runtime.
|
||||
|
||||
To add additional plugins to your configuration, consider
|
||||
using the [{option}`vim.extraPlugins`](#opt-vim.extraPlugins)
|
||||
using the {option}`vim.extraPlugins`
|
||||
option.
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@
|
|||
description = ''
|
||||
Lua code to run after plugin is loaded. This will be wrapped in a function.
|
||||
|
||||
If [](#opt-vim.lazy.plugins._name_.setupModule) is provided, the setup will be ran before `after`.
|
||||
If {option}`vim.lazy.plugins._name_.setupModule` is provided, the setup will be ran before `after`.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -284,9 +284,9 @@ in {
|
|||
default = "";
|
||||
defaultText = literalMD ''
|
||||
By default, this option will **append** paths in
|
||||
[](#opt-vim.additionalRuntimePaths)
|
||||
{option}`vim-additionalRuntimePaths`
|
||||
to the `runtimepath` and enable the experimental Lua module loader
|
||||
if [](#opt-vim.enableLuaLoader) is set to true.
|
||||
if {option}`vim.enableLuaLoader` is set to true.
|
||||
'';
|
||||
|
||||
example = literalExpression "\${builtins.readFile ./my-lua-config-pre.lua}";
|
||||
|
|
|
|||
|
|
@ -708,18 +708,21 @@
|
|||
"url": "https://github.com/tzachar/highlight-undo.nvim/archive/ee32e12693d70e66f954d09a504a7371d110fc27.tar.gz",
|
||||
"hash": "09byybwyl61jxlfii9vsi4i21vy6ngm3mbypqlhsivn8wgg24kn9"
|
||||
},
|
||||
"hop-nvim": {
|
||||
"type": "Git",
|
||||
"hop.nvim": {
|
||||
"type": "GitRelease",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "phaazon",
|
||||
"owner": "smoka7",
|
||||
"repo": "hop.nvim"
|
||||
},
|
||||
"branch": "master",
|
||||
"pre_releases": false,
|
||||
"version_upper_bound": null,
|
||||
"release_prefix": null,
|
||||
"submodules": false,
|
||||
"revision": "1a1eceafe54b5081eae4cb91c723abd1d450f34b",
|
||||
"url": "https://github.com/phaazon/hop.nvim/archive/1a1eceafe54b5081eae4cb91c723abd1d450f34b.tar.gz",
|
||||
"hash": "08h18cam2yr57qvfsnf1bra28vbl6013wlchnr5crb757xw8aysa"
|
||||
"version": "v2.7.2",
|
||||
"revision": "08ddca799089ab96a6d1763db0b8adc5320bf050",
|
||||
"url": "https://api.github.com/repos/smoka7/hop.nvim/tarball/v2.7.2",
|
||||
"hash": "07mydcm3x7xc7x6wg5l6kcx8yrrv9bwy2p44y17ajyx37c5lmwwn"
|
||||
},
|
||||
"hunk-nvim": {
|
||||
"type": "GitRelease",
|
||||
|
|
@ -1591,6 +1594,22 @@
|
|||
"url": "https://github.com/nvim-neo-tree/neo-tree.nvim/archive/9130e58424ad95bf2dd8b40afbb8cf04d648638c.tar.gz",
|
||||
"hash": "0zm40p718cvqg9ngzlnc56pbglrp7yp1580g0f1pfakkwdrvnhdv"
|
||||
},
|
||||
"neocodeium": {
|
||||
"type": "GitRelease",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "monkoose",
|
||||
"repo": "neocodeium"
|
||||
},
|
||||
"pre_releases": false,
|
||||
"version_upper_bound": null,
|
||||
"release_prefix": null,
|
||||
"submodules": false,
|
||||
"version": "v1.16.3",
|
||||
"revision": "f67384cee91f8ffc0d2e09d257691b2461725d5b",
|
||||
"url": "https://api.github.com/repos/monkoose/neocodeium/tarball/v1.16.3",
|
||||
"hash": "1zr6rrvk00d3gwg7sf1vqd1z1gw2qwl0h08zcbc30x8v0iradsai"
|
||||
},
|
||||
"neocord": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
|
|
@ -1663,14 +1682,14 @@
|
|||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "otavioschwanck",
|
||||
"owner": "isaacST08",
|
||||
"repo": "new-file-template.nvim"
|
||||
},
|
||||
"branch": "master",
|
||||
"submodules": false,
|
||||
"revision": "6ac66669dbf2dc5cdee184a4fe76d22465ca67e8",
|
||||
"url": "https://github.com/otavioschwanck/new-file-template.nvim/archive/6ac66669dbf2dc5cdee184a4fe76d22465ca67e8.tar.gz",
|
||||
"hash": "0c7378c3w6bniclp666rq15c28akb0sjy58ayva0wpyin4k26hl3"
|
||||
"revision": "dc3a58b1f490c86075c96670b9eb81370c2f2ca1",
|
||||
"url": "https://github.com/isaacST08/new-file-template.nvim/archive/dc3a58b1f490c86075c96670b9eb81370c2f2ca1.tar.gz",
|
||||
"hash": "0y6ip3k6bjaf32x1y1p6mmkwwdi71yvwr6klr26m252jrg8352pf"
|
||||
},
|
||||
"nix-develop-nvim": {
|
||||
"type": "Git",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"release": "v0.8",
|
||||
"release": "v0.9",
|
||||
"isReleaseBranch": false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue