hare.vim 782 B

123456789101112131415161718192021222324252627
  1. " Vim autoload file.
  2. " Language: Hare
  3. " Maintainer: Amelia Clarke <selene@perilune.dev>
  4. " Last Updated: 2024-05-10
  5. " Upstream: https://git.sr.ht/~sircmpwn/hare.vim
  6. " Attempt to find the directory for a given Hare module.
  7. function hare#FindModule(str)
  8. let path = substitute(trim(a:str, ':', 2), '::', '/', 'g')
  9. let dir = finddir(path)
  10. while !empty(path) && empty(dir)
  11. let path = substitute(path, '/\?\h\w*$', '', '')
  12. let dir = finddir(path)
  13. endwhile
  14. return dir
  15. endfunction
  16. " Return the value of HAREPATH if it exists. Otherwise use a reasonable default.
  17. function hare#GetPath()
  18. if empty($HAREPATH)
  19. return '/usr/src/hare/stdlib,/usr/src/hare/third-party'
  20. endif
  21. return substitute($HAREPATH, ':', ',', 'g')
  22. endfunction
  23. " vim: et sts=2 sw=2 ts=8