summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarc Weber <marco-oweber@gmx.de>2009-03-07 00:27:13 +0000
committerMarc Weber <marco-oweber@gmx.de>2009-03-07 00:27:13 +0000
commit23ca0bb3c25b73a70ad4194fe347d4222b2f3093 (patch)
tree6960b2d12d3d33f56bc28304e3bb4c52ff66d660
parent08e1c08bc7198a218f60ef5534050c1f0cc2a0fe (diff)
vim version (7.2), optional .nix filetype detection and syntax highlighting
svn path=/nixpkgs/trunk/; revision=14431
-rw-r--r--pkgs/applications/editors/vim/configurable.nix9
-rw-r--r--pkgs/applications/editors/vim/ft-nix-support.patch66
2 files changed, 73 insertions, 2 deletions
diff --git a/pkgs/applications/editors/vim/configurable.nix b/pkgs/applications/editors/vim/configurable.nix
index a528d8f7b35a8..162b0c92ebe95 100644
--- a/pkgs/applications/editors/vim/configurable.nix
+++ b/pkgs/applications/editors/vim/configurable.nix
@@ -4,7 +4,7 @@ args: with args;
 let inherit (args.composableDerivation) composableDerivation edf; in
 composableDerivation {} {
 
-    name = "vim_configurable-7.1";
+    name = "vim_configurable-7.2";
 
     src = args.fetchurl {
       url = ftp://ftp.vim.org/pub/vim/unix/vim-7.2.tar.bz2;
@@ -17,7 +17,11 @@ composableDerivation {} {
       ++ [ gtk libX11 libXext libSM libXpm libXt libXaw libXau libXmu ];
 
     # most interpreters aren't tested yet.. (see python for example how to do it)
-    flags = {}
+    flags = {
+        ftNix = {
+          patches = [ ./ft-nix-support.patch ];
+        };
+      }
       // edf { name = "darwin"; } #Disable Darwin (Mac OS X) support.
       // edf { name = "xsmp"; } #Disable XSMP session management
       // edf { name = "xsmp_interact"; } #Disable XSMP interaction
@@ -41,6 +45,7 @@ composableDerivation {} {
 
   cfg = {
     pythonSupport = true;
+    ftNixSupport = true; # add .nix filetype detection and minimal syntax highlighting support
   };
 
   #--enable-gui=OPTS     X11 GUI default=auto OPTS=auto/no/gtk/gtk2/gnome/gnome2/motif/athena/neXtaw/photon/carbon
diff --git a/pkgs/applications/editors/vim/ft-nix-support.patch b/pkgs/applications/editors/vim/ft-nix-support.patch
new file mode 100644
index 0000000000000..4b5a742dac1c3
--- /dev/null
+++ b/pkgs/applications/editors/vim/ft-nix-support.patch
@@ -0,0 +1,66 @@
+diff --git a/runtime/filetype.vim b/runtime/filetype.vim
+index a8e6261..2b008fc 100644
+--- a/runtime/filetype.vim
++++ b/runtime/filetype.vim
+@@ -2258,6 +2258,9 @@ au BufNewFile,BufRead *.zsql			call s:SQL()
+ " Z80 assembler asz80
+ au BufNewFile,BufRead *.z8a			setf z8a
+ 
++" NIX
++au BufNewFile,BufRead *.nix		setf nix
++
+ augroup END
+ 
+ 
+@@ -2440,3 +2443,5 @@ endfunc
+ " Restore 'cpoptions'
+ let &cpo = s:cpo_save
+ unlet s:cpo_save
++
++
+diff --git a/runtime/syntax/nix.vim b/runtime/syntax/nix.vim
+new file mode 100644
+index 0000000..a2f9918
+--- /dev/null
++++ b/runtime/syntax/nix.vim
+@@ -0,0 +1,40 @@
++" Vim syntax file
++" Language:	nix
++" Maintainer:	Marc Weber <marco-oweber@gmx.de>
++"               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