summaryrefslogtreecommitdiff
path: root/nvim
diff options
context:
space:
mode:
Diffstat (limited to 'nvim')
-rw-r--r--nvim/nvim/lua/parens.lua43
1 files changed, 43 insertions, 0 deletions
diff --git a/nvim/nvim/lua/parens.lua b/nvim/nvim/lua/parens.lua
index d60a35c..da41695 100644
--- a/nvim/nvim/lua/parens.lua
+++ b/nvim/nvim/lua/parens.lua
@@ -130,6 +130,49 @@ parpar.setup {
repeatable = false,
mode = { "o", "v" },
},
+ ["<localleader>w"] = {
+ function()
+ -- place cursor and set mode to `insert`
+ paredit.cursor.place_cursor(
+ -- wrap element under cursor with `( ` and `)`
+ paredit.wrap.wrap_element_under_cursor("( ", ")"),
+ -- cursor placement opts
+ { placement = "inner_start", mode = "insert" }
+ )
+ end,
+ "Wrap element insert head",
+ },
+
+ ["<localleader>W"] = {
+ function()
+ paredit.cursor.place_cursor(
+ paredit.wrap.wrap_element_under_cursor("(", ")"),
+ { placement = "inner_end", mode = "insert" }
+ )
+ end,
+ "Wrap element insert tail",
+ },
+
+ -- same as above but for enclosing form
+ ["<localleader>i"] = {
+ function()
+ paredit.cursor.place_cursor(
+ paredit.wrap.wrap_enclosing_form_under_cursor("( ", ")"),
+ { placement = "inner_start", mode = "insert" }
+ )
+ end,
+ "Wrap form insert head",
+ },
+
+ ["<localleader>I"] = {
+ function()
+ paredit.cursor.place_cursor(
+ paredit.wrap.wrap_enclosing_form_under_cursor("(", ")"),
+ { placement = "inner_end", mode = "insert" }
+ )
+ end,
+ "Wrap form insert tail",
+ }
}
}
}