diff options
author | tv <tv@krebsco.de> | 2016-06-09 03:19:12 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2016-06-09 04:31:05 +0200 |
commit | 94e05ff7c470404464392d8d7b61cd3c502684b5 (patch) | |
tree | 4c74810c547a0d7dcbb591bf4f363e34286fb488 /tv/2configs | |
parent | f9ebab44e454a436541962790f27d686583cfe30 (diff) |
tv nix.vim: highlight embedded {Haskell,Vim}
Diffstat (limited to 'tv/2configs')
-rw-r--r-- | tv/2configs/vim.nix | 72 |
1 files changed, 52 insertions, 20 deletions
diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 21fb6cd44..82d06f63b 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -132,27 +132,59 @@ let setf nix set isk=@,48-57,_,192-255,-,' + syn match NixCode /./ + " Ref <nix/src/libexpr/lexer.l> - syn match INT /\<[0-9]\+\>/ - syn match PATH /[a-zA-Z0-9\.\_\-\+]*\(\/[a-zA-Z0-9\.\_\-\+]\+\)\+/ - syn match HPATH /\~\(\/[a-zA-Z0-9\.\_\-\+]\+\)\+/ - syn match SPATH /<[a-zA-Z0-9\.\_\-\+]\+\(\/[a-zA-Z0-9\.\_\-\+]\+\)*>/ - syn match URI /[a-zA-Z][a-zA-Z0-9\+\-\.]*:[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\']\+/ - hi link INT Constant - hi link PATH Constant - hi link HPATH Constant - hi link SPATH Constant - hi link URI Constant - - syn match String /"\([^\\"]\|\\.\)*"/ - syn match Comment /\(^\|\s\)#.*/ - - " Haskell comments - syn region Comment start=/\(^\|\s\){-#/ end=/#-}/ - syn match Comment /\(^\|\s\)--.*/ - - " Vim comments - syn match Comment /\(^\|\s\)"[^"]*$/ + syn match NixINT /\<[0-9]\+\>/ + syn match NixPATH /[a-zA-Z0-9\.\_\-\+]*\(\/[a-zA-Z0-9\.\_\-\+]\+\)\+/ + syn match NixHPATH /\~\(\/[a-zA-Z0-9\.\_\-\+]\+\)\+/ + syn match NixSPATH /<[a-zA-Z0-9\.\_\-\+]\+\(\/[a-zA-Z0-9\.\_\-\+]\+\)*>/ + syn match NixURI /[a-zA-Z][a-zA-Z0-9\+\-\.]*:[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\']\+/ + + syn match NixString /"\([^\\"]\|\\.\)*"/ + syn match NixCommentMatch /\(^\|\s\)#.*/ + syn region NixCommentRegion start="/\*" end="\*/" + + hi NixCode ctermfg=034 + hi NixData ctermfg=040 + + hi link NixComment Comment + hi link NixCommentMatch NixComment + hi link NixCommentRegion NixComment + hi link NixINT NixData + hi link NixPATH NixData + hi link NixHPATH NixData + hi link NixSPATH NixData + hi link NixURI NixData + hi link NixString NixData + + 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 + + syn region NixBlock + \ matchgroup=NixEnter + \ start="[$]{" + \ end="}" + \ contains=ALL + \ containedin=HaskellBlock,@HaskellSyntax,VimBlock,@VimSyntax let b:current_syntax = "nix" ''; |