vital.vim 400 B

123456789101112
  1. function! vital#of(name) abort
  2. let files = globpath(&runtimepath, 'autoload/vital/' . a:name . '.vital', 1)
  3. let file = split(files, "\n")
  4. if empty(file)
  5. throw 'vital: version file not found: ' . a:name
  6. endif
  7. let ver = readfile(file[0], 'b')
  8. if empty(ver)
  9. throw 'vital: invalid version file: ' . a:name
  10. endif
  11. return vital#_{substitute(ver[0], '\W', '', 'g')}#new()
  12. endfunction