Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
vim, your markup language of choice, and your browser of choice.
tree: e4498fcf8d

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
plugin/hammer.vim
.gitignore
LICENSE
README.md

README.md

Hammer Mario!

Hammer.vim can translate a bunch of markup languages to HTML, and preview them in your browser of choice. All from within vim!
By default, the preview is a clone of how GitHub would render README.md, but custom templates of your own are supported too.

This project was formerly vim-markdown-preview.

Supported Markup

Anything github-markup supports:

  • .markdown -- gem install redcarpet
  • .textile -- gem install RedCloth
  • .rdoc
  • .org -- gem install org-ruby
  • .creole -- gem install creole
  • .mediawiki -- gem install wikicloth
  • .rst -- easy_install docutils
  • .asciidoc -- brew install asciidoc
  • .pod -- Pod::Simple::HTML comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN.
  • .1 -- Requires groff
  • .html
  • .xhtml

Requirements

  • vim built with Ruby support.
  • github-markup (See install instructions)
  • You might need to install an extra dependency depending on the markup language you want to render (See Above).

Install

$ [sudo] gem install github-markup
$ git clone git://github.com/robgleeson/hammer.vim.git
$ cp -R hammer.vim/plugin/* $HOME/.vim/plugin

Usage

The :Hammer command will try to draw a preview of whatever file is currently in your buffer.
It helps to map it to a key though, and I personally use: map <leader>p :Hammer<CR>

There are a few options, too:

  • g:HammerTemplate
    The template to render with. Default is default, a GitHub-esque design.

  • g:HammerDirectory
    Where previews are written to.
    Default is %TEMP% on Windows, and /tmp on everything else.

  • g:HammerBrowser
    The template to open the preview with. Default is OS-dependent.
    open on OSX, start on Windows, and xdg-open on xorg-running machines.

Templates!

If you don't like the default template, you can write your own.
Templates are ERB layouts with rendered markup passed on as a partial.
Templates have access to paths used by Hammer, so you can link to assets(CSS, etc) easily.

The default template serves as a good example to get you going.
Pull requests for new templates would be awesome ;-)

Screenshots

Thanks

Many thanks to the @github team for github-markup!

License

Hammer.vim is released under the MIT License.
See LICENSE for details.

Something went wrong with that request. Please try again.