diff options
author | NariyasuHeseri <31871512+NariyasuHeseri@users.noreply.github.com> | 2021-11-22 08:54:40 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-22 00:54:40 +0100 |
commit | 918610d427503c5c7b380eae4a954bd8cb427db5 (patch) | |
tree | b44a56631e6863e57d91d22c547affc6de32d706 | |
parent | 4d4aa5fe553a47ef5c5c6d0a97bb487fdfda2d5b (diff) | |
download | vim-polyglot-918610d427503c5c7b380eae4a954bd8cb427db5.tar.gz vim-polyglot-918610d427503c5c7b380eae4a954bd8cb427db5.zip |
Put shebang detection function in `s:` instead of `b:` (#746)
Fixes #743
-rw-r--r-- | autoload/polyglot/init.vim | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/autoload/polyglot/init.vim b/autoload/polyglot/init.vim index 0f324453..fcba050f 100644 --- a/autoload/polyglot/init.vim +++ b/autoload/polyglot/init.vim @@ -2672,11 +2672,16 @@ endif " DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE -func! s:Observe(fn) - let b:PolyglotObserve = function("polyglot#" . a:fn) +let s:detect_func = 'shebang#Detect' + +func! s:PolyglotObserve(fn) + call function("polyglot#" . a:fn) +endfunc + +func! s:Observe() augroup polyglot-observer 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 endfunc @@ -2684,7 +2689,7 @@ au BufNewFile,BufRead,StdinReadPost,BufWritePost * if (&ft == "" || &ft == "conf \ call polyglot#shebang#Detect() | endif au BufWinEnter * if &ft == "" && expand("<afile>:e") == "" | - \ call s:Observe('shebang#Detect') | endif + \ call s:Observe() | endif au BufWritePost * au! polyglot-observer |