Skip to content

Structural Editingλ︎

Structural editing is an invaluable tool when working with Lisp languages (elisp, lisp, clojure, etc) as it enables you to easily move code around without breaking the structural syntax of the language.

Clojure has very precise syntax as everything is contained in a list or similar structure. It is very simple to navigate the structure of Clojure code by jumping from expression to expression.

This well defined structure also makes it trivial to move expressions around, giving you a simple way to develop and refactor your code.

Structural Editing Section

Structural editing section provides a detailed guide to using Lisp mode, Smartparens, Paredit and Evil mode to manage your Clojure (and elsip) code.

Smartparens For Writing Structural Textλ︎

Spacemacs uses smartparens{target=blank} to help you write structural code really fast and also move expressions around. Smartparens is a newer implementation of the classic _paredit package.

Evil-cleverparens

Evil-cleverparens configures Vim states to respect smartparens rules. This ensures that you do not accidentally delete parenthesis and keeps the structure of your Clojure intact.

See the section on Evil Clojure Editing.

Lisp State For Manipulating Structural Textλ︎

Space+k+. opens lisp-state for refactoring Lisp base languages like Clojure and eLisp.

lisp-state allows use of the Vim normal state keys to navigate your code by its structure, j,k,h,l.

Move symbols and expressions around without breaking parenthesis and other structural characters (using slurp, barf, wrap, unwrap, etc.).