简体   繁体   中英

Emacs Clojure - move parens

Is there an Emacs package for moving Lisp (Clojure specifically) S-expressions around ?

Note : I keep seeing how to move the cursor between S-Expressions, but this is not what I am looking for. I want to move the expressions instead :

I am looking for something like that :

(a-fn 1 2 3)
'(another-thing 2 3 4)
↑cursor here

Then if I do something like "move sexp-up" of "swap-sexp", the result should be :

↓cursor here
'(another-thing 2 3 4)
(a-fn 1 2 3)

The built-in transpose-sexps function should do what you want.

For much more structured s-expression editing that works well with Clojure, you should give ParEdit a try.

http://www.emacswiki.org/emacs/ParEdit

lispy works with Clojure. Press w to move the sexp up, and s to move the sexp down.

As mentioned, lispy and paredit are the packages you want to have a look at. Lispy has the advantage of short key bindings, but this comes at the cost of having to ensure the pointer is before/after a sexp and the active region is on.

Paredit has longer key bindings, but does not have the restrictions on where the pointer is and the region doesn't need to be active. I tend to use paredit - while it takes a bit of time to get use to it, once you have, it makes things very fast.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM