sponsor Vim development Vim logo Vim Book Ad

publish.vim : Publish hyperlinked, highlighted source code using Vim, 2html.vim and rsync

 script karma  Rating 17/5, Downloaded by 5678  Comments, bugs, improvements  Vim wiki

created by
Peter Odding
 
script type
utility
 
description
This plug-in uses the 2html.vim script included with Vim's runtime files to publish a collection of syntax highlighted files as HTML documents and then replaces identifiers such as function and variable names in the HTML output with hyper links (based on available tags as generated by Exuberant Ctags). The result is a directory (tree) of syntax highlighted, interlinked HTML documents. I've published the plug-in's source code as a demonstration at http://peterodding.com/code/vim/profile/plugin/publish.vim. For more information about the plug-in please refer to its homepage or the project page on GitHub:

http://peterodding.com/code/vim/publish/
http://github.com/xolox/vim-publish

If you have questions, bug reports, suggestions, etc. the author can be contacted at [email protected]. If you like this plug-in please vote for it below!
 
install details
Unzip the most recent ZIP archive file (see below) inside your Vim profile directory (usually this is "~/.vim" on UNIX and "%USERPROFILE%\vimfiles" on Windows), restart Vim and execute the command ":helptags ~/.vim/doc" (use ":helptags ~\vimfiles\doc" instead on Windows).

As an example we'll publish the plug-in using itself. First create a tags file that contains entries for the files you want to publish using a shell command such as:

    ctags -Rf ~/.publish_tags ~/.vim/

If this doesn't work because "ctags" isn't installed you can download it from the Exuberant Ctags homepage http://ctags.sourceforge.net/ or if you're running Debian/Ubuntu you can install it by executing the following shell command:

    sudo apt-get install exuberant-ctags

The plug-in needs an up-to-date tags file so that it can create hyper links between the published files. Now start Vim and write a script that registers the tags file you just created and calls the function Publish() as follows:

    set tags=~/.publish_tags
    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 the script as "~/publish_test.vim" and execute it in Vim by typing ":source ~/publish_test.vim" (without the quotes) 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!
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
publish.zip 1.7.14 2013-08-19 7.0 Peter Odding • Remove compatibility checking of miscellaneous scripts:
   http://github.com/xolox/vim-publish/commit/fecbb5e
> • Cleaned up old miscellaneous scripts:
  
http://github.com/xolox/vim-publish/commit/cc0c218
> • Document vim-misc as external dependency:
  
http://github.com/xolox/vim-publish/commit/4cb3c4c
> • Make sure vim-misc is installed, politely complain if it isn't:
  
http://github.com/xolox/vim-publish/commit/4aa630e
publish.zip 1.7.13 2013-05-20 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-publish/commit/47adaca
publish.zip 1.7.12 2013-05-19 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-publish/commit/89cfda3
publish.zip 1.7.11 2013-05-13 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-publish/commit/ace88ae
  
; http://github.com/xolox/vim-publish/commit/9c88b0e
publish.zip 1.7.10 2013-05-02 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-publish/commit/3ef4495
publish.zip 1.7.9 2013-04-28 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-publish/commit/24c2a1b
publish.zip 1.7.8 2013-04-21 7.0 Peter Odding • Make compatibility with miscellaneous scripts explicit:
   http://github.com/xolox/vim-publish/commit/6e3ba5c
publish.zip 1.7.7 2011-11-26 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-publish/commit/3025ff5
  
; http://github.com/xolox/vim-publish/commit/5ddefd0
  
; http://github.com/xolox/vim-publish/commit/9b4c774
publish.zip 1.7.6 2011-11-21 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-publish/commit/ca5f8f4
publish.zip 1.7.5 2011-09-25 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-publish/commit/8f196b6
publish.zip 1.7.4 2011-09-04 7.0 Peter Odding • Move version variable to autoload script, include in every message:
   http://github.com/xolox/vim-publish/commit/f0d2b02
> • Updated miscellaneous scripts
publish.zip 1.7.1 2010-09-05 7.0 Peter Odding • Bug fix: Avoid Vim's hit-enter prompt:
   http://github.com/xolox/vim-publish/commit/7a2705cbdcefa12116f6ca007af9683729c2b37a

• Instrumented plug-in with xolox#timer#* calls:
   http://github.com/xolox/vim-publish/commit/514a5f7be3b5d09dc8a944fd594ce1fbd0e17e1b

• Proper HTML encoding, foolproof publish#customize_html():
   http://github.com/xolox/vim-publish/commit/be773a134cf404723cc463ab034eaf0b26f7d279

• Bug fix: Make 2html ignore text folding:
   http://github.com/xolox/vim-publish/commit/892be723e17dbfd21bec0d72d600519e26e0f6c1

• Bug fix: Proper escaping in pattern_to_lnum():
   http://github.com/xolox/vim-publish/commit/43c57b7a8b2d5b030fc3c539df293d0bb350840b

• Bug fix: Proper escaping in create_subst_cmd() to avoid E33:
   http://github.com/xolox/vim-publish/commit/4fa75be69245eb5723279793e4a587bb3848aa6c

• Bug fix for publish#html_encode():
   http://github.com/xolox/vim-publish/commit/5df4c3d750654a330e077eb96a781c9b8d4dab7c

• Simplified tags -> hyperlinks conversion hack:
   http://github.com/xolox/vim-publish/commit/459b8293a2a85885872603765699a210fe72fb74

• Smarter integration with easytags.vim:
   http://github.com/xolox/vim-publish/commit/be98f4328bb631cd4c67d8951ff7c413b7cb6355

• Fixed easytags#update() to overcome argument limit:
   http://github.com/xolox/vim-publish/commit/87b0305bd27d4ee3715790cddc76cc2cfead7c14
publish.zip 1.6 2010-06-15 7.0 Peter Odding * Bug fix for :doautocmd User PublishPre hook:
  http://github.com/xolox/vim-publish/commit/964e4dbb486f203ae7a1cb426af9491f44225db1

* Bug fix: Escape ~ in tag search patterns:
  http://github.com/xolox/vim-publish/commit/2da32565a73c0a9ab25d4fd9b0f6626336202d07

* Improved handling of VimL script-local functions:
  http://github.com/xolox/vim-publish/commit/537fe778d8bec47001367193323a813c3333d038

* Always prefer earlier tag definitions in the same document:
  http://github.com/xolox/vim-publish/commit/17b9e7563464da908baf45870831599e2bc9c809

* Faster remote publishing using rsync (automatically enabled):
  http://github.com/xolox/vim-publish/commit/027a2f0f4f8ccd6a7f1739f023b4825944e71b57
publish.zip 1.5.2 2010-06-06 7.0 Peter Odding Now includes generated Vim documentation based on README
publish.zip 1.5.1 2010-06-05 7.0 Peter Odding Bug fix: Fixed usage instructions to include tags generation :-\
http://github.com/xolox/vim-publish/commit/8eee22a18373125398d853dc3848d4101865576b
publish.zip 1.5 2010-06-05 7.0 Peter Odding Completely switched directions by forgetting about incremental, automatic publishing (which interferes with the user because "2html.vim" is too slow) and instead focusing on batch publishing of multiple related files, which means the plug-in can now include hyperlinks between the published files based on tags.
publish.vim 1.0 2008-05-25 7.0 Peter Odding Initial upload
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github