Skip to content

Instantly share code, notes, and snippets.

@sobrinho
Created April 21, 2020 23:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sobrinho/ce4f95a07f3f090b8c9e68386be4d3d7 to your computer and use it in GitHub Desktop.
Save sobrinho/ce4f95a07f3f090b8c9e68386be4d3d7 to your computer and use it in GitHub Desktop.
Highlight SQL and GraphQL in Ruby files
" Add this file to ~/.vim/after/syntax/ruby.vim
"
" https://thegreata.pe/articles/2018/01/01/vim-syntax-highlighting-for-sql-strings-inside-ruby-code/
unlet b:current_syntax
syn include @SQL syntax/sql.vim
syn region sqlHeredoc start=/\v\<\<[-~]SQL/ end=/\vSQL/ keepend contains=@SQL
let b:current_syntax = "ruby"
unlet b:current_syntax
syn include @GRAPHQL syntax/graphql.vim
syn region sqlHeredoc start=/\v\<\<[-~]GRAPHQL/ end=/\vGRAPHQL/ keepend contains=@GRAPHQL
let b:current_syntax = "graphql"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment