diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2014-11-14 22:05:57 +0100 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2014-11-14 22:08:31 +0100 |
commit | 6d6695ec14fd3d8122145cd4944da35d2595ff39 (patch) | |
tree | 90e1b9245cbe1dd36ada915e8855942f2914e842 /pkgs/applications/editors/vim | |
parent | 4fe383de481883d0a4288e4409ab4b7d548a03af (diff) |
vim: improve *.nix plugin (#4662)
- Sync syntax from source. - Add indentation conventions.
Diffstat (limited to 'pkgs/applications/editors/vim')
-rw-r--r-- | pkgs/applications/editors/vim/ft-nix-support.patch | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/pkgs/applications/editors/vim/ft-nix-support.patch b/pkgs/applications/editors/vim/ft-nix-support.patch index ed508784813cb..cbbe1ccb212fd 100644 --- a/pkgs/applications/editors/vim/ft-nix-support.patch +++ b/pkgs/applications/editors/vim/ft-nix-support.patch @@ -23,39 +23,42 @@ new file mode 100644 index 0000000..a2f9918 --- /dev/null +++ b/runtime/syntax/nix.vim -@@ -0,0 +1,47 @@ +@@ -0,0 +1,56 @@ +" Vim syntax file +" Language: nix +" Maintainer: Marc Weber <marco-oweber@gmx.de> +" Modify and commit if you feel that way -+" Last Change: 2007 Dec ++" Last Change: 2011 Jun +" +" this syntax file can be still be enhanced very much.. +" Don't ask, do it :-) ++" This file (github.com/MarcWeber/vim-addon-nix) is periodically synced with ++" the patch found in vim_configurable (nixpkgs) + +" Quit when a (custom) syntax file was already loaded +if exists("b:current_syntax") + finish +endif + -+syn keyword nixKeyword let in rec assert inherit import true false null with ... -+syn keyword nixBuiltin import abort baseNameOf dirOf isNull builtins map removeAttrs throw toString derivation ++ ++sy cluster nixStrings contains=nixStringParam,nixStringIndented ++ ++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 "[a-zA-Z0-9-_]\+\ze\s*=" -+syn match nixFuncArg "\zs[a-zA-Z0-9-_]\+\ze\s*:" -+syn region nixStringParam start=+\${+ end=+}+ ++syn region nixStringIndented start=+''+ skip=+'''\|''${\|"+ end=+''+ contains=nixStringParam ++" syn region nixString start=+"+ skip=+\\"+ end=+"+ ++syn match nixAttr "\w\+\ze\s*=" ++syn match nixFuncArg "\zs\w\+\ze\s*:" ++syn region nixStringParam start=+\${+ end=+}+ contains=@nixStrings +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 nixBuiltin Function +hi def link nixConditional Conditional +hi def link nixBrace Special +hi def link nixString String @@ -67,9 +70,20 @@ index 0000000..a2f9918 +hi def link nixAttr Identifier +hi def link nixFuncArg Identifier + ++syn sync maxlines=20000 ++syn sync minlines=50000 ++ +let b:current_syntax = "nix" + ++" thanks to iElectric +" scan backwards to find begining of multiline statements +syn sync ccomment nixMultiLineComment minlines=10 maxlines=500 +syn sync ccomment nixStringIndented minlines=10 maxlines=500 +syn sync ccomment nixString maxlines=10 +diff --git a/runtime/ftplugin/nix.vim b/runtime/ftplugin/nix.vim +new file mode 100644 +--- /dev/null ++++ b/runtime/ftplugin/nix.vim +@@ -0,0 +1,2 @@ ++" coding conventions ++setlocal sw=2 ts=2 expandtab |