- 0 Talk
-
Using VimBall with make
Redirected from Using VimBall with 'Make'
created 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
Edit
Since all the commands in build.vim are ex-commands, you could source it with -S rather than -s, and dispense with the colons at the start of all lines. I would move the last command (to close Vim) out of the script and to a -cq! argument at the end of the command line though, to make the script easier to run from within a running Vim.
--Tonymec 01:57, September 11, 2009 (UTC)
Alternative tools to create vimballs
Edit
- mkvimball: Written in C (by the creator of vimball.vim Charles E Campbell)
- vimball.rb: Written in ruby