diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2015-12-06 11:31:38 +0100 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2015-12-06 11:31:38 +0100 | 
| commit | 303b3f1b434f26f936c241789c84dca6e2f50df2 (patch) | |
| tree | 1507706b422e3ec29c0e5f30bcf14681e04ab374 /ftdetect | |
| parent | bf849731731a7da008c891476b878735e8280bdc (diff) | |
| download | vim-polyglot-303b3f1b434f26f936c241789c84dca6e2f50df2.tar.gz vim-polyglot-303b3f1b434f26f936c241789c84dca6e2f50df2.zip  | |
Update all bundles
Diffstat (limited to 'ftdetect')
| -rw-r--r-- | ftdetect/polyglot.vim | 38 | 
1 files changed, 36 insertions, 2 deletions
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index d4b4427b..ae2d8a4a 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -134,6 +134,30 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jasmine') == -1  autocmd BufNewFile,BufRead *Spec.js,*_spec.js set filetype=jasmine.javascript syntax=jasmine  endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1 +   +if !exists('g:jsx_ext_required') +  let g:jsx_ext_required = 1 +endif +if !exists('g:jsx_pragma_required') +  let g:jsx_pragma_required = 0 +endif +if g:jsx_pragma_required +  " 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') +endif +fu! <SID>EnableJSX() +  if g:jsx_pragma_required && !b:jsx_pragma_found | return 0 | endif +  if g:jsx_ext_required && !exists('b:jsx_ext_found') | return 0 | endif +  return 1 +endfu +autocmd BufNewFile,BufRead *.jsx let b:jsx_ext_found = 1 +autocmd BufNewFile,BufRead *.jsx set filetype=javascript.jsx +autocmd BufNewFile,BufRead *.js +  \ if <SID>EnableJSX() | set filetype=javascript.jsx | endif +endif  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json') == -1  autocmd BufNewFile,BufRead *.json set filetype=json @@ -205,7 +229,7 @@ au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/*,*/nginx/vhosts.d/*,nginx.c  endif  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'opencl') == -1 -au BufRead,BufNewFile *.cl set filetype=opencl +au! BufRead,BufNewFile *.cl set filetype=opencl  endif  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1 @@ -327,7 +351,17 @@ autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus  endif  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1 -autocmd BufNewFile,BufRead *.swift set filetype=swift +autocmd BufNewFile,BufRead *.swift setfiletype swift +autocmd BufRead * call s:Swift() +function! s:Swift() +  if !empty(&filetype) +    return +  endif +  let line = getline(1) +  if line =~ "^#!.*swift" +    setfiletype swift +  endif +endfunction  endif  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'systemd') == -1  | 
