Unverified Commit 6e80a55c authored by Matthieu Coudron's avatar Matthieu Coudron Committed by GitHub
Browse files

deprecate neovimUtils.makeNeovimConfig (#499573)

parents 8a1210cc 0ae3b043
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@
- neovim lua dependencies are now set in the generated init.lua instead of
  modifying LUA_PATH in the wrapper. Commands run pre-vimrc via `nvim --cmd
  "require'LUA_MODULE'"` may
  not find their lua dependencies anymore. Use `nvim -c "lua require'LUA_MODULE'"` instead to run these commands after loading `init.lua`.
  not find their lua dependencies anymore. Use `nvim -c "lua require'LUA_MODULE'"` instead to run these commands after loading `init.lua`. If you use `wrapNeovim` with `wrapRc` set to `false`, you may lose the lua dependencies if you are not loading the generated `init.lua`.

- We now use the upstream wrapper script for Gradle, supporting both the `JAVA_HOME` and `GRADLE_OPTS` environment variables.

+10 −12
Original line number Diff line number Diff line
@@ -43,27 +43,27 @@ let
    }
  ];

  nvimConfSingleLines = makeNeovimConfig {
  nvimConfSingleLines = {
    plugins = packagesWithSingleLineConfigs;
    customRC = ''
    neovimRcContent = ''
      " just a comment
    '';
  };

  nvimConfNix = makeNeovimConfig {
  nvimConfNix = {
    inherit plugins;
    customRC = ''
    neovimRcContent = ''
      " just a comment
    '';
  };

  nvim-with-luasnip = wrapNeovim2 "-with-luasnip" (makeNeovimConfig {
  nvim-with-luasnip = wrapNeovim2 "-with-luasnip" {
    plugins = [
      {
        plugin = vimPlugins.luasnip;
      }
    ];
  });
  };

  # build should fail with a wrong
  nvim-run-failing-check =
@@ -74,8 +74,6 @@ let
        doCheck = true;
      };

  nvimAutoDisableWrap = makeNeovimConfig { };

  wrapNeovim2 =
    suffix: config:
    wrapNeovimUnstable neovim-unwrapped (
@@ -308,15 +306,15 @@ pkgs.lib.recurseIntoAttrs rec {
  '';

  # nixpkgs should detect that no wrapping is necessary
  nvimShouldntWrap = wrapNeovim2 "-should-not-wrap" nvimAutoDisableWrap;
  nvimShouldntWrap = wrapNeovim2 "-should-not-wrap" { };

  # this will generate a neovimRc content but we disable wrapping
  nvimDontWrap = wrapNeovim2 "-forced-nowrap" (makeNeovimConfig {
  nvimDontWrap = wrapNeovim2 "-forced-nowrap" {
    wrapRc = false;
    customRC = ''
    neovimRcContent = ''
      " this shouldn't trigger the creation of an init.vim
    '';
  });
  };

  force-nowrap = runTest nvimDontWrap ''
    ! grep -F -- ' -u' ${nvimDontWrap}/bin/nvim
+32 −49
Original line number Diff line number Diff line
@@ -146,6 +146,9 @@ let
    let
      luaEnv = neovim-unwrapped.lua.withPackages extraLuaPackages;
    in
    lib.warn
      "neovimUtils.makeNeovimConfig is deprecated. Use wrapNeovim or wrapNeovimUnstable directly."
      (
        attrs
        // {
          neovimRcContent = customRC;
@@ -164,27 +167,17 @@ let
            ";"
            (neovim-unwrapped.lua.pkgs.luaLib.genLuaCPathAbsStr luaEnv)
          ];
    };
        }
      );

  # to keep backwards compatibility for people using neovim.override
  legacyWrapper =
    neovim:
    {
      extraMakeWrapperArgs ? "",
      # the function you would have passed to python.withPackages
      extraPythonPackages ? (_: [ ]),
      # the function you would have passed to python.withPackages
      withPython3 ? false,
      extraPython3Packages ? (_: [ ]),
      # the function you would have passed to lua.withPackages
      extraLuaPackages ? (_: [ ]),
      withNodeJs ? false,
      withRuby ? false,
      vimAlias ? false,
      viAlias ? false,
      configure ? { },
      extraName ? "",
    }:
      ...
    }@attrs:
    let

      # we convert from the old configure.format to
@@ -205,26 +198,16 @@ let
          optional = true;
        }) opt);

      res = makeNeovimConfig {
        inherit withPython3;
        inherit extraPython3Packages;
        inherit extraLuaPackages;
        inherit
          withNodeJs
          withRuby
          viAlias
          vimAlias
          ;
        customRC = configure.customRC or "";
        customLuaRC = configure.customLuaRC or "";
        inherit plugins;
        inherit extraName;
      };
    in
    wrapNeovimUnstable neovim (
      res
      attrs
      // {
        wrapperArgs = lib.escapeShellArgs res.wrapperArgs + " " + extraMakeWrapperArgs;
        neovimRcContent = configure.customRC or "";
        luaRcContent = configure.customLuaRC or "";
        inherit plugins;

        wrapperArgs = lib.escapeShellArgs (attrs.wrapperArgs or [ ]) + " " + extraMakeWrapperArgs;

        wrapRc = configure != { };
        legacyWrapper = true;
      }
+0 −1
Original line number Diff line number Diff line
@@ -51,7 +51,6 @@ let
      vimAlias ? false,
      viAlias ? false,

      # additional argument not generated by makeNeovimConfig
      # it sets the VIMINIT environment variable to "lua dofile('${customRc}')"
      # set to false if you want to control where to save the generated config
      # (e.g., in ~/.config/init.vim or project/.nvimrc)