summary refs log tree commit diff
path: root/pkgs/applications/editors/neovim
diff options
context:
space:
mode:
authorMatthieu Coudron <mcoudron@hotmail.com>2023-04-01 21:41:17 +0200
committerMatthieu Coudron <mcoudron@hotmail.com>2023-04-01 22:26:57 +0200
commita5bcdc3fbb46ecdfcf2b3258e3f723270b84fbac (patch)
tree8064019564975224d26c16413a3d572f37f678db /pkgs/applications/editors/neovim
parent67f6f13c2eac885bf379fc0f4abea928c735629c (diff)
downloadnixpkgs-a5bcdc3fbb46ecdfcf2b3258e3f723270b84fbac.tar
nixpkgs-a5bcdc3fbb46ecdfcf2b3258e3f723270b84fbac.tar.gz
nixpkgs-a5bcdc3fbb46ecdfcf2b3258e3f723270b84fbac.tar.bz2
nixpkgs-a5bcdc3fbb46ecdfcf2b3258e3f723270b84fbac.tar.lz
nixpkgs-a5bcdc3fbb46ecdfcf2b3258e3f723270b84fbac.tar.xz
nixpkgs-a5bcdc3fbb46ecdfcf2b3258e3f723270b84fbac.tar.zst
nixpkgs-a5bcdc3fbb46ecdfcf2b3258e3f723270b84fbac.zip
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.
Diffstat (limited to 'pkgs/applications/editors/neovim')
-rw-r--r--pkgs/applications/editors/neovim/tests/default.nix18
1 files changed, 10 insertions, 8 deletions
diff --git a/pkgs/applications/editors/neovim/tests/default.nix b/pkgs/applications/editors/neovim/tests/default.nix
index ad11a46b4e6..f1c38d2915d 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
       ];