blob: c4581fccf9af8402ed4e60dba57812895f8a007c [file] [log] [blame]
Amelia Clarke35dfe582024-05-24 08:05:00 +02001" 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
7" Attempt to find the directory for a given Hare module.
8function hare#FindModule(str)
9 let path = substitute(trim(a:str, ':', 2), '::', '/', 'g')
10 let dir = finddir(path)
11 while !empty(path) && empty(dir)
12 let path = substitute(path, '/\?\h\w*$', '', '')
13 let dir = finddir(path)
14 endwhile
15 return dir
16endfunction
17
18" Return the value of HAREPATH if it exists. Otherwise use a reasonable default.
19function hare#GetPath()
20 if empty($HAREPATH)
21 return '/usr/src/hare/stdlib,/usr/src/hare/third-party'
22 endif
23 return substitute($HAREPATH, ':', ',', 'g')
24endfunction
25
26" vim: et sts=2 sw=2 ts=8