Vim Tips Wiki
Advertisement
Tip 1601 Printable Monobook Previous Next

created August 14, 2008 · complexity basic · author Mahlonsmith · version 7.0


If you're a plugin developer, your plugin has multiple files (which should be the case since you're distributing documentation too, right?), and want to distribute everything as a nice little bundled package, then you should become familar with Charles Campbell's VimBall plugin.

You can use a Makefile and a series of Vim commands to automatically update your project's vimball on changes, for a sort of poor-man Vim automated build.

The Makefile should look something like this:

PLUGIN = specky

SOURCE = syntax/rdoc.vim
SOURCE += syntax/specrun.vim
SOURCE += doc/specky.txt
SOURCE += plugin/specky.vim

${PLUGIN}.vba: ${SOURCE}
	vim --cmd 'let g:plugin_name="${PLUGIN}"' -s build.vim

install:
	rsync -Rv ${SOURCE} ${HOME}/.vim/

clean:
	rm ${PLUGIN}.vba

Include each file that is part of your plugin as a SOURCE line. (This example is from the specky plugin.)

The 'vim -s build.vim' command loads Vim directives from a file. Here's the file I use to create the Vimball.

:let g:vimball_home = "."
:e Makefile
:v/^SOURCE/d
:%s/^SOURCE\s\++\?=\s\+//
:execute '%MkVimball!' . g:plugin_name
:q!

This says to parse the SOURCE lines out of the Makefile, and feed them to a vimball. The resulting file (in this example) will be called "specky.vba". As you add (or remove) files, you can just update the Makefile -- no need to change anything else.

In this fashion, as you update your code, you can just type "make", and have a packaged up Vimball that is ready for distribution.

Comments

Advertisement