summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-11-01 13:13:07 +0100
committertv <tv@shackspace.de>2015-11-01 13:13:07 +0100
commit7a9800289e64b25854b73d534f777ebcfb51ea04 (patch)
treeee6fabb5b000eb71ed1255b747ae3f1d7a98b4fe
parent658780d3649ae5d13bb9afafa810022b28a81e6a (diff)
tv vim: colorize nix
-rw-r--r--tv/2configs/vim.nix19
1 files changed, 19 insertions, 0 deletions
diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix
index 9fb0759ff..ba0060b40 100644
--- a/tv/2configs/vim.nix
+++ b/tv/2configs/vim.nix
@@ -107,6 +107,25 @@ let
cmap w!! w!sudo tee % >/dev/null
+ au BufRead,BufNewFile *.nix so ${pkgs.writeText "nix.vim" ''
+ setf nix
+
+ " 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#.*/
+ ''}
+
nmap <esc>q :buffer
nmap <M-q> :buffer