summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2015-11-01 13:13:07 +0100
committertv <tv@krebsco.de>2015-11-01 13:13:07 +0100
commitaaf252cf3ad9a2db668984b6e9a9e24bdb971907 (patch)
tree39692c922a47c9017acd911ff24ea3040161f20c
parentafbc01a3d4ed33822584c3a6a43045df8b47e6c2 (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 9fb0759..ba0060b 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