Merge pull request #137885 from teto/fix-vim-plug

vimPlugins followup

authored by

Matthieu Coudron and committed by
GitHub
4ad9704b d46295c6

+47 -15
+21 -1
pkgs/applications/editors/neovim/tests.nix
··· 87 87 nvim_with_plug = neovim.override { 88 88 extraName = "-with-plug"; 89 89 configure.plug.plugins = with pkgs.vimPlugins; [ 90 - vim-go 90 + base16-vim 91 91 ]; 92 + configure.customRC = '' 93 + color base16-tomorrow-night 94 + set background=dark 95 + ''; 92 96 }; 97 + 98 + run_nvim_with_plug = runTest nvim_with_plug '' 99 + export HOME=$TMPDIR 100 + ${nvim_with_plug}/bin/nvim -i NONE -c 'color base16-tomorrow-night' +quit! 101 + ''; 102 + 103 + 104 + # check that the vim-doc hook correctly generates the tag 105 + # we know for a fact packer has a doc folder 106 + checkForTags = vimPlugins.packer-nvim.overrideAttrs(oldAttrs: { 107 + doInstallCheck = true; 108 + installCheckPhase = '' 109 + [ -f $out/doc/tags ] 110 + ''; 111 + }); 112 + 93 113 94 114 # nixpkgs should detect that no wrapping is necessary 95 115 nvimShouldntWrap = wrapNeovim2 "-should-not-wrap" nvimAutoDisableWrap;
+4 -1
pkgs/misc/vim-plugins/build-vim-plugin.nix
··· 6 6 7 7 rec { 8 8 addRtp = path: attrs: derivation: 9 - derivation // { rtp = "${derivation}/${path}"; } // { 9 + derivation // { rtp = "${derivation}"; } // { 10 10 overrideAttrs = f: buildVimPlugin (attrs // f attrs); 11 11 }; 12 12 ··· 25 25 }: 26 26 addRtp "${rtpPath}/${path}" attrs (stdenv.mkDerivation (attrs // { 27 27 name = namePrefix + name; 28 + 29 + # dont move the doc folder since vim expects it 30 + forceShare= [ "man" "info" ]; 28 31 29 32 nativeBuildInputs = attrs.nativeBuildInputs or [] ++ [ vimGenDocHook ]; 30 33 inherit unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
+9
pkgs/misc/vim-plugins/overrides.nix
··· 37 37 , xkb-switch 38 38 , ycmd 39 39 40 + # test dependencies 41 + , neovim-unwrapped 42 + 40 43 # command-t dependencies 41 44 , rake 42 45 , ruby ··· 392 395 substituteInPlace $out/bin/minimap_generator.sh \ 393 396 --replace "code-minimap" "${code-minimap}/bin/code-minimap" 394 397 ''; 398 + 399 + doCheck = true; 400 + checkPhase = '' 401 + ${neovim-unwrapped}/bin/nvim -n -u NONE -i NONE -V1 --cmd "set rtp+=$out" --cmd "runtime! plugin/*.vim" -c "MinimapToggle" +quit! 402 + ''; 403 + 395 404 }); 396 405 397 406 ncm2 = super.ncm2.overrideAttrs (old: {
+2 -2
pkgs/misc/vim-plugins/vim-gen-doc-hook.sh
··· 5 5 vimPluginGenTags() { 6 6 echo "Executing vimPluginGenTags" 7 7 8 - target="$out/@rtpPath@/$pname" 8 + target="$out/@rtpPath@" 9 9 mkdir -p $out/@rtpPath@ 10 10 11 11 # build help tags ··· 16 16 exit 1 17 17 fi 18 18 else 19 - echo "No docs available" 19 + echo "No docs available for $target" 20 20 fi 21 21 22 22 if [ -n "$addonInfo" ]; then
+11 -11
pkgs/misc/vim-plugins/vim-utils.nix
··· 187 187 188 188 rtpPath = "."; 189 189 190 - nativeImpl = packages: 191 - (let 190 + # Generates a packpath folder as expected by vim 191 + packDir = packages: 192 + let 192 193 # dir is "start" or "opt" 193 194 linkLuaPlugin = plugin: packageName: dir: '' 194 195 mkdir -p $out/pack/${packageName}/${dir}/${plugin.pname}/lua ··· 205 206 then linkLuaPlugin pluginPath 206 207 else linkVimlPlugin pluginPath; 207 208 208 - packageLinks = (packageName: {start ? [], opt ? []}: 209 + packageLinks = packageName: {start ? [], opt ? []}: 209 210 let 210 211 # `nativeImpl` expects packages to be derivations, not strings (as 211 212 # opposed to older implementations that have to maintain backwards ··· 230 231 ++ [ 231 232 "mkdir -p $out/pack/${packageName}/start/__python3_dependencies" 232 233 "ln -s ${python3Env}/${python3Env.sitePackages} $out/pack/${packageName}/start/__python3_dependencies/python3" 233 - ] 234 - ); 235 - packDir = (packages: 234 + ]; 235 + in 236 236 stdenv.mkDerivation { 237 237 name = "vim-pack-dir"; 238 238 src = ./.; 239 239 installPhase = lib.concatStringsSep "\n" (lib.flatten (lib.mapAttrsToList packageLinks packages)); 240 240 preferLocalBuild = true; 241 - } 242 - ); 243 - in 241 + }; 242 + 243 + nativeImpl = packages: 244 244 '' 245 245 set packpath^=${packDir packages} 246 246 set runtimepath^=${packDir packages} 247 - ''); 247 + ''; 248 248 249 249 /* Generates a vimrc string 250 250 ··· 295 295 plugImpl = 296 296 ('' 297 297 source ${vimPlugins.vim-plug.rtp}/plug.vim 298 - call plug#begin('/dev/null') 298 + silent! call plug#begin('/dev/null') 299 299 300 300 '' + (lib.concatMapStringsSep "\n" (pkg: "Plug '${pkg.rtp}'") plug.plugins) + '' 301 301