Skip to content

Commit 22f9ba0

Browse files
committed
Load matchers only when loader is defined for required filetype
1 parent 3a45658 commit 22f9ba0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

autoload/fancy.vim

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,17 +200,24 @@ fun! s:loader_is_cached(ft) dict abort
200200
return has_key(self.filetypes, a:ft)
201201
endf
202202

203+
fun! s:loader_is_defined(ft) dict abort
204+
let func = 'autoload/fancy/ft/'.a:ft.'.vim'
205+
return !empty(globpath(&rtp, func))
206+
endf
207+
203208
fun! s:loader_load_by_filetype(ft) dict abort
204209
if self.is_cached(a:ft)
205210
return self.load(a:ft)
206-
else
211+
212+
elseif self.is_defined(a:ft)
207213
let matchers = fancy#ft#{a:ft}#matchers()
208214
call self.save(a:ft, matchers)
209215
return matchers
216+
endif
210217
endf
211218

212219
call s:add_methods('loader', [
213-
\ 'load', 'save', 'is_cached', 'load_by_filetype'
220+
\ 'load', 'save', 'is_cached', 'load_by_filetype', 'is_defined'
214221
\ ])
215222

216223
" }}}

0 commit comments

Comments
 (0)