Skip to content

Evil Safe Structural Editingλ︎

The Clojure layer also includes evil-cleverparens which ensures Clojure code structure is respected.

Safe structural editing in Evil normal state respects structural editing too, meaning the standard evil commands can be used for cutting and deleting text without breaking Clojure or Lisp code structures.

Safe structural editing is provided by the package evil-cleverparens which is included in the Clojure layer. By default this mode is not activated.

Spacemacs Evil Description
SPC m T s , T s Enable evil safe structural editing for the current buffer

When enabled the symbol 🆂 is displayed in the mode-line.

Spacemacs - Clojure - Safe Structural Editing mode enabled

Enable for all Clojure buffers by adding the following function in dotspacemacs/user-config


Or to enable evil safe structural editing for all supported major modes, use this function instead:


Manually managing structureλ︎

Although it is not structural editing, in Evil you can delete to a particular character. Clojure code inside of () can be deleted without deleting the closing )

  1. Enter normal mode
  2. Move to the starting point of the text you wish to delete
  3. d t ) - delete everything up to, but not including the closing parenthesis

Last update: December 25, 2022