Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Vim plug-in that helps you publish hyperlinked, syntax highlighted source code
VimL
tag: 1.5

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
doc
Makefile
README.md
TODO.md
autoload.vim
publish.vim

README.md

Publish hyperlinked, syntax highlighted source code with Vim

The Vim text editor includes the script 2html.vim which can be used to convert a syntax highlighted buffer in Vim to an HTML document that, when viewed in a web browser, should look exactly the same. After using that script for a while and discovering the excellent Exuberant Ctags I wondered "Wouldn't it be nice to have those tags converted to hyperlinks when I publish source code as HTML?".

After several attempts I managed a working prototype, but it was quite rough around the edges and I didn't really have the time or interest to clean it up. Several months later I found myself with some free time and a renewed interest in Vim scripting so I decided to clean up my code and release it. If you're wondering what the result looks like, I've published the plug-in source code as a demonstration.

Installation & usage

Unzip the most recent ZIP archive file inside your Vim profile directory (usually this is ~/.vim on UNIX and %USERPROFILE%\vimfiles on Windows), restart Vim and try it out. Create a Vim script that calls the function Publish() as follows:

let sources = '/home/peter/.vim'
let target = 'sftp://peterodding.com/code/vim/profile'
call Publish(sources, target, [
    \ 'autoload/xolox/escape.vim',
    \ 'autoload/xolox/path.vim',
    \ 'autoload/publish.vim',
    \ 'plugin/publish.vim',
    \ ])

Change the sources and target variables to reflect your situation, save your script as ~/publish_test.vim and you can execute the script in Vim by typing :source ~/publish_test.vim and pressing Enter↵. If everything goes well Vim will be busy for a moment and after that you will find a bunch of syntax highlighted, interlinked HTML documents in the target directory!

Contact

If you have questions, bug reports, suggestions, etc. the author can be contacted at peter@peterodding.com. The latest version is available at http://peterodding.com/code/vim/publish and http://github.com/xolox/vim-publish. If you like the script please vote for it on www.vim.org.

License

This software is licensed under the MIT license.
© 2010 Peter Odding <peter@peterodding.com>.

Something went wrong with that request. Please try again.