diff options
author | tv <tv@krebsco.de> | 2016-06-09 05:44:26 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2016-06-10 16:04:55 +0200 |
commit | e88cf24bcf706ec7e5d5af26770345a65a01e894 (patch) | |
tree | 4652d7fd68b0a642f048251c48edb7343d4da41e | |
parent | 104d5a6d47f9b33c3a075f1e4d2ce9ccacc836ae (diff) |
tv nix.vim: generate NixSubLangs
-rw-r--r-- | tv/2configs/vim.nix | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index ee2cbdb11..e224df9fe 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -179,31 +179,43 @@ let hi link NixEnter NixCode hi link NixExit NixData - - syn include @HaskellSyntax syntax/haskell.vim - syn region HaskellBlock - \ matchgroup=NixExit - \ start="/\* haskell \*/ '''" - \ skip="''''" - \ end="'''" - \ contains=@HaskellSyntax - unlet b:current_syntax - - syn include @VimSyntax syntax/vim.vim - syn region VimBlock - \ matchgroup=NixExit - \ start="\(/\* vim \*/\|write[-0-9A-Za-z'_]* *\"\(\([^\"]*\.\)\?vimrc\|[^\"]*\.vim\)\"\) *'''" - \ skip="''''" - \ end="'''" - \ contains=@VimSyntax - unlet b:current_syntax + hi link NixQuote NixData + hi link NixQuote2 NixQuote + hi link NixQuote3 NixQuote + + syn cluster NixSubLangs contains=NONE + + ${concatStringsSep "\n" (mapAttrsToList (name: { start ? null }: let + in /* vim */ '' + syn include @${name}Syntax syntax/${name}.vim + syn region ${name}Block + \ matchgroup=NixExit + \ start="\(/\* ${name} \*/${optionalString (start != null) ''\|${start}''}\) '''" + \ skip="'''\('\|[$]\|\\[nrt]\)" + \ end="'''" + \ contains=@${name}Syntax + syn cluster NixSubLangs add=${name}Block,@${name}Syntax + unlet b:current_syntax + '') { + haskell = {}; + vim.start = ''write[^ ]* *\"\(\([^\"]*\.\)\?vimrc\|[^\"]*\.vim\)\"''; + })} syn region NixBlock \ matchgroup=NixEnter \ start="[$]{" \ end="}" - \ contains=ALL - \ containedin=HaskellBlock,@HaskellSyntax,VimBlock,@VimSyntax + \ contains=TOP + \ containedin=@NixSubLangs + + syn region NixBlockHack + \ start="{" + \ end="}" + \ contains=TOP + + syn match NixQuote "'''[$]"he=e-1 contained containedin=@NixSubLangs + syn match NixQuote2 "''''"he=s+1 contained containedin=@NixSubLangs + syn match NixQuote3 "'''\\[nrt]" contained containedin=@NixSubLangs let b:current_syntax = "nix" ''; |