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.
This commit is contained in:
Matthieu Coudron 2023-04-01 21:41:17 +02:00
parent 67f6f13c2e
commit a5bcdc3fbb

View file

@ -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
];