This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-04
Channels
- # aws (1)
- # beginners (163)
- # boot (1)
- # bristol-clojurians (1)
- # cider (7)
- # clara (1)
- # cljs-dev (22)
- # cljsjs (1)
- # clojure (43)
- # clojure-denver (1)
- # clojure-finland (6)
- # clojure-italy (1)
- # clojure-nl (3)
- # clojure-russia (1)
- # clojure-spec (1)
- # clojure-uk (6)
- # clojurescript (107)
- # cursive (4)
- # data-science (2)
- # datascript (2)
- # datomic (19)
- # duct (31)
- # emacs (1)
- # fulcro (50)
- # graphql (15)
- # hoplon (3)
- # lein-figwheel (2)
- # luminus (21)
- # off-topic (74)
- # onyx (3)
- # parinfer (15)
- # portkey (2)
- # precept (9)
- # proton (1)
- # re-frame (130)
- # reagent (73)
- # reitit (7)
- # ring-swagger (5)
- # shadow-cljs (61)
- # spacemacs (18)
- # specter (12)
- # uncomplicate (1)
- # vim (88)
- # yada (2)
Hi everyone! Trying to switch from vim to spacemacs. I found editing clojure in vim + surround + vim-sexp (w/ tpope's mappings) really easy the SPC k
lisp state (?) on the other hand not so much. If there are any relatively recent Vim converts here: what do you use for your (simple) "structural editing" needs?
@prnc - Welcome to Spacemacs. I think all the vim-surround stuff should work out of the box in Spacemacs. As for paredit-style stuff, I just use SPC k
, but seems like we get questions here fairly often about switching to some other structural editing library, so you're not alone.
I don't know what people tend to prefer, nor what the story is for getting it working in Spacemacs, but if I were doing it I think I'd look into things like dotspacemacs-additional-packages
and (with-eval-after-load 'clojure-mode ...)
in my config.
@prnc have you got any examples of some editing that you’d do in VIM
? someone here might know how best to do it in spacemacs
@jeff.terrell cheers! happy to be using spacemacs, so far there's loads of things that I like (I've always had a severe case of org-mode envy) trying to figure out a comfortable (from vim users perspective) editing workflow for Clojure
@shan I mostly wanted to understand what the options are in general, I guess a lot of what I want is already there but need to start customising this to my liking. Having said that...
...here is a simple example: starting with (range | 100)
(where |
is the cursor)
* I want to evaluate that surrounding sexp (I would do cpp
) in vim
* I want to transform it into (filter even? (range | 100))
I would press ,I
(custom sexp mapping) and get the whole thing wrapped, dropped in insert mode with space inserted so I would just have to type filter even?
to get what I want
Had a little look on how to do some of the above but only found long winded ways so far.
for the (range | 100)
evaluation, assuming you’re in normal mode, you either have to select the sexp via va(
and then do SPC m e r
(`cider-eval-region`) to evaluate the region
. Another way is to go past the )
and do SPC m e e
(`cider-eval-last-sexp`)
(filter even? (range | 100))
also doesn’t seem to be as nice.
You can do SPC k (
which will insert an sexp
before your form = (|)(range 10)
You’d then need to type filter even?
=> (filter even?|)(range 10)
And then you’d need to slurp the sexp
in = SPC k s
😞
Yeah it's not ideal. I was using the visual selection and eval region trick but feels like a bit of a hack 😉 Anyway thanks @shan.
or say I have (filter even?)(range 100)
and I slurp with SPC k s
I get (filter even?(range 100))
without the space (I would've expected: (filter even? (range 100))
small things like that, I was just thinking that maybe there is something better than the SPC k
lisp state
thanks @shan! I am sure that there some old vim hands around that successfully transitioned to spacemacs 😉
I remember SPC k s
used to put a space but then in a newer version it stopped. Never did investigate though 😞
I thought I was imagining things when it stopped doing it