2.4 KiB
2.4 KiB
Claude Code Context
This is a Neovim configuration using Fennel (a Lisp that compiles to Lua) via nfnl.
Key Concepts
- nfnl compiles
.fnlfiles to.luaon save - lazy.nvim is the plugin manager
- Bootstrap files are in Lua; user config is in Fennel
File Structure
init.lua - Entry point (Lua, do not convert to Fennel)
lua/bootstrap.lua - Core plugins in Lua (nfnl, treesitter, telescope)
lua/config/ - AUTO-GENERATED from fnl/config/ - do not edit
lua/plugins/ - AUTO-GENERATED from fnl/plugins/ - do not edit
fnl/config/ - User config in Fennel (options, keymaps, autocmds)
fnl/plugins/ - Plugin specs in Fennel
.nfnl.fnl - nfnl configuration
Editing Rules
- Never edit files in
lua/config/orlua/plugins/- they are auto-generated - Edit Fennel files in
fnl/- they compile tolua/on save init.luaandlua/bootstrap.luastay as Lua - they bootstrap nfnl
Compiling Fennel (MANDATORY)
After editing ANY .fnl file, you MUST compile it to Lua:
cd ~/.config/nvim && nvim --headless -c "NfnlCompileAllFiles" -c "qa"
If compilation says "destination-exists", delete the lua file first to force recompile:
cd ~/.config/nvim && rm lua/plugins/init.lua && nvim --headless -c "NfnlCompileAllFiles" -c "qa"
Trust Issue Fix
If you see ".nfnl.fnl is not trusted", add it to nvim's trust database:
sha256sum ~/.config/nvim/.nfnl.fnl | awk '{print $1 " /home/ajet/.config/nvim/.nfnl.fnl"}' >> ~/.local/state/nvim/trust
Fennel Syntax Quick Reference
;; Set vim option
(set vim.opt.number true)
;; Define keymap
(vim.keymap.set :n "<leader>x" ":cmd<CR>" {:desc "Description"})
;; Local variable
(local foo (require :foo))
;; Let binding
(let [x 1 y 2] (+ x y))
;; Function
(fn my-func [arg] (print arg))
;; Lambda
(fn [x] (* x 2))
;; Plugin spec (lazy.nvim format)
{:1 "author/plugin"
:ft ["fennel" "lua"]
:config (fn [] (setup-code))}
Common Tasks
Add a plugin
Edit fnl/plugins/init.fnl, add spec to the vector, save.
Add a keymap
Edit fnl/config/init.fnl, add (vim.keymap.set ...), save.
Add an option
Edit fnl/config/init.fnl, add (set vim.opt.foo value), save.
Force recompile all Fennel
Run :NfnlCompileAllFiles in Neovim.
Leader Keys
- Leader:
<Space> - Local leader:
<Space>(same as leader, used by Conjure and paredit)