diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2015-07-18 22:50:09 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2015-07-18 22:50:09 +0200 |
commit | 1c80c4bb08ae250d2eb19aabe0f31c1b2bdf5097 (patch) | |
tree | c7700e4cb18952201fb991a48fb727ba3b9d4287 /after/jsx-config.vim | |
parent | 548653cafeaa948161ad9ac8184deca0bff95537 (diff) | |
download | vim-polyglot-1c80c4bb08ae250d2eb19aabe0f31c1b2bdf5097.tar.gz vim-polyglot-1c80c4bb08ae250d2eb19aabe0f31c1b2bdf5097.zip |
Add jsx support, closes #56
Diffstat (limited to 'after/jsx-config.vim')
-rw-r--r-- | after/jsx-config.vim | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/after/jsx-config.vim b/after/jsx-config.vim new file mode 100644 index 00000000..5270a518 --- /dev/null +++ b/after/jsx-config.vim @@ -0,0 +1,66 @@ +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Vimscript file +" +" Set up a bunch of configuration variables. +" +" Also check (if desired) whether or not the @jsx pragma is correctly included +" in '%'. Set the result in b:jsx_pragma_found. +" +" Language: JSX (JavaScript) +" Maintainer: Max Wang <mxawng@gmail.com> +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +" Only check once. +if exists('b:jsx_pragma_found') + finish +endif + +" Whether the .jsx extension is required to enable JSX syntax/indent. +if !exists('g:jsx_ext_required') + let g:jsx_ext_required = 1 +endif + +" Whether the @jsx pragma is required to enable JSX syntax/indent. +if !exists('g:jsx_pragma_required') + let g:jsx_pragma_required = 0 +endif +if !g:jsx_pragma_required | finish | endif + +" Look for the @jsx pragma. It must be included in a docblock comment before +" anything else in the file (except whitespace). +let s:jsx_pragma_pattern = '\%^\_s*\/\*\*\%(\_.\%(\*\/\)\@!\)*@jsx\_.\{-}\*\/' +let b:jsx_pragma_found = search(s:jsx_pragma_pattern, 'npw') +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Vimscript file +" +" Set up a bunch of configuration variables. +" +" Also check (if desired) whether or not the @jsx pragma is correctly included +" in '%'. Set the result in b:jsx_pragma_found. +" +" Language: JSX (JavaScript) +" Maintainer: Max Wang <mxawng@gmail.com> +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +" Only check once. +if exists('b:jsx_pragma_found') + finish +endif + +" Whether the .jsx extension is required to enable JSX syntax/indent. +if !exists('g:jsx_ext_required') + let g:jsx_ext_required = 1 +endif + +" Whether the @jsx pragma is required to enable JSX syntax/indent. +if !exists('g:jsx_pragma_required') + let g:jsx_pragma_required = 0 +endif +if !g:jsx_pragma_required | finish | endif + +" Look for the @jsx pragma. It must be included in a docblock comment before +" anything else in the file (except whitespace). +let s:jsx_pragma_pattern = '\%^\_s*\/\*\*\%(\_.\%(\*\/\)\@!\)*@jsx\_.\{-}\*\/' +let b:jsx_pragma_found = search(s:jsx_pragma_pattern, 'npw') |