Skip to content

Commit

Permalink
Fix ftdetect (#1645)
Browse files Browse the repository at this point in the history
Should not use augroup in ftdetect script (see `:help ftdetect`)
  • Loading branch information
ichizok authored and arp242 committed Jan 15, 2018
1 parent f12f4c8 commit 30d04ad
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions ftdetect/gofiletype.vim
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
" vint: -ProhibitAutocmdWithNoGroup

" We take care to preserve the user's fileencodings and fileformats,
" because those settings are global (not buffer local), yet we want
" to override them for loading Go files, which are defined to be UTF-8.
Expand All @@ -18,17 +20,15 @@ function! s:gofiletype_post()
let &g:fileencodings = s:current_fileencodings
endfunction

augroup vim-go-filetype
autocmd!
au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix
au BufRead *.go call s:gofiletype_pre("go")
au BufReadPost *.go call s:gofiletype_post()
" Note: should not use augroup in ftdetect (see :help ftdetect)
au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix
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 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
augroup end
au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl

" vim: sw=2 ts=2 et

0 comments on commit 30d04ad

Please sign in to comment.