summaryrefslogtreecommitdiffstats
path: root/ftdetect
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2020-09-24 22:52:50 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2020-09-24 22:52:50 +0200
commita6a6aeab76bef135d9f76534efa5ee7391c4ed2a (patch)
tree5185bc4f10e43058b3565c3eeef827327b26eab4 /ftdetect
parent444e7f184df91f1605f06242ad68defb33c2f454 (diff)
downloadvim-polyglot-4.12.0.tar.gz
vim-polyglot-4.12.0.zip
Improve django filetype detection, closes #560v4.12.0
Diffstat (limited to 'ftdetect')
-rw-r--r--ftdetect/polyglot.vim10
1 files changed, 9 insertions, 1 deletions
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim
index 343d4528..f1a48357 100644
--- a/ftdetect/polyglot.vim
+++ b/ftdetect/polyglot.vim
@@ -9,6 +9,14 @@ if exists('g:polyglot_test')
autocmd!
endif
+func! polyglot#Observe(fn)
+ let b:polyglot_observe = a:fn
+ augroup polyglot-observer
+ au! CursorHold,CursorHoldI,BufWritePost <buffer>
+ \ execute('if polyglot#' . b:polyglot_observe . '() | au! polyglot-observer | endif')
+ augroup END
+endfunc
+
let s:disabled_packages = {}
let s:new_polyglot_disabled = []
@@ -2021,7 +2029,7 @@ au! BufNewFile,BufRead,StdinReadPost * if expand("<afile>") !~ g:ft_ignore_pat |
\ call polyglot#Shebang() | endif
au BufEnter * if &ft == "" && expand("<afile>") !~ g:ft_ignore_pat |
- \ call polyglot#ObserveShebang() | endif
+ \ call polyglot#Observe('Shebang') | endif
augroup END