blob: 7e8267564958e41cd80693fc13f9fba5dc2e1ee8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
;; fixes nixpkgs hotpot not adding package path correctly
(tset _G.package :path
(.. (vim.fn.stdpath :cache) "/hotpot/hotpot.nvim/lua/?/init.lua;"
package.path))
(fn build-init []
(let [{: build} (require :hotpot.api.make)
allowed-globals (icollect [n _ (pairs _G)]
n)
opts {:verbosity 0
:compiler {:modules {:allowedGlobals allowed-globals}}}
here #(values $1)
config-path (vim.fn.stdpath :config)]
(build config-path opts (.. config-path :/init.fnl) here
(.. config-path :/after/ftdetect/.+) here
(.. config-path :/ftplugin/.+) here
(.. config-path :/after/ftplugin/.+) here)))
;; Call hotpot.setup and compile again after fs event
(let [hotpot (require :hotpot)
setup hotpot.setup
build hotpot.api.make.build
uv vim.loop
config-path (vim.fn.stdpath :config)]
(setup {:provide_require_fennel true
:compiler {:modules {:correlate true}
:macros {:env :_COMPILER
:compilerEnv _G
:allowedGlobals false}}})
(let [handle (uv.new_fs_event)
path (vim.fn.expand (.. config-path :/init.fnl))]
(uv.fs_event_start handle path {} #(vim.schedule build-init))
(vim.api.nvim_create_autocmd :VimLeavePre {:callback #(uv.close handle)})))
(require :conf)
|