Skip to content

Instantly share code, notes, and snippets.

@vagmi
Created June 23, 2011 11:21
Show Gist options
  • Select an option

  • Save vagmi/1042379 to your computer and use it in GitHub Desktop.

Select an option

Save vagmi/1042379 to your computer and use it in GitHub Desktop.
function! RTFHighlight(line1,line2,...)
if !executable('highlight')
echoerr "Bummer! highlight not found. Get it from http://www.andre-simon.de/doku/highlight/en/highlight.html"
return
endif
let content = join(getline(a:line1,a:line2),"\n")
let command = "highlight --syntax " . a:1 . " -s bipolar -R -k Menlo -K 24 2> /dev/null"
let output = system(command,content)
" let @* = output
" for some reason text copied this way
" gets pasted as plain text in keynote
" but this works well with pbcopy
let retval = system("pbcopy",output)
endfunction
command! -nargs=1 -range=% RTFHighlight :call RTFHighlight(<line1>,<line2>,<f-args>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment