···
au BufNewFile,BufRead *.z8a setf z8a
+au BufNewFile,BufRead *.nix setf nix
···
21
-
diff --git a/runtime/syntax/nix.vim b/runtime/syntax/nix.vim
22
-
new file mode 100644
23
-
index 0000000..a2f9918
25
-
+++ b/runtime/syntax/nix.vim
29
-
+" Maintainer: Marc Weber <marco-oweber@gmx.de>
30
-
+" Modify and commit if you feel that way
31
-
+" Last Change: 2011 Jun
33
-
+" this syntax file can be still be enhanced very much..
34
-
+" Don't ask, do it :-)
35
-
+" This file (github.com/MarcWeber/vim-addon-nix) is periodically synced with
36
-
+" the patch found in vim_configurable (nixpkgs)
38
-
+" Quit when a (custom) syntax file was already loaded
39
-
+if exists("b:current_syntax")
44
-
+sy cluster nixStrings contains=nixStringParam,nixStringIndented
46
-
+syn keyword nixKeyword let throw inherit import true false null with
47
-
+syn keyword nixConditional if else then
48
-
+syn keyword nixBrace ( ) { } =
49
-
+syn keyword nixBuiltin __currentSystem __currentTime __isFunction __getEnv __trace __toPath __pathExists
50
-
+ \ __readFile __toXML __toFile __filterSource __attrNames __getAttr __hasAttr __isAttrs __listToAttrs __isList
51
-
+ \ __head __tail __add __sub __lessThan __substring __stringLength
53
-
+syn region nixStringIndented start=+''+ skip=+'''\|''${\|"+ end=+''+ contains=nixStringParam
54
-
+" syn region nixString start=+"+ skip=+\\"+ end=+"+
55
-
+syn match nixAttr "\w\+\ze\s*="
56
-
+syn match nixFuncArg "\zs\w\+\ze\s*:"
57
-
+syn region nixStringParam start=+\${+ end=+}+ contains=@nixStrings
58
-
+syn region nixMultiLineComment start=+/\*+ skip=+\\"+ end=+\*/+
59
-
+syn match nixEndOfLineComment "#.*$"
61
-
+hi def link nixKeyword Keyword
62
-
+hi def link nixConditional Conditional
63
-
+hi def link nixBrace Special
64
-
+hi def link nixString String
65
-
+hi def link nixStringIndented String
66
-
+hi def link nixBuiltin Special
67
-
+hi def link nixStringParam Macro
68
-
+hi def link nixMultiLineComment Comment
69
-
+hi def link nixEndOfLineComment Comment
70
-
+hi def link nixAttr Identifier
71
-
+hi def link nixFuncArg Identifier
73
-
+syn sync maxlines=20000
74
-
+syn sync minlines=50000
76
-
+let b:current_syntax = "nix"
78
-
+" thanks to domenkozar
79
-
+" scan backwards to find begining of multiline statements
80
-
+syn sync ccomment nixMultiLineComment minlines=10 maxlines=500
81
-
+syn sync ccomment nixStringIndented minlines=10 maxlines=500
82
-
+syn sync ccomment nixString maxlines=10
83
-
diff --git a/runtime/ftplugin/nix.vim b/runtime/ftplugin/nix.vim
84
-
new file mode 100644
86
-
+++ b/runtime/ftplugin/nix.vim
88
-
+" Only do this when not done yet for this buffer
89
-
+if exists("b:did_ftplugin")
92
-
+let b:did_ftplugin = 1
94
-
+" coding conventions
95
-
+setlocal shiftwidth=2 expandtab softtabstop=2
96
-
+let b:undo_ftplugin = "setlocal sw< et< sts<"