Open dbarnett opened 9 years ago
A few terrible ways I can imagine for implementing this:
A really bad example of the last point for illustration purposes:
autocmd BufRead,BufNewFile,FileType * let g:ft_related_event = 1
autocmd CursorHold,InsertChange * if g:ft_related_event |
\ call FiletypeKnownHook() | let g:ft_related_event = 0 | endif
If a plugin wants to have configuration based on a buffer's filetype, it turns out to be tricky to handle if you need to explicitly handle the case where filetype wasn't set. You can use "autocmd FileType", but that will never fire for a new buffer with no filetype, and can fire multiple times for a single new buffer if autocmds are overriding filetype on each other.
It would be useful to have a hook for code that needs to read the 'filetype' setting and expects it to already be valid even for no-filetype buffers. This hook should fire:
Ideally, this would be implemented inside vim, and might be tricky or impossible to implement properly in maktaba, but it's worth discussing.