{"id":19039426,"url":"https://github.com/xolox/vim-publish","last_synced_at":"2025-07-17T23:07:32.550Z","repository":{"id":932199,"uuid":"703157","full_name":"xolox/vim-publish","owner":"xolox","description":"A Vim plug-in that helps you publish hyperlinked, syntax highlighted source code","archived":false,"fork":false,"pushed_at":"2013-08-19T19:30:28.000Z","size":232,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-03T08:08:33.417Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://peterodding.com/code/vim/publish/","language":"VimL","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xolox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-06-04T12:13:33.000Z","updated_at":"2020-12-03T03:47:02.000Z","dependencies_parsed_at":"2022-07-18T04:00:29.252Z","dependency_job_id":null,"html_url":"https://github.com/xolox/vim-publish","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/xolox/vim-publish","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolox%2Fvim-publish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolox%2Fvim-publish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolox%2Fvim-publish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolox%2Fvim-publish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xolox","download_url":"https://codeload.github.com/xolox/vim-publish/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolox%2Fvim-publish/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265677390,"owners_count":23809955,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T22:12:52.647Z","updated_at":"2025-07-17T23:07:32.505Z","avatar_url":"https://github.com/xolox.png","language":"VimL","readme":"# Publish hyperlinked, syntax highlighted source code with Vim\n\nThe [Vim text editor](http://www.vim.org/) includes the script [2html.vim](http://vimdoc.sourceforge.net/htmldoc/syntax.html#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](http://ctags.sourceforge.net/) I wondered *\"Wouldn't it be nice to have those tags converted to hyperlinks when I publish source code as HTML?\"*.\n\nAfter 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](http://peterodding.com/code/vim/profile/plugin/publish.vim) as a demonstration.\n\n## Installation \u0026 usage\n\n*Please note that the vim-publish plug-in requires my vim-misc plug-in which is separately distributed.*\n\nUnzip the most recent ZIP archives of the [vim-publish](http://peterodding.com/code/vim/downloads/publish.zip) and [vim-misc](http://peterodding.com/code/vim/downloads/misc.zip) plug-ins 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). If you prefer you can also use [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332), [Vundle](https://github.com/gmarik/vundle) or a similar tool to install \u0026 update the [vim-publish](https://github.com/xolox/vim-publish) and [vim-misc](https://github.com/xolox/vim-misc) plug-ins using a local clone of the git repository.\n\nAs 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:\n\n    $ ctags -Rf ~/.publish_tags ~/.vim/\n\nIf this doesn't work because [ctags](http://vimdoc.sourceforge.net/htmldoc/tagsrch.html#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:\n\n    $ sudo apt-get install exuberant-ctags\n\nThe plug-in needs an up-to-date tags file so that it can create hyperlinks 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:\n\n    :set tags=~/.publish_tags\n    :let sources = '/home/peter/.vim'\n    :let target = 'sftp://peterodding.com/code/vim/profile'\n    :call Publish(sources, target, [\n        \\ 'autoload/xolox/escape.vim',\n        \\ 'autoload/xolox/path.vim',\n        \\ 'autoload/publish.vim',\n        \\ 'plugin/publish.vim',\n        \\ ])\n\nChange the `sources` and `target` variables to reflect your situation, save the script as `~/publish_test.vim` and try it in Vim by executing the command `:source ~/publish_test.vim`. 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!\n\n## Publishing to a remote location (website)\n\nAs you can see from the example above it's possible to publish files directly to your web server using the [netrw plug-in](http://vimdoc.sourceforge.net/htmldoc/pi_netrw.html#netrw) that's bundled with Vim, simply by starting the `target` path with `sftp://`. All you need for this to work is the ability to establish [SCP](http://en.wikipedia.org/wiki/Secure_copy) connections to your server. There are however two disadvantages to remote publishing over [SFTP](http://en.wikipedia.org/wiki/SSH_file_transfer_protocol):\n\n1. The `publish.vim` plug-in can't automatically create directories on the remote side, which means you'll have to do so by hand -- very bothersome.\n\n2. It can take a while to publish a dozen files because a new connection is established for every file that's uploaded to the remote location.\n\nAs a workaround to both of these issues the `publish.vim` plug-in will automatically use [rsync](http://en.wikipedia.org/wiki/rsync) when both the local and remote system have it installed. This cuts the time to publish to a remote location in half and enables the plug-in to automatically create directories on the remote side.\n\n## Contact\n\nIf you have questions, bug reports, suggestions, etc. the author can be contacted at \u003cpeter@peterodding.com\u003e. The latest version is available at \u003chttp://peterodding.com/code/vim/publish/\u003e and \u003chttp://github.com/xolox/vim-publish\u003e. If you like the script please vote for it on [Vim Online](http://www.vim.org/scripts/script.php?script_id=2252).\n\n## License\n\nThis software is licensed under the [MIT license](http://en.wikipedia.org/wiki/MIT_License).  \n© 2013 Peter Odding \u0026lt;\u003cpeter@peterodding.com\u003e\u0026gt;.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxolox%2Fvim-publish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxolox%2Fvim-publish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxolox%2Fvim-publish/lists"}