Discussion about all editors used for Clojure/ClojureScript
jeremy 2018-07-13T02:29:05.000053Z

I’m using Spacemacs/Cider in Evil mode and I’m wondering what commands I might use to quickly jump to the end parens from the closure i am currently in. For example when I need to add more code after a () but the end parens is buried in the closing ))))))))) of the defn.

pesterhazy 2018-07-13T14:14:36.000009Z

@jeremy642 I'd also like to know if there is a built-in way to do this. What I do is to define a key U for "up":

(evil-global-set-key 'normal "U" 'backward-up-list)
  (evil-global-set-key 'visual "U" 'backward-up-list)
which focusses the opening parenthesis; then I use % to switch to the matching closing parenthesis.

pesterhazy 2018-07-13T14:15:41.000124Z

(There's a "lisp mini state" (`SPC k`), but I don't like it at all for navigation.)

andre.stylianos 2018-07-13T14:40:24.000222Z

Just to see if I understand correctly, you want a command that changes: (defn something [] (println |"ok")) to (defn something [] (println "ok"|)) ?

andre.stylianos 2018-07-13T14:41:23.000480Z

Because in spacemacs I use ] for that, I think it's that way by default

andre.stylianos 2018-07-13T14:45:15.000097Z

Wait, wrong shortcut. ] moves your cursor to the next closing ), ], } or etc regardless of the form you're on. (let | [a 1]) will become (let [a 1|]) but ) does what you probably asked for: (let | [a 1]) will become (let [a 1]|)

jeremy 2018-07-13T15:11:23.000468Z

@pesterhazy Found out that % will move you back and forth between the current parens in the sexp. So if I can bind my own way to move around the lists without going into lisp state that would be great. I also found out yesterday the lisp state commands for inserting a new sexp above and below the current sexp which is awesome but I might have to rebind too.

jeremy 2018-07-13T15:12:35.000361Z

@andre.stylianos Were you replying to me? Mostly I was trying to figure out how to navigate around the lisp, jumping from an opening or inside an sexp to the end of the sexp so that I could insert another sexp below it.

andre.stylianos 2018-07-13T15:13:25.000073Z

Yup, @jeremy642

andre.stylianos 2018-07-13T15:16:02.000297Z

Ah, sorry @jeremy642, seems like it's not default behavior but part of evil-cleverparens

andre.stylianos 2018-07-13T15:16:09.000519Z


jeremy 2018-07-13T15:20:17.000286Z

I will check that out, thanks.