Last active
February 20, 2016 00:39
-
-
Save reinh/5448512 to your computer and use it in GitHub Desktop.
Revisions
-
reinh revised this gist
Apr 24, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ## Syntax highlight SQL inside Ruby `<<-SQL` heredocs Embeds SQL syntax highlighting inside Ruby heredocs labeled `SQL`. This will also work to embed other syntaxen, e.g., HTML. -
reinh revised this gist
Apr 24, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ ### Syntax highlight SQL inside Ruby `<<-SQL` heredocs Embeds SQL syntax highlighting inside Ruby heredocs labeled `SQL`. This will also work to embed other syntaxen, e.g., HTML. #### Optional PGSQL enhanced syntax: (requires https://github.com/exu/pgsql.vim) -
reinh revised this gist
Apr 24, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ Embeds SQL syntax highlighting inside Ruby heredocs labeled `SQL`. This will als syntax include @SQL syntax/pgsql.vim ``` #### Credits: * http://blogs.perl.org/users/ovid/2011/06/syntax-highlight-your-sql-heredocs-in-vim.html * http://stackoverflow.com/questions/6864420/change-filetype-or-other-vim-settings-blockwise-in-a-file -
reinh revised this gist
Apr 24, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ Embeds SQL syntax highlighting inside Ruby heredocs labeled `SQL`. This will also work to embed other syntaxen, e.g., HTML. ### Optional PGSQL enhanced syntax: (requires https://github.com/exu/pgsql.vim) -
reinh revised this gist
Apr 24, 2013 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,10 @@ ## Syntax highlight SQL inside Ruby `<<-SQL` heredocs Embeds SQL syntax highlighting inside Ruby heredocs labeled `SQL`. This will also work to embed other syntaxen, e.g., HTML. ## Optional PGSQL enhanced syntax: (requires https://github.com/exu/pgsql.vim) ```VimL syntax include @SQL syntax/pgsql.vim -
reinh revised this gist
Apr 24, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ## Syntax highlight SQL inside `<<-SQL` heredocs Similar principle will work to embed other syntaxen, e.g., HTML. -
reinh revised this gist
Apr 24, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ Optional: requires https://github.com/exu/pgsql.vim syntax include @SQL syntax/pgsql.vim ``` ### Credits * http://blogs.perl.org/users/ovid/2011/06/syntax-highlight-your-sql-heredocs-in-vim.html * http://stackoverflow.com/questions/6864420/change-filetype-or-other-vim-settings-blockwise-in-a-file -
reinh revised this gist
Apr 24, 2013 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,3 +7,8 @@ Optional: requires https://github.com/exu/pgsql.vim ```VimL syntax include @SQL syntax/pgsql.vim ``` **Credits:** * http://blogs.perl.org/users/ovid/2011/06/syntax-highlight-your-sql-heredocs-in-vim.html * http://stackoverflow.com/questions/6864420/change-filetype-or-other-vim-settings-blockwise-in-a-file -
reinh revised this gist
Apr 24, 2013 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,13 @@ " ~/.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) -
reinh revised this gist
Apr 24, 2013 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,13 @@ " ~/.vim/after/syntax/ruby.vim " Save and restore buffer's current syntax let s:bcs = b:current_syntax unlet b:current_syntax " Magic happens here. syntax include @SQL syntax/sql.vim 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 -
reinh created this gist
Apr 24, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ Syntax highlight SQL inside `<<-SQL` heredocs Similar principle will work to embed other syntaxen, e.g., HTML. Optional: requires https://github.com/exu/pgsql.vim ```VimL syntax include @SQL syntax/pgsql.vim ``` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ " ~/.vim/after/syntax/ruby.vim let s:bcs = b:current_syntax unlet b:current_syntax syntax include @SQL syntax/sql.vim let b:current_syntax = s:bcs syntax region rubyHereDocSQL matchgroup=Statement start=+<<-\?SQL+ end=+^\s*SQL$+ contains=@SQL