about summary refs log tree commit diff
path: root/pkgs/applications/editors/vim
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2022-08-12 12:01:32 +0000
committerGitHub <noreply@github.com>2022-08-12 12:01:32 +0000
commit71344f23b354d1cfd528329ea82dce0c486d3179 (patch)
tree5cc6a3f0dd964ccdbc6e53ceb719ede17810a79f /pkgs/applications/editors/vim
parentb9106e11154e264a0b964649f9ba72f4898edace (diff)
parent84ee3aa55b34a5772533139edacadd1934f8a977 (diff)
downloadnixlib-71344f23b354d1cfd528329ea82dce0c486d3179.tar
nixlib-71344f23b354d1cfd528329ea82dce0c486d3179.tar.gz
nixlib-71344f23b354d1cfd528329ea82dce0c486d3179.tar.bz2
nixlib-71344f23b354d1cfd528329ea82dce0c486d3179.tar.lz
nixlib-71344f23b354d1cfd528329ea82dce0c486d3179.tar.xz
nixlib-71344f23b354d1cfd528329ea82dce0c486d3179.tar.zst
nixlib-71344f23b354d1cfd528329ea82dce0c486d3179.zip
Merge master into staging-next
Diffstat (limited to 'pkgs/applications/editors/vim')
-rw-r--r--pkgs/applications/editors/vim/plugins/vim-utils.nix74
1 files changed, 16 insertions, 58 deletions
diff --git a/pkgs/applications/editors/vim/plugins/vim-utils.nix b/pkgs/applications/editors/vim/plugins/vim-utils.nix
index 60d4856cae6f..d11d638f4a02 100644
--- a/pkgs/applications/editors/vim/plugins/vim-utils.nix
+++ b/pkgs/applications/editors/vim/plugins/vim-utils.nix
@@ -3,7 +3,6 @@
 , runCommand, makeWrapper
 , nix-prefetch-hg, nix-prefetch-git
 , fetchFromGitHub, runtimeShell
-, hasLuaModule
 , python3
 , callPackage, makeSetupHook
 }:
@@ -52,8 +51,6 @@ this to your .vimrc should make most plugins work:
   set rtp+=~/.nix-profile/share/vim-plugins/youcompleteme
   " or for p in ["youcompleteme"] | exec 'set rtp+=~/.nix-profile/share/vim-plugins/'.p | endfor
 
-which is what the [VAM]/pathogen solutions above basically do.
-
 Learn about about plugin Vim plugin mm managers at
 http://vim-wiki.mawercer.de/wiki/topic/vim%20plugin%20managment.html.
 
@@ -168,16 +165,13 @@ let
 
   rtpPath = ".";
 
-  # Generates a packpath folder as expected by vim
+  /* Generates a packpath folder as expected by vim
+       Example:
+       packDir (myVimPackage.{ start = [ vimPlugins.vim-fugitive ]; opt = [] })
+       => "/nix/store/xxxxx-pack-dir"
+  */
   packDir = packages:
   let
-    # dir is "start" or "opt"
-    linkLuaPlugin = plugin: packageName: dir: ''
-      mkdir -p $out/pack/${packageName}/${dir}/${plugin.pname}/lua
-      ln -sf ${plugin}/share/lua/5.1/* $out/pack/${packageName}/${dir}/${plugin.pname}/lua
-      ln -sf ${plugin}/${plugin.pname}-${plugin.version}-rocks/${plugin.pname}/${plugin.version}/* $out/pack/${packageName}/${dir}/${plugin.pname}/
-    '';
-
     linkVimlPlugin = plugin: packageName: dir: ''
       mkdir -p $out/pack/${packageName}/${dir}
       if test -e "$out/pack/${packageName}/${dir}/${lib.getName plugin}"; then
@@ -242,8 +236,8 @@ let
    */
   vimrcContent = {
     packages ? null,
-    vam ? null,
-    pathogen ? null,
+    vam ? null, # deprecated
+    pathogen ? null, # deprecated
     plug ? null,
     beforePlugins ? ''
       " configuration generated by NIX
@@ -253,19 +247,6 @@ let
   }:
 
     let
