Skip to content

Instantly share code, notes, and snippets.

@reinh
Last active February 20, 2016 00:39
Show Gist options
  • Save reinh/5448512 to your computer and use it in GitHub Desktop.
Save reinh/5448512 to your computer and use it in GitHub Desktop.
" ~/.vim/after/syntax/ruby.vim
" Save buffer's current syntax
let s:bcs = b:current_syntax
unlet b:current_syntax
" Magic happens here.
syntax include @SQL syntax/sql.vim
" Restore buffer's current syntax
let b:current_syntax = s:bcs
" Match Ruby heredoc format (`<<` or `<<-` start tag, whitespace before end tag)
syntax region rubyHereDocSQL matchgroup=Statement start=+<<-\?SQL+ end=+^\s*SQL$+ contains=@SQL
@dkarter
Copy link

dkarter commented Feb 20, 2016

Wow this works great! Thanks so much! I'm pushing it as a pull request to hashrocket/dotmatrix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment