return the parinfer and update

This commit is contained in:
mjhika 2024-02-09 22:32:39 -05:00
parent 3a123b3e19
commit be32cdee6c
2 changed files with 98 additions and 5 deletions

View file

@ -3,7 +3,7 @@ local lisp_dialects = { "clojure", "fennel", "scheme", "lisp" }
return {
{
"gpanders/nvim-parinfer",
ft = "lisp",
ft = lisp_dialects,
init = function()
vim.g.parinfer_force_balance = true
vim.g.parinfer_comment_chars = ";;"
@ -13,7 +13,100 @@ return {
"julienvincent/nvim-paredit",
ft = { "clojure", "fennel", "scheme" },
config = function()
require("nvim-paredit").setup()
local paredit = require("nvim-paredit")
paredit.setup({
use_default_keys = false,
keys = {
["<localleader>-"] = { paredit.unwrap.unwrap_form_under_cursor, "Splice sexp" },
[">e"] = { paredit.api.drag_element_forwards, "Drag element right" },
["<e"] = { paredit.api.drag_element_backwards, "Drag element left" },
[">f"] = { paredit.api.drag_form_forwards, "Drag form right" },
["<f"] = { paredit.api.drag_form_backwards, "Drag form left" },
["<localleader>uf"] = { paredit.api.raise_form, "Raise form" },
["<localleader>ue"] = { paredit.api.raise_element, "Raise element" },
["E"] = {
paredit.api.move_to_next_element_tail,
"Jump to next element tail",
-- by default all keybindings are dot repeatable
repeatable = false,
mode = { "n", "x", "o", "v" },
},
["W"] = {
paredit.api.move_to_next_element_head,
"Jump to next element head",
repeatable = false,
mode = { "n", "x", "o", "v" },
},
["B"] = {
paredit.api.move_to_prev_element_head,
"Jump to previous element head",
repeatable = false,
mode = { "n", "x", "o", "v" },
},
["gE"] = {
paredit.api.move_to_prev_element_tail,
"Jump to previous element tail",
repeatable = false,
mode = { "n", "x", "o", "v" },
},
["("] = {
paredit.api.move_to_parent_form_start,
"Jump to parent form's head",
repeatable = false,
mode = { "n", "x", "v" },
},
[")"] = {
paredit.api.move_to_parent_form_end,
"Jump to parent form's tail",
repeatable = false,
mode = { "n", "x", "v" },
},
-- These are text object selection keybindings which can used with standard `d, y, c`, `v`
["af"] = {
paredit.api.select_around_form,
"Around form",
repeatable = false,
mode = { "o", "v" }
},
["if"] = {
paredit.api.select_in_form,
"In form",
repeatable = false,
mode = { "o", "v" }
},
["aF"] = {
paredit.api.select_around_top_level_form,
"Around top level form",
repeatable = false,
mode = { "o", "v" }
},
["iF"] = {
paredit.api.select_in_top_level_form,
"In top level form",
repeatable = false,
mode = { "o", "v" }
},
["ae"] = {
paredit.api.select_element,
"Around element",
repeatable = false,
mode = { "o", "v" },
},
["ie"] = {
paredit.api.select_element,
"Element",
repeatable = false,
mode = { "o", "v" },
},
}
})
end
},
{