summaryrefslogtreecommitdiffstats
path: root/after
diff options
context:
space:
mode:
Diffstat (limited to 'after')
-rw-r--r--after/ftplugin/jsx.vim2
-rw-r--r--after/ftplugin/terraform.vim19
-rw-r--r--after/syntax/c.vim8
-rw-r--r--after/syntax/cpp.vim67
-rw-r--r--after/syntax/javascript/graphql.vim21
-rw-r--r--after/syntax/yaml.vim2
6 files changed, 99 insertions, 20 deletions
diff --git a/after/ftplugin/jsx.vim b/after/ftplugin/jsx.vim
index fc76b19e..a5682895 100644
--- a/after/ftplugin/jsx.vim
+++ b/after/ftplugin/jsx.vim
@@ -12,7 +12,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
if exists("loaded_matchit")
let b:match_ignorecase = 0
let b:match_words = '(:),\[:\],{:},<:>,' .
- \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
+ \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
endif
setlocal suffixesadd+=.jsx
diff --git a/after/ftplugin/terraform.vim b/after/ftplugin/terraform.vim
index add09445..0597b428 100644
--- a/after/ftplugin/terraform.vim
+++ b/after/ftplugin/terraform.vim
@@ -4,6 +4,10 @@ if !exists('g:terraform_align')
let g:terraform_align = 0
endif
+if !exists('g:terraform_remap_spacebar')
+ let g:terraform_remap_spacebar = 0
+endif
+
if g:terraform_align && exists(':Tabularize')
inoremap <buffer> <silent> = =<Esc>:call <SID>terraformalign()<CR>a
function! s:terraformalign()
@@ -31,6 +35,10 @@ function! TerraformFolds()
return ">1"
elseif match(thisline, '^output') >= 0
return ">1"
+ elseif match(thisline, '^data') >= 0
+ return ">1"
+ elseif match(thisline, '^terraform') >= 0
+ return ">1"
else
return "="
endif
@@ -45,10 +53,13 @@ function! TerraformFoldText()
endfunction
setlocal foldtext=TerraformFoldText()
-"inoremap <space> <C-O>za
-nnoremap <space> za
-onoremap <space> <C-C>za
-vnoremap <space> zf
+" Re-map the space bar to fold and unfold
+if get(g:, "terraform_remap_spacebar", 1)
+ "inoremap <space> <C-O>za
+ nnoremap <space> za
+ onoremap <space> <C-C>za
+ vnoremap <space> zf
+endif
" Match the identation put in place by Hashicorp and :TerraformFmt, https://github.com/hashivim/vim-terraform/issues/21
if get(g:, "terraform_align", 1)
diff --git a/after/syntax/c.vim b/after/syntax/c.vim
index 8cec90f6..de14c4db 100644
--- a/after/syntax/c.vim
+++ b/after/syntax/c.vim
@@ -20,9 +20,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
" -----------------------------------------------------------------------------
" Highlight function names.
" -----------------------------------------------------------------------------
-syn match cCustomParen "(" contains=cParen contains=cCppParen
-syn match cCustomFunc "\w\+\s*(\@=" contains=cCustomParen
-hi def link cCustomFunc Function
+if !exists('g:cpp_no_function_highlight')
+ syn match cCustomParen "(" contains=cParen contains=cCppParen
+ syn match cCustomFunc "\w\+\s*(\@=" contains=cCustomParen
+ hi def link cCustomFunc Function
+endif
" -----------------------------------------------------------------------------
" Highlight member variable names.
diff --git a/after/syntax/cpp.vim b/after/syntax/cpp.vim
index 4faa0f6b..c1c23987 100644
--- a/after/syntax/cpp.vim
+++ b/after/syntax/cpp.vim
@@ -36,9 +36,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
" -----------------------------------------------------------------------------
" Functions
-syn match cCustomParen "(" contains=cParen contains=cCppParen
-syn match cCustomFunc "\w\+\s*(\@="
-hi def link cCustomFunc Function
+if !exists('g:cpp_no_function_highlight')
+ syn match cCustomParen "(" contains=cParen contains=cCppParen
+ syn match cCustomFunc "\w\+\s*(\@="
+ hi def link cCustomFunc Function
+endif
" Class and namespace scope
if exists('g:cpp_class_scope_highlight') && g:cpp_class_scope_highlight
@@ -48,6 +50,52 @@ if exists('g:cpp_class_scope_highlight') && g:cpp_class_scope_highlight
hi def link cCustomClass Function
endif
+" Clear cppStructure and replace "class" and/or "template" with matches
+" based on user configuration
+let s:needs_cppstructure_match = 0
+if exists('g:cpp_class_decl_highlight') && g:cpp_class_decl_highlight
+ let s:needs_cppstructure_match += 1
+endif
+if exists('g:cpp_experimental_template_highlight') && g:cpp_experimental_template_highlight
+ let s:needs_cppstructure_match += 2
+endif
+
+syn clear cppStructure
+if s:needs_cppstructure_match == 0
+ syn keyword cppStructure typename namespace template class
+elseif s:needs_cppstructure_match == 1
+ syn keyword cppStructure typename namespace template
+elseif s:needs_cppstructure_match == 2
+ syn keyword cppStructure typename namespace class
+elseif s:needs_cppstructure_match == 3
+ syn keyword cppStructure typename namespace
+endif
+unlet s:needs_cppstructure_match
+
+
+" Class name declaration
+if exists('g:cpp_class_decl_highlight') && g:cpp_class_decl_highlight
+ syn match cCustomClassKey "\<class\>"
+ hi def link cCustomClassKey cppStructure
+
+ " Clear cppAccess entirely and redefine as matches
+ syn clear cppAccess
+ syn match cCustomAccessKey "\<private\>"
+ syn match cCustomAccessKey "\<public\>"
+ syn match cCustomAccessKey "\<protected\>"
+ hi def link cCustomAccessKey cppAccess
+
+ " Match the parts of a class declaration
+ syn match cCustomClassName "\<class\_s\+\w\+\>"
+ \ contains=cCustomClassKey
+ syn match cCustomClassName "\<private\_s\+\w\+\>"
+ \ contains=cCustomAccessKey
+ syn match cCustomClassName "\<public\_s\+\w\+\>"
+ \ contains=cCustomAccessKey
+ syn match cCustomClassName "\<protected\_s\+\w\+\>"
+ \ contains=cCustomAccessKey
+ hi def link cCustomClassName Function
+endif
" Template functions.
" Naive implementation that sorta works in most cases. Should correctly
" highlight everything in test/color2.cpp
@@ -79,17 +127,12 @@ elseif exists('g:cpp_experimental_template_highlight') && g:cpp_experimental_tem
\ contains=cCustomAngleBracketStart,cCustomTemplateFunc
hi def link cCustomTemplateClass cCustomClass
-
- " Remove 'template' from cppStructure and use a custom match
- syn clear cppStructure
- syn keyword cppStructure class typename namespace
-
syn match cCustomTemplate "\<template\>"
hi def link cCustomTemplate cppStructure
syn match cTemplateDeclare "\<template\_s*<\_[^;()]\{-}>"
- \ contains=cppStructure,cCustomTemplate,cCustomAngleBracketStart
+ \ contains=cppStructure,cCustomTemplate,cCustomClassKey,cCustomAngleBracketStart
- " Remove 'operator' from cppStructure and use a custom match
+ " Remove 'operator' from cppOperator and use a custom match
syn clear cppOperator
syn keyword cppOperator typeid
syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq
@@ -106,7 +149,7 @@ endif
"hi def link cCustomFunc Function
" Cluster for all the stdlib functions defined below
-syn cluster cppSTLgroup contains=cppSTLfunction,cppSTLfunctional,cppSTLconstant,cppSTLnamespace,cppSTLtype,cppSTLexception,cppSTLiterator,cppSTLiterator_tagcppSTLenumcppSTLioscppSTLcast
+syn cluster cppSTLgroup contains=cppSTLfunction,cppSTLfunctional,cppSTLconstant,cppSTLnamespace,cppSTLtype,cppSTLexception,cppSTLiterator,cppSTLiterator_tag,cppSTLenum,cppSTLios,cppSTLcast
" -----------------------------------------------------------------------------
@@ -184,6 +227,7 @@ syntax keyword cppSTLfunctional binary_negate
syntax keyword cppSTLfunctional bit_and
syntax keyword cppSTLfunctional bit_not
syntax keyword cppSTLfunctional bit_or
+syntax keyword cppSTLfunctional bit_xor
syntax keyword cppSTLfunctional divides
syntax keyword cppSTLfunctional equal_to
syntax keyword cppSTLfunctional greater
@@ -699,6 +743,7 @@ syntax keyword cppSTLtype slice_array
syntax keyword cppSTLtype stack
syntax keyword cppSTLtype stream
syntax keyword cppSTLtype streambuf
+syntax keyword cppSTLtype streamsize
syntax keyword cppSTLtype string
syntax keyword cppSTLtype stringbuf
syntax keyword cppSTLtype stringstream
diff --git a/after/syntax/javascript/graphql.vim b/after/syntax/javascript/graphql.vim
new file mode 100644
index 00000000..58c1de08
--- /dev/null
+++ b/after/syntax/javascript/graphql.vim
@@ -0,0 +1,21 @@
+if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
+
+if exists('b:current_syntax')
+ let s:current_syntax = b:current_syntax
+ unlet b:current_syntax
+endif
+syn include @GraphQLSyntax syntax/graphql.vim
+if exists('s:current_syntax')
+ let b:current_syntax = s:current_syntax
+endif
+
+syntax region graphqlTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`+ contains=@GraphQLSyntax,jsTemplateExpression,jsSpecial extend
+exec 'syntax match graphqlTaggedTemplate +\%(' . join(g:graphql_javascript_tags, '\|') . '\)\%(`\)\@=+ nextgroup=graphqlTemplateString'
+
+hi def link graphqlTemplateString jsTemplateString
+hi def link graphqlTaggedTemplate jsTaggedTemplate
+
+syn cluster jsExpression add=graphqlTaggedTemplate
+syn cluster graphqlTaggedTemplate add=graphqlTemplateString
+
+endif
diff --git a/after/syntax/yaml.vim b/after/syntax/yaml.vim
index d429da68..89914cbe 100644
--- a/after/syntax/yaml.vim
+++ b/after/syntax/yaml.vim
@@ -39,7 +39,7 @@ syn keyword yamlConstant TRUE True true YES Yes yes ON On on
syn keyword yamlConstant FALSE False false NO No no OFF Off off
syn match yamlKey "^\s*\zs[^ \t\"]\+\ze\s*:"
-syn match yamlKey "^\s*-\s*\zs[^ \t\"]\+\ze\s*:"
+syn match yamlKey "^\s*-\s*\zs[^ \t\"\']\+\ze\s*:"
syn match yamlAnchor "&\S\+"
syn match yamlAlias "*\S\+"