diff options
| author | Mike Vink <mike1994vink@gmail.com> | 2022-11-29 00:12:25 +0100 |
|---|---|---|
| committer | Mike Vink <mike1994vink@gmail.com> | 2022-11-29 00:12:25 +0100 |
| commit | de3f5a8d268de01d3252f2689a7f1ffcaf7d7ec7 (patch) | |
| tree | cdcbf8bc8fee98834b3cd0296a20856684c1f7c6 /init.fnl | |
neovim fennel config
Diffstat (limited to 'init.fnl')
| -rw-r--r-- | init.fnl | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/init.fnl b/init.fnl new file mode 100644 index 0000000..9dfac8d --- /dev/null +++ b/init.fnl @@ -0,0 +1,34 @@ +;; 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) |
