Because unit testing a Vim plugin is a pain in the ass.
vader.vim provides a pretty
straightforward way to test Vim plugins. But, you'll only be testing on the
version of Vim you have installed. Then there's the issue of running automated
tests with Travis-CI where you have to either:
- Build Vim from source which takes an eternity, then run your tests.
- Use the version that came with Ubuntu 12.04 which means you're only testing
your plugin's ability to run on 7.3.429.
With this base image, you can build the versions you need and reuse them in
The README is a work in progress. Take a look in the
example directory and
You will need to create your own Dockerfile, build an image, then push it to
your Docker Hub repository.
FROM testbed/vim:latest RUN install_vim -tag v7.3.429 -name vim73 -py -build \ -tag v7.4.052 -name vim74-trusty -build \ -tag master -py2 -py3 -ruby -lua -build \ -tag neovim:v0.2.0 -py2 -py3 -ruby -build \ -tag neovim:master -py2 -py3 -ruby -build
install_vim script builds one or more versions of Vim that you would like
to use for testing. Each version should be terminated with a
-build flag to
tell the script to start a build.
The following flags are available for each build:
||The Vim/Neovim release. It should be a valid tag/commit hash, with an optional GitHub repo prefix. E.g.
||The Vim flavor. Either
||The name to use for the binary's symlink. It defaults to
||Build with Python 2.|
||Build with Python 3.|
||Build with Ruby.|
||Build with Lua (implied with Neovim 0.2.1+).|
-flavor vim (the default), all other arguments (up until
passed through to
docker build -t "your/repository" .
From here you can run your tests locally (as described below), push it to your
Docker Hub repository, or setup an automated build.
docker run -it --rm -v $PWD:/testplugin -v $PWD/test:/home "your/repository" vim74 '+Vader! test/*'
The entry point for the container is a script that runs the named Vim version.
In this case
vim74. Arguments after the name is passed to Vim.
The entry point script prefixes your arguments with
-u /home/vimrc -i NONE.
They can be overridden with your arguments.
The base image is created with automated testing in mind. It is not meant to
be built every time you run tests. An unprivileged user
vimtest is used to
run Vim to prevent files from being written back to your work directory. This
means that it won't be able to download/install plugins into a mapped volume.
To deal with this, your test
vimrc could add known paths within the container
rtp, and your
Dockerfile could install the plugins into that location.
This image provides a helper script that should be sourced at the top of your
It will add
/home/vim/after to the runtime path, and search
for plugins in
Two volumes are provided:
|/home||The user directory.|
|/testplugin||The directory for your plugin.|