;; Iterate over all directories from the root to the cwd.

;; For every .lnvim.fnl, compile it to .lvim.lua (if required) and execute it.

;; If a .lua is found without a .fnl, delete the .lua to clean up.

(

let

[

cwd

(

cwd

)

dirs

(

parents

cwd

)]

(

table

.

insert

dirs

cwd

)

(

core

.

run!

(

fn

[

dir

]

(

let

[

src

(

..

dir

"/.lnvim.fnl"

)

dest

(

..

dir

"/.lnvim.lua"

)]

(

if

(

file-readable?

src

)

(

do

(

compile

.

file

src

dest

)

(

nvim

.

ex

.

luafile

dest

))

(

when

(

file-readable?

dest

)

(

nvim

.

fn

.

delete

dest

)))))

dirs

))