diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2022-08-12 12:02:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-12 12:02:19 +0000 |
commit | a1c35707dfcad3b9ea73e8bb7ad8fff71882cf51 (patch) | |
tree | 0fd298525cf938d02ad47eb36cd27ee13b4b0ee8 /pkgs/applications/editors/vim | |
parent | 5baece7f77363bb1791bc13bb9ef6bc7edf31dd4 (diff) | |
parent | 71344f23b354d1cfd528329ea82dce0c486d3179 (diff) | |
download | nixlib-a1c35707dfcad3b9ea73e8bb7ad8fff71882cf51.tar nixlib-a1c35707dfcad3b9ea73e8bb7ad8fff71882cf51.tar.gz nixlib-a1c35707dfcad3b9ea73e8bb7ad8fff71882cf51.tar.bz2 nixlib-a1c35707dfcad3b9ea73e8bb7ad8fff71882cf51.tar.lz nixlib-a1c35707dfcad3b9ea73e8bb7ad8fff71882cf51.tar.xz nixlib-a1c35707dfcad3b9ea73e8bb7ad8fff71882cf51.tar.zst nixlib-a1c35707dfcad3b9ea73e8bb7ad8fff71882cf51.zip |
Merge staging-next into staging
Diffstat (limited to 'pkgs/applications/editors/vim')
-rw-r--r-- | pkgs/applications/editors/vim/plugins/vim-utils.nix | 74 |
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 |