summaryrefslogtreecommitdiffstats
path: root/after/syntax
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2015-12-06 11:31:38 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2015-12-06 11:31:38 +0100
commit303b3f1b434f26f936c241789c84dca6e2f50df2 (patch)
tree1507706b422e3ec29c0e5f30bcf14681e04ab374 /after/syntax
parentbf849731731a7da008c891476b878735e8280bdc (diff)
downloadvim-polyglot-303b3f1b434f26f936c241789c84dca6e2f50df2.tar.gz
vim-polyglot-303b3f1b434f26f936c241789c84dca6e2f50df2.zip
Update all bundles
Diffstat (limited to 'after/syntax')
-rw-r--r--after/syntax/jsx.vim25
-rw-r--r--after/syntax/rust.vim8
2 files changed, 20 insertions, 13 deletions
diff --git a/after/syntax/jsx.vim b/after/syntax/jsx.vim
index 7efb05bd..0aafca12 100644
--- a/after/syntax/jsx.vim
+++ b/after/syntax/jsx.vim
@@ -11,13 +11,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Do nothing if we don't find the @jsx pragma (and we care).
-exec 'source '.fnameescape(expand('<sfile>:p:h:h').'/jsx-config.vim')
-if g:jsx_pragma_required && !b:jsx_pragma_found | finish | endif
-
-" Do nothing if we don't have the .jsx extension (and we care).
-if g:jsx_ext_required && !exists('b:jsx_ext_found') | finish | endif
-
" Prologue; load in XML syntax.
if exists('b:current_syntax')
let s:current_syntax=b:current_syntax
@@ -28,9 +21,24 @@ if exists('s:current_syntax')
let b:current_syntax=s:current_syntax
endif
+" Officially, vim-jsx depends on the pangloss/vim-javascript syntax package
+" (and is tested against it exclusively). However, in practice, we make some
+" effort towards compatibility with other packages.
+"
+" These are the plugin-to-syntax-element correspondences:
+"
+" - pangloss/vim-javascript: jsBlock, jsExpression
+" - jelera/vim-javascript-syntax: javascriptBlock
+" - othree/yajs.vim: javascriptNoReserved
+
+
" Highlight JSX regions as XML; recursively match.
+"
+" Note that we prohibit JSX tags from having a < or word character immediately
+" preceding it, to avoid conflicts with, respectively, the left shift operator
+" and generic Flow type annotations (http://flowtype.org/).
syn region jsxRegion contains=@XMLSyntax,jsxRegion,jsBlock,javascriptBlock
- \ start=+<\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+
+ \ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+
\ skip=+<!--\_.\{-}-->+
\ end=+</\z1\_\s\{-}>+
\ end=+/>+
@@ -45,7 +53,6 @@ syn region xmlString contained start=+{+ end=++ contains=jsBlock,javascriptBlock
syn cluster jsExpression add=jsxRegion
" Allow jsxRegion to contain reserved words.
-" See: https://github.com/othree/yajs.vim
syn cluster javascriptNoReserved add=jsxRegion
endif
diff --git a/after/syntax/rust.vim b/after/syntax/rust.vim
index 5748c4df..cb13cd73 100644
--- a/after/syntax/rust.vim
+++ b/after/syntax/rust.vim
@@ -1,11 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
-if !exists('g:rust_conceal') || !has('conceal') || &enc != 'utf-8'
+if !exists('g:rust_conceal') || g:rust_conceal == 0 || !has('conceal') || &enc != 'utf-8'
finish
endif
" For those who don't want to see `::`...
-if exists('g:rust_conceal_mod_path')
+if exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0
syn match rustNiceOperator "::" conceal cchar=ㆍ
endif
@@ -20,7 +20,7 @@ syn match rustNiceOperator "=>" contains=rustFatRightArrowHead,rustFatRightArrow
syn match rustNiceOperator /\<\@!_\(_*\>\)\@=/ conceal cchar=′
" For those who don't want to see `pub`...
-if exists('g:rust_conceal_pub')
+if exists('g:rust_conceal_pub') && g:rust_conceal_pub != 0
syn match rustPublicSigil contained "pu" conceal cchar=*
syn match rustPublicRest contained "b" conceal cchar= 
syn match rustNiceOperator "pub " contains=rustPublicSigil,rustPublicRest
@@ -28,7 +28,7 @@ endif
hi link rustNiceOperator Operator
-if !exists('g:rust_conceal_mod_path')
+if !exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0
hi! link Conceal Operator
endif