diff src/testdir/shared.vim @ 9778:4360b2b46125 v7.4.2164

commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 6 19:01:55 2016 +0200 patch 7.4.2164 Problem: It is not possible to use plugins in an "after" directory to tune the behavior of a package. Solution: First load plugins from non-after directories, then packages and finally plugins in after directories. Reset 'loadplugins' before executing --cmd arguments.
author Christian Brabandt <cb@256bit.org>
date Sat, 06 Aug 2016 19:15:06 +0200
parents 9f8f03a44886
children 3fdf6caf42f7
line wrap: on
line diff
--- a/src/testdir/shared.vim
+++ b/src/testdir/shared.vim
@@ -120,3 +120,24 @@ func WaitFor(expr)
     sleep 10m
   endfor
 endfunc
+
+" Run Vim, using the "vimcmd" file and "-u NORC".
+" "before" is a list of commands to be executed before loading plugins.
+" "after" is a list of commands to be executed after loading plugins.
+" Plugins are not loaded, unless 'loadplugins' is set in "before".
+" Return 1 if Vim could be executed.
+func RunVim(before, after)
+  if !filereadable('vimcmd')
+    return 0
+  endif
+  call writefile(a:before, 'Xbefore.vim')
+  call writefile(a:after, 'Xafter.vim')
+
+  let cmd = readfile('vimcmd')[0]
+  let cmd = substitute(cmd, '-u \f\+', '-u NONE', '')
+  exe "silent !" . cmd . " --cmd 'so Xbefore.vim' -S Xafter.vim"
+
+  call delete('Xbefore.vim')
+  call delete('Xafter.vim')
+  return 1
+endfunc