Skip to content

Commit 71fde44

Browse files
committed
Support for different dialects
1 parent 473f477 commit 71fde44

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,11 @@ This module is experimental and strongly inspired by [vim-graphql](https://githu
2222

2323
1. `cd ~/.vim/bundle`
2424
1. `git clone https://github.com/statico/vim-javascript-sql.git`
25+
26+
## Configuration
27+
28+
This plugin uses the generic SQL syntax by default. If you want to use a different dialect, like PostgreSQL, put something like this in your .vimrc:
29+
30+
```vim
31+
let g:javascript_sql_dialect = 'pgsql'
32+
```

after/syntax/javascript/sql.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if exists('b:current_syntax')
77
unlet b:current_syntax
88
endif
99

10-
syn include @SQLSyntax syntax/sql.vim
10+
exec 'syntax include @SQLSyntax syntax/' . g:javascript_sql_dialect . '.vim'
1111
if exists('s:current_syntax')
1212
let b:current_syntax = s:current_syntax
1313
endif

plugin/javascript-sql.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
" Vim plugin
2+
" Language: JavaScript
3+
" Maintainer: Ian Langworth <[email protected]>
4+
"
5+
6+
if (!exists('g:javascript_sql_dialect'))
7+
let g:javascript_sql_dialect = 'sql'
8+
endif

0 commit comments

Comments
 (0)