Amelia Clarke | 35dfe58 | 2024-05-24 08:05:00 +0200 | [diff] [blame] | 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 | |
| 7 | " Attempt to find the directory for a given Hare module. |
| 8 | function 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 |
| 16 | endfunction |
| 17 | |
| 18 | " Return the value of HAREPATH if it exists. Otherwise use a reasonable default. |
| 19 | function hare#GetPath() |
| 20 | if empty($HAREPATH) |
| 21 | return '/usr/src/hare/stdlib,/usr/src/hare/third-party' |
| 22 | endif |
| 23 | return substitute($HAREPATH, ':', ',', 'g') |
| 24 | endfunction |
| 25 | |
| 26 | " vim: et sts=2 sw=2 ts=8 |