Skip to content

Instantly share code, notes, and snippets.

@jrunning
Created August 6, 2012 19:38
Show Gist options
  • Select an option

  • Save jrunning/3277869 to your computer and use it in GitHub Desktop.

Select an option

Save jrunning/3277869 to your computer and use it in GitHub Desktop.
Yo dawg
" Syntax-highlight Ruby comments as Markdown a la Docco
" TODO: Make multi-line comments work right
" Make nested comments work right
" Exclude "# => " ("result of expression") comments
let s:saved_syntax = b:current_syntax
unlet b:current_syntax
syntax include @Markdown syntax/markdown.vim
syntax cluster rbComments contains=rubyComment,rubyMultilineComment
syntax cluster mostOfRuby contains=ruby.* remove=@rbComments
syntax match markdownInComment /#.*/ms=s+1 contained containedin=@rbComments contains=@Markdown transparent
syntax match rubyInMarkdown / .*/ contained containedin=markdownInComment,markdownCodeBlock contains=@mostOfRuby transparent
let b:current_syntax = s:saved_syntax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment