-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from Ma27/builtins-generated
syntax/nix: autogenerate namespaced builtins from `nix __dump-language`
- Loading branch information
Showing
2 changed files
with
118 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell -i bash -p bash jq nix | ||
|
||
header="syn keyword nixNamespacedBuiltin contained" | ||
|
||
nix __dump-language | jq -r ' | ||
def to_vim: keys | map(" \\ " + . + "\n") | .[]; | ||
[ (.builtins | to_vim) | ||
, (.constants | del(.["true","false","null","builtins"]) | to_vim) | ||
] | add | ||
' | sed -n -i -e '/^'"$header"'/ { | ||
p; n; r /dev/stdin | ||
:l; n; /^$/!bl; b | ||
}; p' syntax/nix.vim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters