diff options
Diffstat (limited to 'ftdetect')
| -rw-r--r-- | ftdetect/polyglot.vim | 32 | 
1 files changed, 17 insertions, 15 deletions
| diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 80938e78..521eced7 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -19,7 +19,7 @@ au BufRead,BufNewFile *.ino,*.pde set filetype=arduino  endif  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'blade') == -1 -au BufNewFile,BufRead *.blade.php set filetype=blade +autocmd BufNewFile,BufRead *.blade.php set filetype=blade  endif  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cjsx') == -1 @@ -65,19 +65,18 @@ au BufNewFile,BufRead Dockerfile set filetype=dockerfile  endif  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1 -au BufRead,BufNewFile *.eex set filetype=eelixir -au FileType eelixir setl sw=2 sts=2 et iskeyword+=!,? -endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1 -   -au BufRead,BufNewFile *.ex,*.exs set filetype=elixir -au FileType elixir setl sw=2 sts=2 et iskeyword+=!,? +au BufRead,BufNewFile *.ex,*.exs call s:setf('elixir') +au BufRead,BufNewFile *.eex call s:setf('eelixir') +au FileType elixir,eelixir setl sw=2 sts=2 et iskeyword+=!,? +au BufNewFile,BufRead * call s:DetectElixir() +function! s:setf(filetype) abort +  let &filetype = a:filetype +endfunction  function! s:DetectElixir() -    if getline(1) =~ '^#!.*\<elixir\>' -        set filetype=elixir -    endif +  if getline(1) =~ '^#!.*\<elixir\>' +    call s:setf('elixir') +  endif  endfunction -autocmd BufNewFile,BufRead * call s:DetectElixir()  endif  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1 @@ -126,19 +125,22 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1  let s:current_fileformats = ''  let s:current_fileencodings = '' -function! s:gofiletype_pre() +function! s:gofiletype_pre(type)      let s:current_fileformats = &g:fileformats      let s:current_fileencodings = &g:fileencodings      set fileencodings=utf-8 fileformats=unix -    setlocal filetype=go +    let &l:filetype = a:type  endfunction  function! s:gofiletype_post()      let &g:fileformats = s:current_fileformats      let &g:fileencodings = s:current_fileencodings  endfunction  au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix -au BufRead *.go call s:gofiletype_pre() +au BufRead *.go call s:gofiletype_pre("go")  au BufReadPost *.go call s:gofiletype_post() +au BufNewFile *.s setfiletype asm | setlocal fileencoding=utf-8 fileformat=unix +au BufRead *.s call s:gofiletype_pre("asm") +au BufReadPost *.s call s:gofiletype_post()  au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl  endif  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1 | 
