diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-24 18:52:58 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-24 18:52:58 +0200 |
commit | 9ff714cb6c43b920fd76ff793641c5191bf2e991 (patch) | |
tree | 510d832c908133a33ac095e17acf025d6f46a907 /ftdetect | |
parent | e2bbed8acc1f1cf498a0085cf771cf9bf40fb709 (diff) | |
download | vim-polyglot-9ff714cb6c43b920fd76ff793641c5191bf2e991.tar.gz vim-polyglot-9ff714cb6c43b920fd76ff793641c5191bf2e991.zip |
Extract non-generated code to polyglot.vim
Diffstat (limited to 'ftdetect')
-rw-r--r-- | ftdetect/polyglot.vim | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index d6379ae2..cba8cf86 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -1,3 +1,5 @@ +""" ftdetect/polyglot.vim + " don't spam the user when Vim is started in Vi compatibility mode let s:cpo_save = &cpo set cpo&vim @@ -87,9 +89,6 @@ endfunc augroup filetypedetect -au! filetypedetect BufRead,BufNewFile,StdinReadPost * - -" filetypes if !has_key(s:disabled_packages, '8th') au! BufRead,BufNewFile *.8th @@ -2017,20 +2016,12 @@ if !has_key(s:disabled_packages, 'tads') endif -" end filetypes -func! s:PolyglotFallback() - if expand("<afile>") !~ g:ft_ignore_pat - if getline(1) =~# "^#!" - call polyglot#Shebang() - endif - if &filetype == '' - runtime! scripts.vim - endif - endif -endfunc +au! BufNewFile,BufRead,StdinReadPost * if expand("<afile>") !~ g:ft_ignore_pat | + \ call polyglot#Shebang() | endif -au BufNewFile,BufRead,StdinReadPost * call s:PolyglotFallback() +au BufEnter * if &ft == "" && expand("<afile>") !~ g:ft_ignore_pat | + \ call polyglot#ObserveShebang() | endif augroup END @@ -2227,17 +2218,6 @@ endfunc au VimEnter * call s:verify() -func! s:observe_filetype() - augroup polyglot-observer - au! CursorHold,CursorHoldI <buffer> - \ if polyglot#Shebang() | au! polyglot-observer CursorHold,CursorHoldI | endif - augroup END -endfunc - -au BufEnter * if &ft == "" && expand("<afile>") !~ g:ft_ignore_pat - \ | call s:observe_filetype() | endif - - " Save polyglot_disabled without postfixes if exists('g:polyglot_disabled') let g:polyglot_disabled = s:new_polyglot_disabled @@ -2245,4 +2225,3 @@ endif " restore Vi compatibility settings let &cpo = s:cpo_save -unlet s:cpo_save |