Skip to content

Commit 918610d

Browse files
Put shebang detection function in s: instead of b: (#746)
Fixes #743
1 parent 4d4aa5f commit 918610d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

autoload/polyglot/init.vim

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2672,19 +2672,24 @@ endif
26722672

26732673
" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE
26742674

2675-
func! s:Observe(fn)
2676-
let b:PolyglotObserve = function("polyglot#" . a:fn)
2675+
let s:detect_func = 'shebang#Detect'
2676+
2677+
func! s:PolyglotObserve(fn)
2678+
call function("polyglot#" . a:fn)
2679+
endfunc
2680+
2681+
func! s:Observe()
26772682
augroup polyglot-observer
26782683
au!
2679-
au CursorHold,CursorHoldI <buffer> if (&ft == "" || &ft == "conf") | call b:PolyglotObserve() | endif
2684+
au CursorHold,CursorHoldI <buffer> if (&ft == "" || &ft == "conf") | call s:PolyglotObserve(s:detect_func) | endif
26802685
augroup END
26812686
endfunc
26822687

26832688
au BufNewFile,BufRead,StdinReadPost,BufWritePost * if (&ft == "" || &ft == "conf") && expand("<afile>:e") == "" |
26842689
\ call polyglot#shebang#Detect() | endif
26852690

26862691
au BufWinEnter * if &ft == "" && expand("<afile>:e") == "" |
2687-
\ call s:Observe('shebang#Detect') | endif
2692+
\ call s:Observe() | endif
26882693

26892694
au BufWritePost * au! polyglot-observer
26902695

0 commit comments

Comments
 (0)