# HG changeset patch # User Tomas Zeman # Date 1378391013 -7200 # Node ID 1c032440b4bf4bcde32f98d8cbeb3e9aefa22463 # Parent 000bc60b425f8718f4cf72bf19aafb9caebdf4e2 vim: nix filetype/syntax support diff -r 000bc60b425f -r 1c032440b4bf config/.vim/filetype.vim --- a/config/.vim/filetype.vim Fri Mar 29 14:58:44 2013 +0100 +++ b/config/.vim/filetype.vim Thu Sep 05 16:23:33 2013 +0200 @@ -3,3 +3,7 @@ " INI file syntax au BufNewFile,BufRead *.ini,*/.hgrc,*/.hg/hgrc setf ini + +" NIX +au BufNewFile,BufRead *.nix setf nix + diff -r 000bc60b425f -r 1c032440b4bf config/.vim/syntax/nix.vim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/.vim/syntax/nix.vim Thu Sep 05 16:23:33 2013 +0200 @@ -0,0 +1,40 @@ +" Vim syntax file +" Language: nix +" Maintainer: Marc Weber +" Modify and commit if you feel that way +" Last Change: 2007 Dec +" +" this syntax file can be still be enhanced very much.. +" Don't ask, do it :-) + +" Quit when a (custom) syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +syn keyword nixKeyword let throw inherit import true false null with +syn keyword nixConditional if else then +syn keyword nixBrace ( ) { } = +syn keyword nixBuiltin __currentSystem __currentTime __isFunction __getEnv __trace __toPath __pathExists + \ __readFile __toXML __toFile __filterSource __attrNames __getAttr __hasAttr __isAttrs __listToAttrs __isList + \ __head __tail __add __sub __lessThan __substring __stringLength + +syn match nixAttr "\w\+\ze\s*=" +syn match nixFuncArg "\zs\w\+\ze\s*:" +syn region nixStringParam start=+\${+ end=+}+ +syn region nixMultiLineComment start=+/\*+ skip=+\\"+ end=+\*/+ +syn match nixEndOfLineComment "#.*$" +syn region nixStringIndented start=+''+ skip=+'''\|''${\|"+ end=+''+ contains=nixStringParam +syn region nixString start=+"+ skip=+\\"+ end=+"+ contains=nixStringParam + +hi def link nixKeyword Keyword +hi def link nixConditional Conditional +hi def link nixBrace Special +hi def link nixString String +hi def link nixStringIndented String +hi def link nixBuiltin Special +hi def link nixStringParam Macro +hi def link nixMultiLineComment Comment +hi def link nixEndOfLineComment Comment +hi def link nixAttr Identifier +hi def link nixFuncArg Identifier