From a5bcdc3fbb46ecdfcf2b3258e3f723270b84fbac Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Sat, 1 Apr 2023 21:41:17 +0200 Subject: neovim.tests.run_nvim_with_ftplugin: fix we shall exit neovim to allow the rest of the code to run also our ftplugin should not be loaded now that neovim loads his. --- pkgs/applications/editors/neovim/tests/default.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/editors/neovim/tests/default.nix b/pkgs/applications/editors/neovim/tests/default.nix index ad11a46b4e647..f1c38d2915dc4 100644 --- a/pkgs/applications/editors/neovim/tests/default.nix +++ b/pkgs/applications/editors/neovim/tests/default.nix @@ -58,12 +58,12 @@ let }; # this plugin checks that it's ftplugin/vim.tex is loaded before $VIMRUNTIME/ftplugin/vim.tex - # the answer is store in `plugin_was_loaded_too_late` in the cwd + # $VIMRUNTIME/ftplugin/vim.tex sources $VIMRUNTIME/ftplugin/initex.vim which sets b:did_ftplugin + # we save b:did_ftplugin's value in a `plugin_was_loaded_too_late` file texFtplugin = (pkgs.runCommandLocal "tex-ftplugin" {} '' mkdir -p $out/ftplugin - echo 'call system("echo ". exists("b:did_ftplugin") . " > plugin_was_loaded_too_late")' > $out/ftplugin/tex.vim + echo 'call system("echo ". exists("b:did_ftplugin") . " > plugin_was_loaded_too_late")' >> $out/ftplugin/tex.vim echo ':q!' >> $out/ftplugin/tex.vim - echo '\documentclass{article}' > $out/main.tex '') // { pname = "test-ftplugin"; }; # neovim-drv must be a wrapped neovim @@ -141,10 +141,12 @@ rec { # files from $VIMRUNTIME run_nvim_with_ftplugin = runTest nvim_with_ftplugin '' export HOME=$TMPDIR - ${nvim_with_ftplugin}/bin/nvim ${texFtplugin}/main.tex - result="$(cat plugin_was_loaded_too_late)" - echo $result - [ "$result" = 0 ] + echo '\documentclass{article}' > main.tex + + ${nvim_with_ftplugin}/bin/nvim main.tex -c "set ft?" -c quit + ls -l $TMPDIR + # if the file exists, then our plugin has been loaded instead of neovim's + [ ! -f plugin_was_loaded_too_late ] ''; @@ -169,7 +171,7 @@ rec { nvim_with_gitsigns_plugin = neovim.override { extraName = "-with-gitsigns-plugin"; - configure.packages.plugins = { + configure.packages.plugins = { start = [ vimPlugins.gitsigns-nvim ]; -- cgit 1.4.1