I wonder if there is an elegant way to determine if a specific file exists in/under one of the entries of &rtp
.
Currently, I use the following construct:
let s:found_ = 0
for s:dir_ in split(&rtp, ',')
let s:file_ = s:dir_ . '/autoload/FooBarBaz.vim'
if filereadable(s:file_)
let s:found_ = 1
break
endif
endfor
if s:found_
call FooBarBaz#func()
endif
I am under the impression that vim could offer a function or something that does it more elegantly, such as exists('*FooBarBaz#func')
which unfortunately didn't work as I intended.