summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--README.md1
-rwxr-xr-xbuild1
-rw-r--r--ftdetect/polyglot.vim5
-rw-r--r--ftplugin/graphql.vim17
-rw-r--r--syntax/graphql.vim64
5 files changed, 88 insertions, 0 deletions
diff --git a/README.md b/README.md
index 89d5aa48..3029b84f 100644
--- a/README.md
+++ b/README.md
@@ -64,6 +64,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [glsl](https://github.com/tikhomirov/vim-glsl) (syntax, indent)
- [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting) (syntax)
- [go](https://github.com/fatih/vim-go) (syntax, compiler, indent)
+- [graphql](https://github.com/jparise/vim-graphql) (syntax, ftplugin)
- [groovy](https://github.com/vim-scripts/groovy.vim) (syntax)
- [haml](https://github.com/sheerun/vim-haml) (syntax, indent, compiler, ftplugin)
- [handlebars](https://github.com/mustache/vim-mustache-handlebars) (syntax, indent, ftplugin)
diff --git a/build b/build
index c4e653c2..713368f0 100755
--- a/build
+++ b/build
@@ -136,6 +136,7 @@ PACKS="
glsl:tikhomirov/vim-glsl
gnuplot:vim-scripts/gnuplot-syntax-highlighting
go:fatih/vim-go:_BASIC
+ graphql:jparise/vim-graphql
groovy:vim-scripts/groovy.vim
haml:sheerun/vim-haml
handlebars:mustache/vim-mustache-handlebars
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim
index 7f1f385f..d8be2683 100644
--- a/ftdetect/polyglot.vim
+++ b/ftdetect/polyglot.vim
@@ -328,6 +328,11 @@ au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl
augroup END
augroup filetypedetect
+" graphql:jparise/vim-graphql
+au BufRead,BufNewFile *.graphql,*.gql setfiletype graphql
+augroup END
+
+augroup filetypedetect
" groovy:vim-scripts/groovy.vim
augroup END
diff --git a/ftplugin/graphql.vim b/ftplugin/graphql.vim
new file mode 100644
index 00000000..d82d9abb
--- /dev/null
+++ b/ftplugin/graphql.vim
@@ -0,0 +1,17 @@
+if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
+
+" Vim filetype plugin
+" Language: GraphQL
+" Maintainer: Jon Parise <jon@indelible.org>
+
+if (exists("b:did_ftplugin"))
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal comments=:#
+setlocal commentstring=#\ %s
+setlocal formatoptions-=t
+setlocal iskeyword+=$,@-@
+
+endif
diff --git a/syntax/graphql.vim b/syntax/graphql.vim
new file mode 100644
index 00000000..71dc766a
--- /dev/null
+++ b/syntax/graphql.vim
@@ -0,0 +1,64 @@
+if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
+
+" Vim syntax file
+" Language: GraphQL
+" Maintainer: Jon Parise <jon@indelible.org>
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syn match graphqlComment "#.*$" contains=@Spell
+
+syn match graphqlOperator "="
+syn match graphqlOperator "!"
+syn match graphqlOperator "|"
+syn match graphqlOperator "\M..."
+
+syn keyword graphqlBoolean true false
+syn keyword graphqlNull null
+syn match graphqlNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>"
+syn region graphqlString start=+"+ skip=+\\\\\|\\"+ end=+"\|$+
+
+syn keyword graphqlStructure enum scalar type union nextgroup=graphqlType skipwhite
+syn keyword graphqlStructure input interface subscription nextgroup=graphqlType skipwhite
+syn keyword graphqlStructure implements on nextgroup=graphqlType skipwhite
+syn keyword graphqlStructure query mutation fragment nextgroup=graphqlIdentifier skipwhite
+syn keyword graphqlStructure directive nextgroup=graphqlDirective skipwhite
+syn keyword graphqlStructure extend nextgroup=graphqlStructure skipwhite
+
+syn match graphqlDirective "\<@\h\w*\>" display
+syn match graphqlVariable "\<\$\h\w*\>" display
+
+syn match graphqlIdentifier "\<\h\w*\>" display contained
+syn match graphqlType "\<_*\u\w*\>" display contained
+syn match graphqlConstant "\<[A-Z_]\+\>" display contained
+
+syn keyword graphqlMetaFields __schema __type __typename
+
+syn region graphqlFold matchgroup=graphqlBraces start="{" end=/}\(\_s\+\ze\("\|{\)\)\@!/ transparent fold contains=ALLBUT,graphqlStructure
+syn region graphqlList matchgroup=graphqlBraces start="\[" end=/]\(\_s\+\ze"\)\@!/ transparent contains=ALLBUT,graphqlDirective,graphqlStructure
+
+hi def link graphqlComment Comment
+hi def link graphqlOperator Operator
+
+hi def link graphqlBraces Delimiter
+
+hi def link graphqlBoolean Boolean
+hi def link graphqlNull Keyword
+hi def link graphqlNumber Number
+hi def link graphqlString String
+
+hi def link graphqlConstant Constant
+hi def link graphqlDirective PreProc
+hi def link graphqlIdentifier Identifier
+hi def link graphqlMetaFields Special
+hi def link graphqlStructure Structure
+hi def link graphqlType Type
+hi def link graphqlVariable Identifier
+
+syn sync minlines=500
+
+let b:current_syntax = "graphql"
+
+endif