diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2019-11-04 09:04:28 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2019-11-04 09:04:28 +0100 |
commit | 4e95df7c7e12cb76e781f2dacf1c07f8984cce58 (patch) | |
tree | af9230137ec342d4bed0a68a9ccb49ed3303b3d0 /ftdetect/polyglot.vim | |
parent | 31c55b85a03d96252bba14d64911cc78a20369a1 (diff) | |
download | vim-polyglot-4e95df7c7e12cb76e781f2dacf1c07f8984cce58.tar.gz vim-polyglot-4e95df7c7e12cb76e781f2dacf1c07f8984cce58.zip |
Update
Diffstat (limited to 'ftdetect/polyglot.vim')
-rw-r--r-- | ftdetect/polyglot.vim | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index bec614ae..3dc8a3ec 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -905,7 +905,7 @@ endif if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ocaml') == -1 augroup filetypedetect " ocaml, from opam.vim in rgrinberg/vim-ocaml -au BufNewFile,BufRead opam,*.opam set filetype=opam +au BufNewFile,BufRead opam,*.opam,*.opam.template set filetype=opam augroup end endif @@ -1105,7 +1105,24 @@ endif if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'racket') == -1 augroup filetypedetect " racket, from racket.vim in wlangstroth/vim-racket -au BufRead,BufNewFile *.rkt,*.rktl set filetype=racket +" +let g:racket_hash_lang_regexp = '^#lang\s\+\([^][)(}{[:space:]]\+\)' + +" Tries to detect filetype from #lang line; defaults to ft=racket. +function RacketDetectHashLang() + let old_ft = &filetype + + let matches = matchlist(getline(1), g:racket_hash_lang_regexp) + if ! empty(matches) + let &l:filetype = matches[1] + endif + + if &filetype == old_ft + set filetype=racket + endif +endfunction + +au BufRead,BufNewFile *.rkt,*.rktl call RacketDetectHashLang() augroup end endif @@ -1437,15 +1454,15 @@ endif if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'typescript') == -1 augroup filetypedetect - " typescript, from tsx.vim in HerringtonDarkholme/yats.vim -autocmd BufNewFile,BufRead *.tsx setlocal filetype=typescript.tsx + " typescript, from typescript.vim in HerringtonDarkholme/yats.vim +autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript augroup end endif if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'typescript') == -1 augroup filetypedetect - " typescript, from typescript.vim in HerringtonDarkholme/yats.vim -autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript + " typescript, from typescriptreact.vim in HerringtonDarkholme/yats.vim +autocmd BufNewFile,BufRead *.tsx setlocal filetype=typescriptreact augroup end endif |