Initial commit: Neovim config with Fennel via nfnl
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
# Claude Code Context
|
||||
|
||||
This is a Neovim configuration using Fennel (a Lisp that compiles to Lua) via nfnl.
|
||||
|
||||
## Key Concepts
|
||||
|
||||
- **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
|
||||
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
|
||||
|
||||
**IMPORTANT FOR CLAUDE:** After editing any `.fnl` file, compile all Fennel files to Lua:
|
||||
```bash
|
||||
cd ~/.config/nvim && nvim --headless -c "NfnlCompileAllFiles" -c "qa"
|
||||
```
|
||||
|
||||
## Fennel Syntax Quick Reference
|
||||
|
||||
```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))}
|
||||
```
|
||||
|
||||
## 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)
|
||||
Reference in New Issue
Block a user