diff options
author | Paul Colomiets <paul@colomiets.name> | 2014-06-28 23:34:48 +0300 |
---|---|---|
committer | Bjørn Forsman <bjorn.forsman@gmail.com> | 2014-07-15 14:59:15 +0200 |
commit | 496d12958e603975eb828bd28cf27fd8bab7c856 (patch) | |
tree | c279fe37eb247382a4e991a4b65ecf989328be44 /pkgs/applications/editors/vim | |
parent | 0ffcb718a211b599728fc76dd73201afc9256d5d (diff) | |
download | nixpkgs-496d12958e603975eb828bd28cf27fd8bab7c856.tar nixpkgs-496d12958e603975eb828bd28cf27fd8bab7c856.tar.gz nixpkgs-496d12958e603975eb828bd28cf27fd8bab7c856.tar.bz2 nixpkgs-496d12958e603975eb828bd28cf27fd8bab7c856.tar.lz nixpkgs-496d12958e603975eb828bd28cf27fd8bab7c856.tar.xz nixpkgs-496d12958e603975eb828bd28cf27fd8bab7c856.tar.zst nixpkgs-496d12958e603975eb828bd28cf27fd8bab7c856.zip |
Add automatic plugin activation for vim
Diffstat (limited to 'pkgs/applications/editors/vim')
-rw-r--r-- | pkgs/applications/editors/vim/configurable.nix | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/pkgs/applications/editors/vim/configurable.nix b/pkgs/applications/editors/vim/configurable.nix index e0d8de157b0..bf53b4972c1 100644 --- a/pkgs/applications/editors/vim/configurable.nix +++ b/pkgs/applications/editors/vim/configurable.nix @@ -1,9 +1,26 @@ # TODO tidy up eg The patchelf code is patching gvim even if you don't build it.. # but I have gvim with python support now :) - Marc -args@{source ? "default", ...}: with args; - - -let inherit (args.composableDerivation) composableDerivation edf; in +args@{pkgs, source ? "default", ...}: with args; + + +let inherit (args.composableDerivation) composableDerivation edf; + nixosRuntimepath = pkgs.writeText "runtimepath.vim" '' + function! NixosPluginPath() + let seen = {} + for p in reverse(split($NIX_PROFILES)) + for d in split(glob(p . '/share/vim-plugins/*')) + let pluginname = substitute(d, ".*/", "", "") + if !has_key(seen, pluginname) + exec 'set runtimepath^='.d + let seen[pluginname] = 1 + endif + endfor + endfor + endfunction + + execute NixosPluginPath() + ''; +in composableDerivation { # use gccApple to compile on darwin mkDerivation = ( if stdenv.isDarwin @@ -145,6 +162,8 @@ composableDerivation { echo $nativeBuildInputs echo $rpath patchelf --set-rpath $rpath $out/bin/{vim,gvim} + + ln -sfn ${nixosRuntimepath} $out/share/vim/vimrc ''; dontStrip = 1; |