about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthieu Coudron <teto@users.noreply.github.com>2021-09-17 16:50:46 +0200
committerGitHub <noreply@github.com>2021-09-17 16:50:46 +0200
commit4ad9704bc1d4ff63f48d3c19f51ef71040e10672 (patch)
tree92ae4f61fa680ed8d3414f3e0ccb958dbbb94522
parentd46295c60d464e62613df373f8b54f75d4749e47 (diff)
parentcae999f7a36027deb00ff3ad77cf02a09de8f0b5 (diff)
Merge pull request #137885 from teto/fix-vim-plug
vimPlugins followup
-rw-r--r--pkgs/applications/editors/neovim/tests.nix22
-rw-r--r--pkgs/misc/vim-plugins/build-vim-plugin.nix5
-rw-r--r--pkgs/misc/vim-plugins/overrides.nix9
-rw-r--r--pkgs/misc/vim-plugins/vim-gen-doc-hook.sh4
-rw-r--r--pkgs/misc/vim-plugins/vim-utils.nix22
5 files changed, 47 insertions, 15 deletions
diff --git a/pkgs/applications/editors/neovim/tests.nix b/pkgs/applications/editors/neovim/tests.nix
index 202b18efb8cfb..085fceac11084 100644
--- a/pkgs/applications/editors/neovim/tests.nix
+++ b/pkgs/applications/editors/neovim/tests.nix
@@ -87,10 +87,30 @@ rec {
   nvim_with_plug = neovim.override {
     extraName = "-with-plug";
     configure.plug.plugins = with pkgs.vimPlugins; [
-      vim-go
+      base16-vim
     ];
+    configure.customRC = ''
+      color base16-tomorrow-night
+      set background=dark
+    '';
   };
 
+  run_nvim_with_plug = runTest nvim_with_plug ''
+    export HOME=$TMPDIR
+    ${nvim_with_plug}/bin/nvim -i NONE -c 'color base16-tomorrow-night'  +quit!
+  '';
+
+
+  # check that the vim-doc hook correctly generates the tag
+  # we know for a fact packer has a doc folder
+  checkForTags = vimPlugins.packer-nvim.overrideAttrs(oldAttrs: {
+    doInstallCheck = true;
+    installCheckPhase = ''
+      [ -f $out/doc/tags ]
+    '';
+  });
+
+
   # nixpkgs should detect that no wrapping is necessary
   nvimShouldntWrap = wrapNeovim2 "-should-not-wrap" nvimAutoDisableWrap;
 
diff --git a/pkgs/misc/vim-plugins/build-vim-plugin.nix b/pkgs/misc/vim-plugins/build-vim-plugin.nix
index b6c75e03654d8..5b235188c06ab 100644
--- a/pkgs/misc/vim-plugins/build-vim-plugin.nix
+++ b/pkgs/misc/vim-plugins/build-vim-plugin.nix
@@ -6,7 +6,7 @@
 
 rec {
   addRtp = path: attrs: derivation:
-    derivation // { rtp = "${derivation}/${path}"; } // {
+    derivation // { rtp = "${derivation}"; } // {
       overrideAttrs = f: buildVimPlugin (attrs // f attrs);
     };
 
@@ -26,6 +26,9 @@ rec {
     addRtp "${rtpPath}/${path}" attrs (stdenv.mkDerivation (attrs // {
       name = namePrefix + name;
 
+      # dont move the doc folder since vim expects it
+      forceShare= [ "man" "info" ];
+
       nativeBuildInputs = attrs.nativeBuildInputs or [] ++ [ vimGenDocHook ];
       inherit unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
 
diff --git a/pkgs/misc/vim-plugins/overrides.nix b/pkgs/misc/vim-plugins/overrides.nix
index 9b0cae766e1ca..a80ed2061e584 100644
--- a/pkgs/misc/vim-plugins/overrides.nix
+++ b/pkgs/misc/vim-plugins/overrides.nix
@@ -37,6 +37,9 @@
 , xkb-switch
 , ycmd
 
+# test dependencies
+, neovim-unwrapped
+
   # command-t dependencies
 , rake
 , ruby
@@ -392,6 +395,12 @@ self: super: {
       substituteInPlace $out/bin/minimap_generator.sh \
         --replace "code-minimap" "${code-minimap}/bin/code-minimap"
     '';
+
+    doCheck = true;
+    checkPhase = ''
+      ${neovim-unwrapped}/bin/nvim -n -u NONE -i NONE -V1 --cmd "set rtp+=$out" --cmd "runtime! plugin/*.vim" -c "MinimapToggle"  +quit!
+    '';
+
   });
 
   ncm2 = super.ncm2.overrideAttrs (old: {
diff --git a/pkgs/misc/vim-plugins/vim-gen-doc-hook.sh b/pkgs/misc/vim-plugins/vim-gen-doc-hook.sh
index cbf666f8b74d8..d5f0a00ebcc28 100644
--- a/pkgs/misc/vim-plugins/vim-gen-doc-hook.sh
+++ b/pkgs/misc/vim-plugins/vim-gen-doc-hook.sh
@@ -5,7 +5,7 @@ echo "Sourcing vim-gen-doc-hook"
 vimPluginGenTags() {
     echo "Executing vimPluginGenTags"
 
-    target="$out/@rtpPath@/$pname"
+    target="$out/@rtpPath@"
     mkdir -p $out/@rtpPath@
 
     # build help tags
@@ -16,7 +16,7 @@ vimPluginGenTags() {
         exit 1
         fi
     else
-        echo "No docs available"
+        echo "No docs available for $target"
     fi
 
     if [ -n "$addonInfo" ]; then
diff --git a/pkgs/misc/vim-plugins/vim-utils.nix b/pkgs/misc/vim-plugins/vim-utils.nix
index 0516a84ce953c..3e609b5751198 100644
--- a/pkgs/misc/vim-plugins/vim-utils.nix
+++ b/pkgs/misc/vim-plugins/vim-utils.nix
@@ -187,8 +187,9 @@ let
 
   rtpPath = ".";
 
-  nativeImpl = packages:
-  (let
+  # Generates a packpath folder as expected by vim
+  packDir = packages:
+  let
     # dir is "start" or "opt"
     linkLuaPlugin = plugin: packageName: dir: ''
       mkdir -p $out/pack/${packageName}/${dir}/${plugin.pname}/lua
@@ -205,7 +206,7 @@ let
       then linkLuaPlugin pluginPath
       else linkVimlPlugin pluginPath;
 
-    packageLinks = (packageName: {start ? [], opt ? []}:
+    packageLinks = packageName: {start ? [], opt ? []}:
     let
       # `nativeImpl` expects packages to be derivations, not strings (as
       # opposed to older implementations that have to maintain backwards
@@ -230,21 +231,20 @@ let
       ++ [
         "mkdir -p $out/pack/${packageName}/start/__python3_dependencies"
         "ln -s ${python3Env}/${python3Env.sitePackages} $out/pack/${packageName}/start/__python3_dependencies/python3"
-      ]
-    );
-    packDir = (packages:
+      ];
+  in
       stdenv.mkDerivation {
         name = "vim-pack-dir";
         src = ./.;
         installPhase = lib.concatStringsSep "\n" (lib.flatten (lib.mapAttrsToList packageLinks packages));
         preferLocalBuild = true;
-      }
-    );
-  in
+    };
+
+  nativeImpl = packages:
   ''
     set packpath^=${packDir packages}
     set runtimepath^=${packDir packages}
-  '');
+  '';
 
   /* Generates a vimrc string
 
@@ -295,7 +295,7 @@ let
       plugImpl =
       (''
         source ${vimPlugins.vim-plug.rtp}/plug.vim
-        call plug#begin('/dev/null')
+        silent! call plug#begin('/dev/null')
 
         '' + (lib.concatMapStringsSep "\n" (pkg: "Plug '${pkg.rtp}'") plug.plugins) + ''