Skip to content
Browse files

Release

  • Loading branch information...
0 parents commit 624e177e736a3ca6ec09fc4862ea3a6e97e3fab8 Rafael Mendonça França committed Nov 6, 2011
Showing with 115 additions and 0 deletions.
  1. +20 −0 MIT-LICENSE
  2. +59 −0 README.md
  3. +36 −0 plugin/rtf_pygmentize.vim
20 MIT-LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2011 Rafael França
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
59 README.md
@@ -0,0 +1,59 @@
+# RTF Pygmentize
+
+This plugin is used to syntax highlight pieces of code to RTF and it automatically copies it to the OSX clipboard.
+This was basically done to scratch an itch while building my keynote presentations.
+
+This plugin is basically a wraper around [pygments](http://pygments.org/) library.
+
+## Dependencies
+
+For now, this plugin only works on MacOS X but I would be grateful if someone make it works in others systems
+
+To use it we need the pygments lubrary. To install use the easy_install packet manage with:
+
+```
+easy_install pygments
+```
+
+## Configuration
+
+You can configure this plugin using two options
+
+```vim
+" Are valid options: 'default', 'emacs', 'friendly' and 'colorful'
+let g:rtfp_theme = 'emacs'
+```
+
+and
+
+```vim
+let g:rtfp_font = 'Monaco'
+```
+
+## Usage
+
+To highlight a file, simply use:
+
+```vim
+:RTFPygmentize
+```
+
+You can also specify the language to use on highlight with:
+
+```vim
+:RTFPygmentize <lang>
+```
+
+It also works on visual selections.
+
+## Inspiration
+
+This Vim plugin is inspired at [rtf-highlight](https://github.com/dharanasoft/rtf-highlight) plugin
+
+## Maintainers
+
+Rafael Mendonça França (https://github.com/rafaelfranca)
+
+## License
+
+MIT License. Copyright 2011 Rafael França
36 plugin/rtf_pygmentize.vim
@@ -0,0 +1,36 @@
+" rtf_pygmentize.vim
+" Rafael França <rafaelmfranca at gmail dot com>
+"
+" License
+" This program is under a MIT License
+
+" syntax theme
+" Are valid options: 'default', 'emacs', 'friendly' and 'colorful'
+if !exists('g:rtfp_theme')
+ let g:rtfp_theme = 'default'
+end
+
+" Text font
+if !exists('g:rtfp_font')
+ let g:rtfp_font = 'Menlo'
+end
+
+function! RTFPygmentize(line1,line2,...)
+ if !executable('pygmentize')
+ echoerr "Bummer! pygments not found."
+ return
+ endif
+
+ let ft = a:0 ? a:1 : &filetype
+
+ if ft == "eruby"
+ let ft = "rhtml"
+ endif
+
+ let content = join(getline(a:line1,a:line2),"\n")
+ let command = "pygmentize -l " . ft . " -f rtf -O style=" . g:rtfp_theme . ",fontface=" . g:rtfp_font . " 2> /dev/null"
+ let output = system(command,content)
+ let retval = system("pbcopy",output)
+endfunction
+
+command! -nargs=? -range=% RTFPygmentize :call RTFPygmentize(<line1>,<line2>,<f-args>)

0 comments on commit 624e177

Please sign in to comment.
Something went wrong with that request. Please try again.