init.fnl 817 B

12345678910111213141516171819202122232425262728293031
  1. (import-macros {: self! : for! } :macros)
  2. (local fennel (require :fennel))
  3. (local self* (self!))
  4. (let [pkg-paths [:path :macro-path]]
  5. ((. table :insert)
  6. (or (. package :loaders) (. package :searchers))
  7. (. fennel :searcher))
  8. (for! i pkg-paths
  9. (tset fennel i
  10. (..
  11. (.. self* "fnl/?.fnl")
  12. ";"
  13. (.. self* "fnl/?/init.fnl")
  14. ";"
  15. (. fennel i)))))
  16. (let [{:loop {: fs_scandir : fs_scandir_next : fs_closedir}} vim
  17. dir-path (.. self* :fnl/config/)]
  18. (var dir (fs_scandir dir-path))
  19. (while dir
  20. (let [(name t) (fs_scandir_next dir)]
  21. (if name
  22. (when (and (= :file t)
  23. (= :.fnl (: name :sub -4))
  24. (not= :. (: name :sub 1 1)))
  25. ((. fennel :dofile) (.. dir-path name)))
  26. (set dir nil)))))