diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-01-27 22:22:49 +0100 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-01-27 22:22:55 +0100 |
commit | 74c70a76cc430495b744616bb6195a5ee7e56d43 (patch) | |
tree | b610c7f5eae159b20f194f5176ec3a70db661ace | |
parent | cf1ec23a2d2e501aca8dc0a7090fa9566c8ecab5 (diff) |
nvim: parens: Add extra useful keybindings
-rw-r--r-- | nvim/nvim/lua/parens.lua | 43 |
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", + } } } } |