Skip to content

Commit

Permalink
slurp backwards does not require indentation also (put extra space)
Browse files Browse the repository at this point in the history
  • Loading branch information
armed committed Aug 13, 2023
1 parent ab45cc7 commit 7247ec5
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions lua/nvim-paredit/api/slurping.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,32 @@ local function slurp(opts)
offset = string.len(left_or_right_edge.text)
end

local token
if opts.reversed then
token = " "
else
token = ""
end
-- stylua: ignore
vim.api.nvim_buf_set_text(
buf,
left_or_right_edge.range[1], left_or_right_edge.range[2] + offset,
left_or_right_edge.range[3], left_or_right_edge.range[4] + offset,
{}
{token}
)

indentation.handle_indentation({
type = "slurp",
from = left_or_right_edge.range,
to = { row, col, row, col },
child = sibling,
parent = form,

indent_behaviour = opts.indent_behaviour or config.config.indent_behaviour,
lang = lang,
})
if not opts.reversed then
indentation.handle_indentation({
type = "slurp",
from = left_or_right_edge.range,
to = { row, col, row, col },
child = sibling,
parent = form,
reversed = opts.reversed,
indent_behaviour = opts.indent_behaviour or config.config.indent_behaviour,
lang = lang,
})
end

local cursor_behaviour = opts.cursor_behaviour or config.config.cursor_behaviour
if cursor_behaviour == "follow" then
Expand Down

0 comments on commit 7247ec5

Please sign in to comment.