Skip to main content Link Menu Expand (external link) Document Search Copy Copied

A Visual Guide to Paredit

What is Paredit?

A portmanteau of “parenthesis” and “editing”, Paredit originated in the Lisp community, but it’s not limited to Lisps. It’s a powerful way of structurally editing code that is often overlooked by popular editors.

Commands

  1. Slurp Forward
  2. Barf Forward
  3. Splice
  4. Raise
  5. Kill
  6. Cut
  7. Copy
  8. Delete Backward
  9. Delete Forward
  10. Move Cursor Forward
  11. Move Cursor Backward
  12. Move Cursor Up
  13. Move Cursor Down

Editing

The most commonly used commands are Slurp Forward and Barf Forward –used for editing code. If you are new to Paredit, consider starting with them!

🧃⏩ Slurp Forward

Keybinding
ctrl+alt+right
Description
Move the closing node forward, away from the cursor, past the following node, if any.
📼

🤮⏩ Barf Forward

Keybinding
ctrl+alt+left
Description
Move the closing node backward, toward the cursor, past the preceding form.
📼

🦠 Splice

Keybinding
ctrl+alt+s
Description
Remove the enclosing nodes.
📼

🪜 Raise

Keybinding
ctrl+alt+p ctrl+alt+r
Description
Replace the enclosing node with the current node.
📼

🗡 Kill

Keybinding
ctrl+k
Description
Delete the current node.
📼

✂️ Cut

Keybinding
ctrl+alt+x
Description
Delete and copy the deleted node into the clipboard.
📼

🪞 Copy

Keybinding
ctrl+alt+c
Description
Copy the current node into the clipboard.
📼

By default, executing most edit commands will result in a formatting of the doc using whatever formatter is configured for the doc. To toggle this behavior off, execute the Toggle Autoformat command.

Strict Mode

This is a very experimental feature aiming to prevent unbalanced nodes by restricting conventional character deletion (see examples below). By default this feature is not enabled, but it can be toggled on using the Toggle Paredit Mode command.

🔥⏪ Delete Backward

Keybinding
backspace
Description
Delete one character backwards, unless it will unbalance a form. Otherwise, moves past the character instead of deleting it. If the node is empty, then it is removed. You can always force backward deletion with Force Delete Backward (alt+backspace).
📼

🔥⏩ Delete Forward

Keybinding
delete
Description
Delete one character forward, unless it will unbalance a form. Otherwise, move past the character instead of deleting it. If the node is empty, then remove it. You can always force forward deletion with Force Delete Forward (alt+delete).
📼

These commands are used to navigate around, but they may not be very intuitive at the moment. They were mainly included so that folks can utilize them in scripts (see Joyride) or build on top of them in other extensions.

🚟⏩ Move Cursor Forward

Keybinding
alt+right
Description
Move the cursor forward to the next sibling node.
📼

🚟⏪ Move Cursor Backward

Keybinding
alt+left
Description
Move the cursor backward to the previous sibling node.
📼

🚡⏫ Move Cursor Up

Keybinding
ctrl+up
Description
Move the cursor up to the parent node.
📼

🚡⏬ Move Cursor Down

Keybinding
ctrl+down
Description
Move the cursor down to the first child node.
📼