The core API is exposed under the paredit.api
module
{
cursor_behaviour = "auto", -- remain, follow, auto
indent = {
enabled = false,
indentor = require("nvim-paredit.indentation.native").indentor,
},
}
Expands the current form by pulling in the next expression into the form.
opts
- see SlurpBarfOpts
Expands the current form by pulling the previous expression into the form.
opts
- see SlurpBarfOpts
Removes the last expression from the current form, pushing it outwards.
opts
- see SlurpBarfOpts
Removes the first expression from the current form, pushing it outwards.
opts
- see SlurpBarfOpts
{
dragging = {
enable_auto_drag = true
}
}
Moves the current element or pair forwards within its form.
opts
- see ElementDragOpts
Moves the current element or pair backwards within its form.
opts
- see ElementDragOpts
Moves the current pair of elements forwards within its form.
Inputs:
pair
: (Optional) The pair of elements to drag forwards. Defaults to the pair at the current cursor position.
Moves the current pair of elements backwards within its form.
Inputs:
pair
: (Optional) The pair of elements to drag backwards. Defaults to the pair at the current cursor position.
Moves the current form forwards within its parent form.
Moves the current form backwards within its parent form.
Raises the current element, removing it from its enclosing form.
Raises the current form, removing it from its enclosing form.
Deletes the current form.
Deletes the content inside the current form without removing the form itself.
Deletes the current top-level form.
Deletes the content inside the current top-level form without removing the form itself.
Deletes the current element.
Moves the cursor to the tail of the next element in the form.
Moves the cursor to the head of the next element in the form.
Moves the cursor to the head of the previous element in the form.
Moves the cursor to the tail of the previous element in the form.
Moves the cursor to the start of the parent form.
Moves the cursor to the end of the parent form.
Selects the form surrounding the cursor, including the enclosing delimiters.
Selects the content inside the form surrounding the cursor, excluding the enclosing delimiters.
Selects the top-level form surrounding the cursor, including the enclosing delimiters.
Selects the content inside the top-level form surrounding the cursor, excluding the enclosing delimiters.
Selects the current element under the cursor.
Wraps the element under the cursor with a prefix and suffix.
prefix
: stringsuffix
: string
Returns The wrapped TSNode
.
Wraps the enclosing form under the cursor with a prefix and suffix.
prefix
: stringsuffix
: string
Returns The wrapped TSNode
.
Unwraps the nearest form under the cursor. This is called splice in other paredit implementations.
These APIs are exposed from paredit.api.cursor
.
Places the cursor at a specific position within a TSNode
.
node
: TheTSNode
to operate withinopts
tableplacement
: (Optional) The position relative to the node. Can beleft_edge
,inner_start
,inner_end
, orright_edge
. Defaults toleft_edge
.mode
: (Optional) The mode for cursor placement. Currently onlyinsert
is supported, defaults tonormal
.