Skip to content

Instantly share code, notes, and snippets.

@sobrinho
Created Apr 21, 2020
Embed
What would you like to do?
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