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 # 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 1. **Never edit files in `lua/config/`, `lua/plugins/`, or `lua/lisp-school.lua`** - they are auto-generated by nfnl
- **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
2. **Edit Fennel files in `fnl/`** - they compile to `lua/` on save 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) ## Compiling Fennel (MANDATORY)
@@ -34,60 +16,65 @@ fnl/plugins/ - Plugin specs in Fennel
cd ~/.config/nvim && nvim --headless -c "NfnlCompileAllFiles" -c "qa" 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 ```bash
cd ~/.config/nvim && rm lua/plugins/init.lua && nvim --headless -c "NfnlCompileAllFiles" -c "qa" 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":
If you see ".nfnl.fnl is not trusted", add it to nvim's trust database:
```bash ```bash
sha256sum ~/.config/nvim/.nfnl.fnl | awk '{print $1 " /home/ajet/.config/nvim/.nfnl.fnl"}' >> ~/.local/state/nvim/trust 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 init.lua - Entry point (Lua), sets leader keys, bootstraps lazy.nvim
(set vim.opt.number true) lua/bootstrap.lua - Core plugins in Lua: nfnl, treesitter, telescope
lua/config/ - AUTO-GENERATED from fnl/config/ - DO NOT EDIT
;; Define keymap lua/plugins/ - AUTO-GENERATED from fnl/plugins/ - DO NOT EDIT
(vim.keymap.set :n "<leader>x" ":cmd<CR>" {:desc "Description"}) lua/lisp-school.lua - AUTO-GENERATED from fnl/lisp-school.fnl - DO NOT EDIT
fnl/config/init.fnl - Options, keymaps, LSP config, autocmds
;; Local variable fnl/config/parinfer.fnl - Parinfer toggle logic + sexp coordination
(local foo (require :foo)) fnl/plugins/init.fnl - Plugin specs (lazy.nvim format)
fnl/lisp-school.fnl - Interactive vim-sexp tutorial (:LispSchool)
;; Let binding .nfnl.fnl - nfnl configuration (empty, uses defaults)
(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 ## Plugins
### Add a plugin **Bootstrap (Lua):** nfnl, nvim-treesitter, telescope.nvim
Edit `fnl/plugins/init.fnl`, add spec to the vector, save.
### Add a keymap **User (Fennel):** tokyonight.nvim, conjure, nvim-parinfer, vim-sexp (+ tpope mappings), mason.nvim, mason-tool-installer, hop.nvim, which-key.nvim
Edit `fnl/config/init.fnl`, add `(vim.keymap.set ...)`, save.
### Add an option Mason auto-installs: clojure-lsp, clj-kondo, fennel-ls, lua-language-server
Edit `fnl/config/init.fnl`, add `(set vim.opt.foo value)`, save.
### Force recompile all Fennel ## LSP
Run `:NfnlCompileAllFiles` in Neovim.
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 Keys
- Leader: `<Space>` - 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" {repo "WhoIsSethDaniel/mason-tool-installer.nvim"
:lazy false :lazy false
:dependencies ["williamboman/mason.nvim"] :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 ;; Hop - EasyMotion-like word jumping
{repo "smoka7/hop.nvim" {repo "smoka7/hop.nvim"