Paredit in Fennel for Clojure using Treesitter
- Form text objects
- Lists (s-exp, quoted list), vector, set are all under one text object
so instead of
di(
di[
di{
justdif
(or any other text object command)f
for current form.F
for root form
- Lists (s-exp, quoted list), vector, set are all under one text object
so instead of
- Slurp (Forward + Backwards)
- Bring in element/form into your form
- Barf (Forward + Backwards)
- Remove an element/form from your form
- Raise
- Remove parent form and replace with current form
- Wrap
- Add form around current form
- Insertion
- Move cursor to begining/end of form in insert mode
For lazy package manager
"grierson/formedit"
Based of tpope/vim-sexp-mappings-for-regular-people
local formedit = require("formedit")
vim.keymap.set('o', 'af', formedit.select.form, { desc = "Outer form" })
vim.keymap.set('o', 'aF', formedit.select.root, { desc = "Outer root form" })
vim.keymap.set('o', 'if', formedit.select.inner, { desc = "Inner form" })
vim.keymap.set('o', 'iF', formedit.select["inner-root"], { desc = "Inner root form" })
vim.keymap.set('n', '<localleader>h', formedit.insertion.head, { desc = "Head insert" })
vim.keymap.set('n', '<localleader>H', formedit.insertion.tail, { desc = "Tail insert" })
vim.keymap.set('n', '<localleader>i', formedit.wrap.head, { desc = "Wrap form " })
vim.keymap.set('n', '<localleader>o', formedit.raise.form, { desc = "Raise form" })
vim.keymap.set('n', '<localleader>O', formedit.raise.element, { desc = "Raise element" })
vim.keymap.set('n', '>)', formedit.slurp.forward, { desc = "Slurp forward" })
vim.keymap.set('n', '<(', formedit.slurp.backward, { desc = "Slurp backward" })
vim.keymap.set('n', '>(', formedit.barf.backward, { desc = "Barf backward" })
vim.keymap.set('n', '<)', formedit.barf.forward, { desc = "Barf forward" })
./scripts/nfnl # Download nfnl
just test # Run tests
just watch {featuer} # Run test in watch mode for feature
Find the full Unlicense in the UNLICENSE
file, but here's a
snippet.
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.