Structural editing and navigation for Clojure and other LISPs
This is a Paredit extension for Visual Studio Code. It is a thin wrapper around paredit.js. You find it inside Code's extension view and on the Marketplace.
Calva Paredit can be used standalone, but also comes bundled with Calva, a Clojure and ClojureScript extension for bringing the REPL power into VS Code, together with Calva Formatter, a Clojure code formatter.
Note: You can choose to disable all default key bindings by configuring calva.paredit.defaultKeyMap
to none
. (Then you probably also want to register your own shortcuts for the commands you often use.)
Default keybinding | Action |
---|---|
ctrl+right | Forward Sexp |
ctrl+left | Backward Sexp |
ctrl+down | Forward Down Sexp |
ctrl+up | Backward Up Sexp |
ctrl+alt+right | Close List |
Default keybinding | Action |
---|---|
ctrl+w | Expand Selection |
ctrl+shift+w | Shrink Selection |
ctrl+alt+w space | Select Current Top Level Form |
Default keybinding | Action |
---|---|
ctrl+alt+. | Slurp Forward |
ctrl+alt+< | Slurp Backward |
ctrl+alt+, | Barf Forward |
ctrl+alt+> | Barf Backward |
ctrl+alt+s | Splice |
ctrl+alt+shift+s | Split Sexp |
ctrl+delete | Kill Sexp Forward |
ctrl+shift+backspace (on Mac) | Kill Sexp Forward |
ctrl+backspace | Kill Sexp Backward |
ctrl+alt+down | Splice & Kill Forward |
ctrl+alt+up | Splice & Kill Backward |
ctrl+alt+( | Wrap Around () |
ctrl+alt+[ | Wrap Around [] |
ctrl+alt+{ | Wrap Around {} |
ctrl+alt+i | Indent |
--- | Transpose |
Strict mode keybinding | Action |
---|---|
backspace | Delete Backward, unless it will unbalance a form |
delete | Delete Forward, unless it will unbalance a form |
shift+backspace (on Mac) | Delete Forward, unless it will unbalance a form |
ctrl+alt+backspace | Force Delete Backward |
ctrl+alt+delete | Force Delete Forward |
alt+shift+backspace (on Mac) | Force Delete Forward |
NB: Strict mode is disabled by default. If you ensable it, the backspace and delete keys won't let you remove parentheses or brackets so they become unbalanced. To force a delete anyway, use the supplied commands for that. Strict mode can be switched on by by configuring calva.paredit.defaultKeyMap
to strict
.
Default keybinding | Action |
---|---|
ctrl+alt+c ctrl+right | Copy Forward Sexp |
ctrl+alt+c ctrl+left | Copy Backward Sexp |
ctrl+alt+c ctrl+down | Copy Forward Down Sexp |
ctrl+alt+c ctrl+up | Copy Backward Up Sexp |
ctrl+alt+c ctrl+alt+right | Copy Close List |
Default keybinding | Action |
---|---|
ctrl+alt+x ctrl+right | Cut Forward Sexp |
ctrl+alt+x ctrl+left | Cut Backward Sexp |
ctrl+alt+x ctrl+down | Cut Forward Down Sexp |
ctrl+alt+x ctrl+up | Cut Backward Up Sexp |
ctrl+alt+x ctrl+alt+right | Cut Close List |
- Peter Strömberg
- You?
I also published and maintain Calva, another Visual Studio Code extension. Calva is aimed at making it super easy to get Clojure and Clojurescript coding done. It sports interactive REPLs, inline evaluation and other stuff people from the Emacs Cider world are used to.
PRs welcome, file an issue or chat @pez up in the #calva-dev
channel of the Clojurians Slack. Tweeting @pappapez works too.
❤️