This commit is contained in:
Snoweuph 2026-06-05 15:53:31 +02:00 committed by GitHub
commit 3a8dcb3854
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 64 additions and 13 deletions

View file

@ -4,6 +4,7 @@
stdenvNoCC,
optionsJSON,
jaq,
gnused,
} @ args: let
manual-release = args.release or "unstable";
in
@ -18,6 +19,7 @@ in
doCheck = false;
})
jaq
gnused
];
patchPhase = ''
@ -37,6 +39,23 @@ in
'';
buildPhase = ''
mkdir -p queries/nix
# apply nix injections
sed -n -f /dev/stdin ${../modules/plugins/languages/nix.nix} <<'EOF' > ./queries/nix/injections.scm
/type = "injections"/,/^[[:space:]]*};/ {
/query = '''/,/^[[:space:]]*''';/ {
/query = '''/d
/^[[:space:]]*''';/d
p
}
}
EOF
# Syntactica doesnt support `query` so we patch it with the closest it does,
# which is `haskell` :bwaa:
sed -i 's|#set! injection\.language "query"|#set! injection.language "haskell"|' ./queries/nix/injections.scm
# Generate the final manual from a set of parameters. This uses
# feel-co/ndg to render the web manual.
ndg --config-file ${./ndg.toml} html \

View file

@ -60,8 +60,9 @@ Vimscript) for the same autocommand. Choose one.
**Examples:**
```nix
{ lib, ... }:
{
{ lib, ... }: let
inherit (lib.generators) mkLuaInline;
in {
vim.augroups = [ { name = "UserSetup"; } ];
vim.autocmds = [
@ -71,7 +72,7 @@ Vimscript) for the same autocommand. Choose one.
pattern = [ "*.lua" ];
group = "UserSetup";
desc = "Notify after saving Lua file";
callback = lib.generators.mkLuaInline ''
callback = mkLuaInline ''
function()
vim.notify("Lua file saved!", vim.log.levels.INFO)
end
@ -101,7 +102,7 @@ Vimscript) for the same autocommand. Choose one.
event = [ "BufWinEnter" ];
pattern = [ "*" ];
desc = "Simple greeting on entering a buffer window";
callback = lib.generators.mkLuaInline ''
callback = mkLuaInline ''
function(args)
print("Entered buffer: " .. args.buf)
end

View file

@ -36,7 +36,7 @@ order to configure the added plugin,
in {
# luaConfigRC takes Lua configuration verbatim and inserts it at an arbitrary
# position by default or if 'entryAnywhere' is used.
vim.luaConfigRC.aerial-nvim= entryAnywhere ''
vim.luaConfigRC.aerial-nvim = entryAnywhere ''
require('aerial').setup {
-- your configuration here
}

View file

@ -10,11 +10,15 @@ In the following example, we are creating a custom injection, to highlight the
Lua string after `mkLuaInline`.
```nix
foo = mkLuaInline ''
function bar()
return 'foobar'
end
'';
let
inherit (lib.generators) mkLuaInline;
in {
foo = mkLuaInline ''
function bar()
return 'foobar'
end
'';
}
```
```nix

View file

@ -650,9 +650,11 @@ As you've seen above, `toLuaObject` is used to convert our nix attrSet
that return specific values as expected by the plugins.
```nix
{
let
inherit (lib.generators) mkLuaInline;
in {
vim.your-plugin.setupOpts = {
on_init = lib.generators.mkLuaInline ''
on_init = mkLuaInline ''
function()
print('we can write lua!')
end

View file

@ -323,6 +323,8 @@
[Snoweuph](https://github.com/snoweuph)
- Use nvf nix Tree-sitter injections in the docs.
- Allow the usage of `pks.tree-sitter-grammars` in
{option}`vim.treesitter.grammars` and language module tree-sitter package
options created via `mkGrammarOption`.

View file

@ -14,6 +14,9 @@ footer_text = "Generated with ndg"
generate_anchors = true
# For our custom queries
syntax_queries_path = "queries"
# Search configuration
[search]
enable = true

View file

@ -3,7 +3,7 @@
lib,
...
}: let
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.options) mkOption mkEnableOption literalExpression literalMD;
inherit (lib.types) listOf nullOr package bool str lines enum submodule oneOf attrsOf;
queriesType = submodule {
@ -20,6 +20,26 @@
query = mkOption {
type = lines;
description = "The queries scm script.";
example = literalMD ''
```nix
{
query = '''
;; extends
((apply_expression
function: (variable_expression
name: (identifier) @_func
(#eq? @_func "mkLuaInline"))
argument: (indented_string_expression
(string_fragment) @injection.content)
(#set! injection.language "lua")
(#set! injection.combined)))
''';
}
```
'';
};
};
};