summaryrefslogtreecommitdiffstats
path: root/tv/5pkgs
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2019-08-13 15:35:12 +0200
committerlassulus <lassulus@lassul.us>2019-08-13 15:35:12 +0200
commit0699b41b05a1f9cd133c15c3aadf70c3a45170f6 (patch)
tree0bdd752d8a9ec64acb12ff160826a19b2e11e95c /tv/5pkgs
parente754ced01e2d5ef84dabba391bba2f372694b7cb (diff)
parent681075a8f41ecfbac4c113481adde4d61f497c36 (diff)
Merge remote-tracking branch 'ni/master'
Diffstat (limited to 'tv/5pkgs')
-rw-r--r--tv/5pkgs/simple/field.nix6
-rw-r--r--tv/5pkgs/vim/nix.nix44
2 files changed, 28 insertions, 22 deletions
diff --git a/tv/5pkgs/simple/field.nix b/tv/5pkgs/simple/field.nix
new file mode 100644
index 000000000..71362398d
--- /dev/null
+++ b/tv/5pkgs/simple/field.nix
@@ -0,0 +1,6 @@
+{ gawk, writeDashBin }:
+
+writeDashBin "field" ''
+ set -u
+ exec ${gawk}/bin/awk -v n="$1" '{print$n}'
+''
diff --git a/tv/5pkgs/vim/nix.nix b/tv/5pkgs/vim/nix.nix
index 747ab0bc0..4f3f83aaa 100644
--- a/tv/5pkgs/vim/nix.nix
+++ b/tv/5pkgs/vim/nix.nix
@@ -63,16 +63,28 @@ with import <stockholm/lib>;
syn cluster nix_ind_strings contains=NixIND_STRING
syn cluster nix_strings contains=NixSTRING
- ${concatStringsSep "\n" (mapAttrsToList (name: {
+ ${concatStringsSep "\n" (let
+ alts = xs: ''\(${concatStringsSep ''\|'' xs}\)'';
+ capitalize = s: let
+ xs = stringToCharacters s;
+ in
+ toUpper (head xs) + concatStrings (tail xs);
+ comment = k: ''/\* ${k} \*/'';
+ def = k: ''${k}[ \t\r\n]*='';
+ writer = k: ''write${k}[^ \t\r\n]*[ \t\r\n]*\("[^"]*"\|[a-z]\+\)'';
+ writerExt = k: writerName ''[^"]*\.${k}'';
+ writerName = k:
+ ''${alts [''toFile'' ''write[^ \t\r\n]*'']}*[ \t\r\n]*"${k}"'';
+ in mapAttrsToList (name: {
extraStart ? null,
lang ? name
}:
let
startAlts = filter isString [
- ''/\* ${name} \*/''
+ (comment name)
extraStart
];
- sigil = ''\(${concatStringsSep ''\|'' startAlts}\)[ \t\r\n]*'';
+ sigil = ''${alts startAlts}[ \t\r\n]*'';
in /* vim */ ''
syn include @nix_${lang}_syntax syntax/${lang}.vim
if exists("b:current_syntax")
@@ -111,22 +123,7 @@ with import <stockholm/lib>;
" This is required because containedin isn't transitive.
syn cluster nix_has_dollar_curly
\ add=@nix_${lang}_syntax
- '') (let
-
- # TODO move this higher
- capitalize = s: let
- xs = stringToCharacters s;
- in
- toUpper (head xs) + concatStrings (tail xs);
-
- alts = xs: ''\(${concatStringsSep ''\|'' xs}\)'';
- def = k: ''${k}[ \t\r\n]*='';
- writer = k: ''write${k}[^ \t\r\n]*[ \t\r\n]*\("[^"]*"\|[a-z]\+\)'';
-
- writerExt = k: writerName ''[^"]*\.${k}'';
- writerName = k: ''write[^ \t\r\n]*[ \t\r\n]*"${k}"'';
-
- in {
+ '') {
c = {};
cabal = {};
diff = {};
@@ -136,10 +133,13 @@ with import <stockholm/lib>;
(writer "Jq")
(writerExt "jq")
];
- javascript.extraStart = ''/\* js \*/'';
+ javascript.extraStart = comment "jq";
lua = {};
#nginx = {};
- python.extraStart = ''/\* py \*/'';
+ python.extraStart = alts [
+ (comment "py")
+ (writerExt "py")
+ ];
sed.extraStart = writer "Sed";
sh.extraStart = let
phases = [
@@ -172,7 +172,7 @@ with import <stockholm/lib>;
];
xdefaults = {};
xmodmap = {};
- }))}
+ })}
" Clear syntax that interferes with nixINSIDE_DOLLAR_CURLY.
syn clear shVarAssign