Unverified Commit 68835d4f authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

wrapNeovimUnstable: do not generate empty init.vim file (#404061)

parents 95115cb4 7102d2f9
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -260,6 +260,21 @@ pkgs.recurseIntoAttrs (rec {
    [ "$result" = 0 ]
  '';

  # Generate a neovim wrapper with only a init.lua and no init.vim file
  nvim_with_only_init_lua = wrapNeovim2 "-only-lua-init-file" {
    luaRcContent = "-- some text";
  };

  # check that we do not generate an init.vim file if it is not needed
  no_init_vim_file = runTest nvim_with_only_init_lua ''
    ${nvim_with_only_init_lua}/bin/nvim -i NONE -e --headless -c 'if len(getscriptinfo({"name":"init.vim"})) == 0 | quit | else | cquit | fi'
    # This does now work because the lua file is sourced via loadfile() which
    # does not add the file name to :scriptnames and getscriptinfo().
    #${nvim_with_only_init_lua}/bin/nvim -i NONE -e --headless -c 'if len(getscriptinfo({"name":"init.lua"})) == 1 | quit | else | cquit | fi'

    assertFileRegex ${nvim_with_only_init_lua}/bin/nvim 'VIMINIT=.*init.lua'
  '';

  # 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: {
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ let
          ''
            ${luaRcContent}
          ''
          + lib.optionalString (neovimRcContent' != null) ''
          + lib.optionalString (neovimRcContent' != "") ''
            vim.cmd.source "${writeText "init.vim" neovimRcContent'}"
          ''
          + lib.concatStringsSep "\n" luaPluginRC;