Add automatic plugin activation for vim

This commit is contained in:
Paul Colomiets 2014-06-28 23:34:48 +03:00 committed by Bjørn Forsman
parent 0ffcb718a2
commit 496d12958e
3 changed files with 27 additions and 7 deletions

View File

@ -110,6 +110,7 @@ in
"/man"
"/sbin"
"/share/emacs"
"/share/vim-plugins"
"/share/org"
"/share/info"
"/share/terminfo"

View File

@ -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;
args@{pkgs, source ? "default", ...}: with args;
let inherit (args.composableDerivation) composableDerivation edf; in
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;

View File

@ -88,8 +88,8 @@ let vimHelpTags = ''
inherit buildPhase;
installPhase = ''
target=$out/vim-plugins/$path
ensureDir $out/vim-plugins
target=$out/share/vim-plugins/${path}
ensureDir $out/share/vim-plugins
cp -r . $target
${vimHelpTags}
vimHelpTags $target
@ -114,14 +114,14 @@ in rec
rev = "abfc3ee36adab11c0c0b9d086a164a69006fec79";
sha256 = "1d25dp5kgqickl06hqvx4j3z51zblhsn3q3by2hayyj3g2zps4gm";
};
name = "youcompleteme-git-abfc3ee";
buildInputs = [ python cmake clang.clang ];
configurePhase = ":";
buildPhase = ''
target=$out/vim-plugins/YouCompleteMe
target=$out/share/vim-plugins/YouCompleteMe
mkdir -p $target
cp -a ./ $target
@ -311,7 +311,7 @@ in rec
preBuild = ''
sed -ie '1 i\
set runtimepath+=${vimproc}/vim-plugins/vimproc\
set runtimepath+=${vimproc}/share/vim-plugins/vimproc\
' autoload/vimshell.vim
'';