81 lines
3.0 KiB
Markdown
81 lines
3.0 KiB
Markdown
# Claude Code Context
|
|
|
|
Neovim config using Fennel (a Lisp that compiles to Lua) via nfnl.
|
|
|
|
## Editing Rules (CRITICAL)
|
|
|
|
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 before it exists
|
|
|
|
## Compiling Fennel (MANDATORY)
|
|
|
|
**After editing ANY `.fnl` file, you MUST compile it to Lua:**
|
|
|
|
```bash
|
|
cd ~/.config/nvim && nvim --headless -c "NfnlCompileAllFiles" -c "qa"
|
|
```
|
|
|
|
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"
|
|
```
|
|
|
|
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
|
|
```
|
|
|
|
## File Structure
|
|
|
|
```
|
|
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)
|
|
```
|
|
|
|
## Plugins
|
|
|
|
**Bootstrap (Lua):** nfnl, nvim-treesitter, telescope.nvim
|
|
|
|
**User (Fennel):** tokyonight.nvim, conjure, nvim-parinfer, vim-sexp (+ tpope mappings), mason.nvim, mason-tool-installer, hop.nvim, which-key.nvim
|
|
|
|
Mason auto-installs: clojure-lsp, clj-kondo, fennel-ls, lua-language-server
|
|
|
|
## 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, 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
|
|
```
|