Skip to content

Commit

Permalink
[vim] Add syntax for SQL in Python
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelRobitaille committed Oct 10, 2022
1 parent c2b8535 commit c1f569c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions vim/after/syntax/python.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
" <3 <3 <3 https://thegreata.pe/articles/2020/07/11/vim-syntax-highlighting-for-sql-strings-inside-python-code/
unlet b:current_syntax

syn include @SQL syntax/sql.vim
syntax region sqlPythonString
\ matchgroup=SpecialComment
\ start=~\z('''\|"""\)\_s*\(ALTER\|BEGIN\|CALL\|COMMENT\|COMMIT\|CONNECT\|CREATE\|DELETE\|DROP\|END\|EXPLAIN\|EXPORT\|GRANT\|IMPORT\|INSERT\|LOAD\|LOCK\|MERGE\|REFRESH\|RENAME\|REPLACE\|REVOKE\|ROLLBACK\|SELECT\|SET\|TRUNCATE\|UNLOAD\|UNSET\|UPDATE\|UPSERT\|WITH\)\s~
\ end=+\z1+
\ contains=@SQL

let b:current_syntax = 'python'

0 comments on commit c1f569c

Please sign in to comment.