Navigation Menu

Skip to content

Commit

Permalink
Merge remote-tracking branch 'greyblake/master'
Browse files Browse the repository at this point in the history
Conflicts:
	README.markdown
	plugin/preview.vim
  • Loading branch information
spf13 committed Jun 16, 2011
2 parents 223f58d + 473976b commit 1d9183e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
8 changes: 7 additions & 1 deletion README.markdown
Expand Up @@ -18,6 +18,7 @@ The plugin supports the next formats:
* textile - depends on `RedCloth` ruby gem
* html(htm)
* ronn - depends on `ronn` ruby gem
* reStructuredText(rst) - depends on `RbST` ruby gem and `rst2html` system util


## Dependencies
Expand All @@ -32,6 +33,9 @@ If output is `1` the ruby interpreter is builtin.
The second thing you should verify is that you have installed all necessary
ruby gems. Please see "Supported Formats" section to find out what gems you need.

For reStructuredText(rst) format except `RbST` ruby gem you also need `rst2html`.
To get `rst2html` util you probably should install `python-docutils` package. Otherwise PreviewRst vim command will show empty html file.


## Installation

Expand All @@ -54,13 +58,15 @@ If you found a bug, please report it. Or better send me a pull request:)

* Make more unique names for temporary files than just base name ending with `.html`. There should be `vim_preview` prefix, PID of Vim and number of buffer to guarantee avoiding conflicts.
* Add ability to use alternative gems for processing markdown and other formats.
* Handle exception when 'rubygems' is not found.


## Credits

* [Donald Ephraim Curtis](https://github.com/decurtis) - some support for OSX and Safari, fixing bugs
* [Sung Pae](https://github.com/guns) - fixing bugs
* [Steve Francia](https://github.com/spf13) - better OSX support
* [Steve Francia](https://github.com/spf13) - fixing bugs
* [Rdark](https://github.com/rdark) - support for ronn file format


## License
Expand Down
23 changes: 18 additions & 5 deletions plugin/preview.vim
Expand Up @@ -2,10 +2,10 @@
" File: preview.vim
" Description: Vim global plugin to preview markup files(markdown,rdoc,textile)
" Author: Sergey Potapov (aka Blake) <blake131313 AT gmail DOT com>
" Version: 0.5
" Version: 0.7
" Homepage: http://github.com/greyblake/vim-preview
" License: GPLv2+ -- look it up.
" Copyright: Copyright (C) 2010 Sergey Potapov (aka Blake)
" Copyright: Copyright (C) 2010-2011 Sergey Potapov (aka Blake)
"
" This program is free software; you can redistribute it and/or
" modify it under the terms of the GNU General Public License as
Expand All @@ -23,7 +23,6 @@
" MA 02111-1307 USA
" ============================================================================


function s:PreviewVerifyRuby()
if has('ruby')
return 1
Expand Down Expand Up @@ -69,17 +68,28 @@ function! s:PreviewRonn()
endif
endfunction

function! s:PreviewRst()
if(s:PreviewVerifyRuby())
call preview#show_rst()
endif
endfunction

" Commands
command! Preview call s:Preview()
command! PreviewMarkdown call s:PreviewMarkdown()
command! PreviewTextile call s:PreviewTextile()
command! PreviewRdoc call s:PreviewRdoc()
command! PreviewHtml call s:PreviewHtml()
command! PreviewRonn call s:PreviewRonn()
command! PreviewRst call s:PreviewRst()

" Default options
if(!exists('g:PreviewBrowsers'))
let g:PreviewBrowsers = 'open,firefox,safari,chromium-browser,epiphany,google-chrome,opera'
if(system("uname") =~ "Darwin")
let g:PreviewBrowsers = 'open,safari,firefox,chromium-browser,epiphany,google-chrome,opera'
else
let g:PreviewBrowsers = 'firefox,safari,chromium-browser,epiphany,google-chrome,opera'
endif
endif
if(!exists('g:PreviewCSSPath'))
let g:PreviewCSSPath = ''
Expand All @@ -94,11 +104,14 @@ if(!exists('g:PreviewRdocExt'))
let g:PreviewRdocExt = 'rdoc'
endif
if(!exists('g:PreviewHtmlExt'))
let g:PreviewHtmlExt = 'html,htm'
let g:PreviewHtmlExt = 'html,htm,xht,xhtm,xhtml'
endif
if(!exists('g:PreviewRonnExt'))
let g:PreviewRonnExt = 'ronn'
endif
if(!exists('g:PreviewRstExt'))
let g:PreviewRstExt = 'rst,reStructuredText,restructuredtext'
endif

" Default mapping
:nmap <Leader>P :Preview<CR>

0 comments on commit 1d9183e

Please sign in to comment.