mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-06-24 21:34:42 +00:00
Merge a0f40a0d07 into 0b92b1783d
This commit is contained in:
commit
3a8dcb3854
8 changed files with 64 additions and 13 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
stdenvNoCC,
|
stdenvNoCC,
|
||||||
optionsJSON,
|
optionsJSON,
|
||||||
jaq,
|
jaq,
|
||||||
|
gnused,
|
||||||
} @ args: let
|
} @ args: let
|
||||||
manual-release = args.release or "unstable";
|
manual-release = args.release or "unstable";
|
||||||
in
|
in
|
||||||
|
|
@ -18,6 +19,7 @@ in
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
})
|
})
|
||||||
jaq
|
jaq
|
||||||
|
gnused
|
||||||
];
|
];
|
||||||
|
|
||||||
patchPhase = ''
|
patchPhase = ''
|
||||||
|
|
@ -37,6 +39,23 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildPhase = ''
|
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
|
# Generate the final manual from a set of parameters. This uses
|
||||||
# feel-co/ndg to render the web manual.
|
# feel-co/ndg to render the web manual.
|
||||||
ndg --config-file ${./ndg.toml} html \
|
ndg --config-file ${./ndg.toml} html \
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,9 @@ Vimscript) for the same autocommand. Choose one.
|
||||||
**Examples:**
|
**Examples:**
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{ lib, ... }:
|
{ lib, ... }: let
|
||||||
{
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
in {
|
||||||
vim.augroups = [ { name = "UserSetup"; } ];
|
vim.augroups = [ { name = "UserSetup"; } ];
|
||||||
|
|
||||||
vim.autocmds = [
|
vim.autocmds = [
|
||||||
|
|
@ -71,7 +72,7 @@ Vimscript) for the same autocommand. Choose one.
|
||||||
pattern = [ "*.lua" ];
|
pattern = [ "*.lua" ];
|
||||||
group = "UserSetup";
|
group = "UserSetup";
|
||||||
desc = "Notify after saving Lua file";
|
desc = "Notify after saving Lua file";
|
||||||
callback = lib.generators.mkLuaInline ''
|
callback = mkLuaInline ''
|
||||||
function()
|
function()
|
||||||
vim.notify("Lua file saved!", vim.log.levels.INFO)
|
vim.notify("Lua file saved!", vim.log.levels.INFO)
|
||||||
end
|
end
|
||||||
|
|
@ -101,7 +102,7 @@ Vimscript) for the same autocommand. Choose one.
|
||||||
event = [ "BufWinEnter" ];
|
event = [ "BufWinEnter" ];
|
||||||
pattern = [ "*" ];
|
pattern = [ "*" ];
|
||||||
desc = "Simple greeting on entering a buffer window";
|
desc = "Simple greeting on entering a buffer window";
|
||||||
callback = lib.generators.mkLuaInline ''
|
callback = mkLuaInline ''
|
||||||
function(args)
|
function(args)
|
||||||
print("Entered buffer: " .. args.buf)
|
print("Entered buffer: " .. args.buf)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ order to configure the added plugin,
|
||||||
in {
|
in {
|
||||||
# luaConfigRC takes Lua configuration verbatim and inserts it at an arbitrary
|
# luaConfigRC takes Lua configuration verbatim and inserts it at an arbitrary
|
||||||
# position by default or if 'entryAnywhere' is used.
|
# position by default or if 'entryAnywhere' is used.
|
||||||
vim.luaConfigRC.aerial-nvim= entryAnywhere ''
|
vim.luaConfigRC.aerial-nvim = entryAnywhere ''
|
||||||
require('aerial').setup {
|
require('aerial').setup {
|
||||||
-- your configuration here
|
-- your configuration here
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,15 @@ In the following example, we are creating a custom injection, to highlight the
|
||||||
Lua string after `mkLuaInline`.
|
Lua string after `mkLuaInline`.
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
foo = mkLuaInline ''
|
let
|
||||||
function bar()
|
inherit (lib.generators) mkLuaInline;
|
||||||
return 'foobar'
|
in {
|
||||||
end
|
foo = mkLuaInline ''
|
||||||
'';
|
function bar()
|
||||||
|
return 'foobar'
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
|
|
|
||||||
|
|
@ -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.
|
that return specific values as expected by the plugins.
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
let
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
in {
|
||||||
vim.your-plugin.setupOpts = {
|
vim.your-plugin.setupOpts = {
|
||||||
on_init = lib.generators.mkLuaInline ''
|
on_init = mkLuaInline ''
|
||||||
function()
|
function()
|
||||||
print('we can write lua!')
|
print('we can write lua!')
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -323,6 +323,8 @@
|
||||||
|
|
||||||
[Snoweuph](https://github.com/snoweuph)
|
[Snoweuph](https://github.com/snoweuph)
|
||||||
|
|
||||||
|
- Use nvf nix Tree-sitter injections in the docs.
|
||||||
|
|
||||||
- Allow the usage of `pks.tree-sitter-grammars` in
|
- Allow the usage of `pks.tree-sitter-grammars` in
|
||||||
{option}`vim.treesitter.grammars` and language module tree-sitter package
|
{option}`vim.treesitter.grammars` and language module tree-sitter package
|
||||||
options created via `mkGrammarOption`.
|
options created via `mkGrammarOption`.
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@ footer_text = "Generated with ndg"
|
||||||
|
|
||||||
generate_anchors = true
|
generate_anchors = true
|
||||||
|
|
||||||
|
# For our custom queries
|
||||||
|
syntax_queries_path = "queries"
|
||||||
|
|
||||||
# Search configuration
|
# Search configuration
|
||||||
[search]
|
[search]
|
||||||
enable = true
|
enable = true
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: 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;
|
inherit (lib.types) listOf nullOr package bool str lines enum submodule oneOf attrsOf;
|
||||||
|
|
||||||
queriesType = submodule {
|
queriesType = submodule {
|
||||||
|
|
@ -20,6 +20,26 @@
|
||||||
query = mkOption {
|
query = mkOption {
|
||||||
type = lines;
|
type = lines;
|
||||||
description = "The queries scm script.";
|
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)))
|
||||||
|
''';
|
||||||
|
}
|
||||||
|
```
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue