diff options
Diffstat (limited to 'pkgs/applications/editors/neovim/wrapper.nix')
-rw-r--r-- | pkgs/applications/editors/neovim/wrapper.nix | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/pkgs/applications/editors/neovim/wrapper.nix b/pkgs/applications/editors/neovim/wrapper.nix index 3dd3710da77..7d76bc1fd1a 100644 --- a/pkgs/applications/editors/neovim/wrapper.nix +++ b/pkgs/applications/editors/neovim/wrapper.nix @@ -72,7 +72,6 @@ let --cmd \"${if withRuby then "let g:ruby_host_prog='$out/bin/nvim-ruby'" else "let g:loaded_ruby_provider=1"}\" " \ --suffix PATH : ${binPath} \ ${optionalString withRuby '' --set GEM_HOME ${rubyEnv}/${rubyEnv.ruby.gemPath}'' } - '' + optionalString (!stdenv.isDarwin) '' # copy and patch the original neovim.desktop file @@ -83,18 +82,39 @@ let '' + optionalString withPython '' makeWrapper ${pythonEnv}/bin/python $out/bin/nvim-python --unset PYTHONPATH - '' + optionalString withPython3 '' + '' + optionalString withPython3 '' makeWrapper ${python3Env}/bin/python3 $out/bin/nvim-python3 --unset PYTHONPATH - '' + optionalString withRuby '' - ln -s ${rubyEnv}/bin/neovim-ruby-host $out/bin/nvim-ruby - '' + optionalString vimAlias '' - ln -s $out/bin/nvim $out/bin/vim - '' + optionalString viAlias '' - ln -s $out/bin/nvim $out/bin/vi - '' + optionalString (configure != {}) '' - wrapProgram $out/bin/nvim --add-flags "-u ${vimUtils.vimrcFile configure}" - '' - ; + '' + optionalString withRuby '' + ln -s ${rubyEnv}/bin/neovim-ruby-host $out/bin/nvim-ruby + '' + optionalString vimAlias '' + ln -s $out/bin/nvim $out/bin/vim + '' + optionalString viAlias '' + ln -s $out/bin/nvim $out/bin/vi + '' + optionalString (configure != {}) '' + echo "Generating remote plugin manifest" + export NVIM_RPLUGIN_MANIFEST=$out/rplugin.vim + # Launch neovim with a vimrc file containing only the generated plugin + # code. Pass various flags to disable temp file generation + # (swap/viminfo) and redirect errors to stderr. + # Only display the log on error since it will contain a few normally + # irrelevant messages. + if ! $out/bin/nvim \ + -u ${vimUtils.vimrcFile (configure // { customRC = ""; })} \ + -i NONE -n \ + -E -V1rplugins.log -s \ + +UpdateRemotePlugins +quit! > outfile 2>&1; then + cat outfile + echo -e "\nGenerating rplugin.vim failed!" + exit 1 + fi + unset NVIM_RPLUGIN_MANIFEST + + # this relies on a patched neovim, see + # https://github.com/neovim/neovim/issues/9413 + wrapProgram $out/bin/nvim \ + --set NVIM_SYSTEM_RPLUGIN_MANIFEST $out/rplugin.vim \ + --add-flags "-u ${vimUtils.vimrcFile configure}" + ''; preferLocalBuild = true; |