This commit is contained in:
2026-02-15 01:12:14 -05:00
parent 3a57b881f7
commit 6636435293
2 changed files with 48 additions and 61 deletions
+47 -60
View File
@@ -1,30 +1,12 @@
# Claude Code Context
This is a Neovim configuration using Fennel (a Lisp that compiles to Lua) via nfnl.
Neovim config using Fennel (a Lisp that compiles to Lua) via nfnl.
## Key Concepts
## Editing Rules (CRITICAL)
- **nfnl** compiles `.fnl` files to `.lua` on 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
1. **Never edit files in `lua/config/` or `lua/plugins/`** - they are auto-generated
1. **Never edit files in `lua/config/`, `lua/plugins/`, or `lua/lisp-school.lua`** - they are auto-generated by nfnl
2. **Edit Fennel files in `fnl/`** - they compile to `lua/` on save
3. **`init.lua` and `lua/bootstrap.lua` stay as Lua** - they bootstrap nfnl
3. **`init.lua` and `lua/bootstrap.lua` stay as Lua** - they bootstrap nfnl before it exists
## Compiling Fennel (MANDATORY)
@@ -34,60 +16,65 @@ fnl/plugins/ - Plugin specs in Fennel
cd ~/.config/nvim && nvim --headless -c "NfnlCompileAllFiles" -c "qa"
```
If compilation says "destination-exists", delete the lua file first to force recompile:
If compilation says "destination-exists", delete the target lua file first:
```bash
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:
If you see ".nfnl.fnl is not trusted":
```bash
sha256sum ~/.config/nvim/.nfnl.fnl | awk '{print $1 " /home/ajet/.config/nvim/.nfnl.fnl"}' >> ~/.local/state/nvim/trust
```
## Fennel Syntax Quick Reference
## File Structure
```fennel
;; 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))}
```
init.lua - Entry point (Lua), sets leader keys, bootstraps lazy.nvim
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
lua/lisp-school.lua - AUTO-GENERATED from fnl/lisp-school.fnl - DO NOT EDIT
fnl/config/init.fnl - Options, keymaps, LSP config, autocmds
fnl/config/parinfer.fnl - Parinfer toggle logic + sexp coordination
fnl/plugins/init.fnl - Plugin specs (lazy.nvim format)
fnl/lisp-school.fnl - Interactive vim-sexp tutorial (:LispSchool)
.nfnl.fnl - nfnl configuration (empty, uses defaults)
```
## Common Tasks
## Plugins
### Add a plugin
Edit `fnl/plugins/init.fnl`, add spec to the vector, save.
**Bootstrap (Lua):** nfnl, nvim-treesitter, telescope.nvim
### Add a keymap
Edit `fnl/config/init.fnl`, add `(vim.keymap.set ...)`, save.
**User (Fennel):** tokyonight.nvim, conjure, nvim-parinfer, vim-sexp (+ tpope mappings), mason.nvim, mason-tool-installer, hop.nvim, which-key.nvim
### Add an option
Edit `fnl/config/init.fnl`, add `(set vim.opt.foo value)`, save.
Mason auto-installs: clojure-lsp, clj-kondo, fennel-ls, lua-language-server
### Force recompile all Fennel
Run `:NfnlCompileAllFiles` in Neovim.
## LSP
Uses Neovim 0.11+ built-in LSP (`vim.lsp.config` / `vim.lsp.enable`), NOT nvim-lspconfig:
- **clojure_lsp** - .clj/.edn files
- **lua_ls** - .lua files
- **fennel_language_server** - .fnl files
## Leader Keys
- Leader: `<Space>`
- Local leader: `<Space>` (same as leader, used by Conjure and paredit)
- Local leader: `<Space>` (same, used by Conjure)
## Common Tasks
- **Add a plugin:** Edit `fnl/plugins/init.fnl`, add spec to the vector
- **Add a keymap:** Edit `fnl/config/init.fnl`, add `(vim.keymap.set ...)`
- **Add an option:** Edit `fnl/config/init.fnl`, add `(set vim.opt.foo value)`
- **After any edit:** Compile with the command above
## Fennel Syntax Quick Reference
```fennel
(set vim.opt.number true) ;; vim option
(vim.keymap.set :n "<leader>x" ":cmd<CR>" {:desc "Desc"}) ;; keymap
(local foo (require :foo)) ;; require
(let [x 1 y 2] (+ x y)) ;; let binding
(fn my-func [arg] (print arg)) ;; function
{:1 "author/plugin" :ft ["fennel"] :config (fn [] (setup))} ;; plugin spec
```
+1 -1
View File
@@ -58,7 +58,7 @@
{repo "WhoIsSethDaniel/mason-tool-installer.nvim"
:lazy false
:dependencies ["williamboman/mason.nvim"]
:opts {:ensure_installed ["clojure-lsp" "clj-kondo"]}}
:opts {:ensure_installed ["clojure-lsp" "clj-kondo" "fennel-ls" "lua-language-server"]}}
;; Hop - EasyMotion-like word jumping
{repo "smoka7/hop.nvim"