Put shebang detection function in s: instead of b: (#746)

Fixes #743
This commit is contained in:
NariyasuHeseri
2021-11-22 08:54:40 +09:00
committed by GitHub
parent 4d4aa5fe55
commit 918610d427

View File

@@ -2672,11 +2672,16 @@ endif
" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE " DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE
func! s:Observe(fn) let s:detect_func = 'shebang#Detect'
let b:PolyglotObserve = function("polyglot#" . a:fn)
func! s:PolyglotObserve(fn)
call function("polyglot#" . a:fn)
endfunc
func! s:Observe()
augroup polyglot-observer augroup polyglot-observer
au! au!
au CursorHold,CursorHoldI <buffer> if (&ft == "" || &ft == "conf") | call b:PolyglotObserve() | endif au CursorHold,CursorHoldI <buffer> if (&ft == "" || &ft == "conf") | call s:PolyglotObserve(s:detect_func) | endif
augroup END augroup END
endfunc endfunc
@@ -2684,7 +2689,7 @@ au BufNewFile,BufRead,StdinReadPost,BufWritePost * if (&ft == "" || &ft == "conf
\ call polyglot#shebang#Detect() | endif \ call polyglot#shebang#Detect() | endif
au BufWinEnter * if &ft == "" && expand("<afile>:e") == "" | au BufWinEnter * if &ft == "" && expand("<afile>:e") == "" |
\ call s:Observe('shebang#Detect') | endif \ call s:Observe() | endif
au BufWritePost * au! polyglot-observer au BufWritePost * au! polyglot-observer