git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #39436 from LnL7/vim-ft-nix

vim_configurable: replace default ftNix patch with sources from vim-nix

commitab5e6073d9378e10b693790f25b078fc9df4163f authorJörg Thalheim <Mic92@users.noreply.github.com> dateWed 25 Apr 2018, 08:36 (9 years ago) parent31e9e751c3d38c
2 files changed+7−77
pkgs/applications/editors/vim/configurable.nix+6 pkgs/applications/editors/vim/ft-nix-support.patch+1−77
pkgs/applications/editors/vim/configurable.nix+6
@@ -4,6 +4,7 @@ args@{ source ? "default", callPackage, fetchurl, stdenv, ncurses, pkgconfig, ge
44, composableDerivation, writeText, lib, config, glib, gtk2, gtk3, python, perl, tcl, ruby
55, libX11, libXext, libSM, libXpm, libXt, libXaw, libXau, libXmu
66, libICE
7+, vimPlugins
78
89# apple frameworks
910, CoreServices, CoreData, Cocoa, Foundation, libobjc, cf-private
@@ -80,6 +81,11 @@ composableDerivation {
8081 flags = {
8182 ftNix = {
8283 patches = [ ./ft-nix-support.patch ];
84+ preConfigure = ''
85+ cp ${vimPlugins.vim-nix.src}/ftplugin/nix.vim runtime/ftplugin/nix.vim
86+ cp ${vimPlugins.vim-nix.src}/indent/nix.vim runtime/indent/nix.vim
87+ cp ${vimPlugins.vim-nix.src}/syntax/nix.vim runtime/syntax/nix.vim
88+ '';
8389 };
8490 }
8591 // edf {
pkgs/applications/editors/vim/ft-nix-support.patch+1−77
@@ -6,7 +6,7 @@ index a8e6261..2b008fc 100644
66 " Z80 assembler asz80
77 au BufNewFile,BufRead *.z8a setf z8a
88
9−+" NIX
9++" Nix
1010+au BufNewFile,BufRead *.nix setf nix
1111+
1212 augroup END
@@ -18,79 +18,3 @@ index a8e6261..2b008fc 100644
1818 unlet s:cpo_save
1919+
2020+
21−diff --git a/runtime/syntax/nix.vim b/runtime/syntax/nix.vim
22−new file mode 100644
23−index 0000000..a2f9918
24−--- /dev/null
25−+++ b/runtime/syntax/nix.vim
26−@@ -0,0 +1,56 @@
27−+" Vim syntax file
28−+" Language: nix
29−+" Maintainer: Marc Weber <marco-oweber@gmx.de>
30−+" Modify and commit if you feel that way
31−+" Last Change: 2011 Jun
32−+"
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)
37−+
38−+" Quit when a (custom) syntax file was already loaded
39−+if exists("b:current_syntax")
40−+ finish
41−+endif
42−+
43−+
44−+sy cluster nixStrings contains=nixStringParam,nixStringIndented
45−+
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
52−+
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 "#.*$"
60−+
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
72−+
73−+syn sync maxlines=20000
74−+syn sync minlines=50000
75−+
76−+let b:current_syntax = "nix"
77−+
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
85−--- /dev/null
86−+++ b/runtime/ftplugin/nix.vim
87−@@ -0,0 +1,2 @@
88−+" Only do this when not done yet for this buffer
89−+if exists("b:did_ftplugin")
90−+ finish
91−+endif
92−+let b:did_ftplugin = 1
93−+
94−+" coding conventions
95−+setlocal shiftwidth=2 expandtab softtabstop=2
96−+let b:undo_ftplugin = "setlocal sw< et< sts<"