summaryrefslogtreecommitdiffstats
path: root/tv/2configs/vim.nix
diff options
context:
space:
mode:
Diffstat (limited to 'tv/2configs/vim.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