publish 1.0

publish is a Vim plugin that allows you to publish syntax highlighted buffers automatically.
publish is a Vim plugin that allows you to publish syntax highlighted buffers automatically.

Developer comments

Vim has been my favorite and only editor for several years now.
I've customized and written several syntax highlighting modes and everything is set up the way I like it. When I stumbled unto the :TOhtml command I realized Vim could be used to publish source-code on my website. This plugin makes it as easy as :update.


When you've defined the global variables 'publish_pattern' and 'publish_directory' this plugin will automatically publish your buffers whenyou save them. The value of 'publish_pattern' is used as a pattern to search for within the first ten lines of the buffer. If it matches a line, the capture of the first subpattern will be appended to the filepath defined by 'publish_directory' to get the filepath to which the buffer should be published. When the directory 'publish_directory' does not exist you'll be prompted whether you want to temporarily disable automatic publishing. You can do this manually as well by defining 'publish_automatic' to 0. Several globals can be used to change the way your buffers are published, they are the keys documented for the Publish() function prefixed with 'publish_'.


If you don't like the autocommand but want to publish Vim buffers from your own scripts you can use the function Publish(path [, options]).
Several key/value pairs are supported in the 'options' dictionary:

colors: Colorscheme to use for publishing the buffer;
title: Unencoded content of the < title > element;
header: HTML to insert just before the end of < head >;
linkify: Replace e-mail addresses with obfuscated hyper links.

Note that this plugin overwrites existing files.




Copy the script to your plugin directory, e.g. ~/.vim/plugin/ on UNIX

last updated on:
July 1st, 2008, 12:57 GMT
developed by:
Peter Odding
license type:
GPL (GNU General Public License) 
ROOT \ Text Editing&Processing \ Vim Plugins
Download Button

In a hurry? Add it to your Download Basket!

user rating 12



Rate it!

Add your review!