summaryrefslogtreecommitdiffstats
path: root/ftdetect
diff options
context:
space:
mode:
Diffstat (limited to 'ftdetect')
-rw-r--r--ftdetect/polyglot.vim25
1 files changed, 22 insertions, 3 deletions
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim
index 20d4a1a2..9e7eeaa4 100644
--- a/ftdetect/polyglot.vim
+++ b/ftdetect/polyglot.vim
@@ -340,6 +340,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
" go, from gofiletype.vim in fatih/vim-go:_BASIC
" vint: -ProhibitAutocmdWithNoGroup
+" don't spam the user when Vim is started in Vi compatibility mode
+let s:cpo_save = &cpo
+set cpo&vim
+
" 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.
@@ -361,16 +365,21 @@ function! s:gofiletype_post()
endfunction
" Note: should not use augroup in ftdetect (see :help ftdetect)
-au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix
+au BufNewFile *.go setfiletype go | if &modifiable | setlocal fileencoding=utf-8 fileformat=unix | endif
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 BufNewFile *.s setfiletype asm | if &modifiable | setlocal fileencoding=utf-8 fileformat=unix | endif
au BufRead *.s call s:gofiletype_pre("asm")
au BufReadPost *.s call s:gofiletype_post()
au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl
+" remove the autocommands for modsim3, and lprolog files so that their
+" highlight groups, syntax, etc. will not be loaded. *.MOD is included, so
+" that on case insensitive file systems the module2 autocmds will not be
+" executed.
+au! BufNewFile,BufRead *.mod,*.MOD
" Set the filetype if the first non-comment and non-blank line starts with
" 'module <path>'.
au BufNewFile,BufRead go.mod call s:gomod()
@@ -390,6 +399,10 @@ fun! s:gomod()
endfor
endfun
+" restore Vi compatibility settings
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
" vim: sw=2 ts=2 et
augroup end
endif
@@ -397,6 +410,7 @@ endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
augroup filetypedetect
" graphql, from graphql.vim in jparise/vim-graphql
+" vint: -ProhibitAutocmdWithNoGroup
au BufRead,BufNewFile *.graphql,*.graphqls,*.gql setfiletype graphql
augroup end
endif
@@ -484,6 +498,7 @@ autocmd BufRead,BufNewFile Jenkinsfile set ft=Jenkinsfile
autocmd BufRead,BufNewFile Jenkinsfile* setf Jenkinsfile
autocmd BufRead,BufNewFile *.jenkinsfile set ft=Jenkinsfile
autocmd BufRead,BufNewFile *.jenkinsfile setf Jenkinsfile
+autocmd BufRead,BufNewFile *.Jenkinsfile setf Jenkinsfile
augroup end
endif
@@ -912,6 +927,9 @@ au BufNewFile,BufRead Appraisals call s:setf('ruby')
" Autotest
au BufNewFile,BufRead .autotest call s:setf('ruby')
+" Axlsx
+au BufNewFile,BufRead *.axlsx call s:setf('ruby')
+
" Buildr Buildfile
au BufNewFile,BufRead [Bb]uildfile call s:setf('ruby')
@@ -1054,7 +1072,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') ==
" terraform, from terraform.vim in hashivim/vim-terraform
au BufRead,BufNewFile *.tf setlocal filetype=terraform
au BufRead,BufNewFile *.tfvars setlocal filetype=terraform
-au BufRead,BufNewFile *.tfstate setlocal filetype=javascript
+au BufRead,BufNewFile *.tfstate setlocal filetype=json
+au BufRead,BufNewFile *.tfstate.backup setlocal filetype=json
augroup end
endif