-      /* pathogen mostly can set &rtp at startup time. Deprecated.
-      */
-      pathogenImpl = let
-        knownPlugins = pathogen.knownPlugins or vimPlugins;
-
-        plugins = findDependenciesRecursively (map (pluginToDrv knownPlugins) pathogen.pluginNames);
-
-        pathogenPackages.pathogen = {
-          start = plugins;
-        };
-      in
-        nativeImpl pathogenPackages;
-
       /* vim-plug is an extremely popular vim plugin manager.
       */
       plugImpl =
@@ -278,23 +259,7 @@ let
         call plug#end()
       '';
 
-      /*
-       vim-addon-manager = VAM
-
-       * maps names to plugin location
-
-       * manipulates &rtp at startup time
-         or when Vim has been running for a while
-
-       * can activate plugins laziy (eg when loading a specific filetype)
-
-       * knows about vim plugin dependencies (addon-info.json files)
-
-       * still is minimalistic (only loads one file), the "check out" code it also
-         has only gets loaded when a plugin is requested which is not found on disk
-         yet
-
-      */
+     # vim-addon-manager = VAM (deprecated)
       vamImpl =
       let
         knownPlugins = vam.knownPlugins or vimPlugins;
@@ -314,7 +279,7 @@ let
       ]
       ++ lib.optional (vam != null) (lib.warn "'vam' attribute is deprecated. Use 'packages' instead in your vim configuration" vamImpl)
       ++ lib.optional (packages != null && packages != []) (nativeImpl packages)
-      ++ lib.optional (pathogen != null) (lib.warn "'pathogen' attribute is deprecated. Use 'packages' instead in your vim configuration" pathogenImpl)
+      ++ lib.optional (pathogen != null) (throw "pathogen is now unsupported, replace `pathogen = {}` with `packages.home = { start = []; }`")
       ++ lib.optional (plug != null) plugImpl
       ++ [ customRC ];
 
@@ -444,27 +409,20 @@ rec {
   # used to figure out which python dependencies etc. neovim needs
   requiredPlugins = {
     packages ? {},
-    givenKnownPlugins ? null,
-    vam ? null,
-    pathogen ? null,
     plug ? null, ...
   }:
     let
-      # This is probably overcomplicated, but I don't understand this well enough to know what's necessary.
-      knownPlugins = if givenKnownPlugins != null then givenKnownPlugins else
-                     if vam != null && vam ? knownPlugins then vam.knownPlugins else
-                     if pathogen != null && pathogen ? knownPlugins then pathogen.knownPlugins else
-                     vimPlugins;
-      pathogenPlugins = findDependenciesRecursively (map (pluginToDrv knownPlugins) pathogen.pluginNames);
-      vamPlugins = findDependenciesRecursively (map (pluginToDrv knownPlugins) (lib.concatMap vamDictToNames vam.pluginDictionaries));
-      nonNativePlugins = (lib.optionals (pathogen != null) pathogenPlugins)
-                      ++ (lib.optionals (vam != null) vamPlugins)
-                      ++ (lib.optionals (plug != null) plug.plugins);
       nativePluginsConfigs = lib.attrsets.attrValues packages;
-      nativePlugins = lib.concatMap ({start?[], opt?[], knownPlugins?vimPlugins}: start++opt) nativePluginsConfigs;
+      nonNativePlugins = (lib.optionals (plug != null) plug.plugins);
+      nativePlugins = lib.concatMap (requiredPluginsForPackage) nativePluginsConfigs;
     in
       nativePlugins ++ nonNativePlugins;
 
+
+  # figures out which python dependencies etc. is needed for one vim package
+  requiredPluginsForPackage = { start ? [], opt ? []}:
+    start ++ opt;
+
   toVimPlugin = drv:
     drv.overrideAttrs(oldAttrs: {
       # dont move the "doc" folder since vim expects it