Fork me on GitHub
#spacemacs
<
2018-04-04
>
prnc11:04:54

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?

jeff.terrell12:04:19

@prnc - Welcome to Spacemacs. simple_smile 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.

jeff.terrell12:04:22

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.

shan12:04:10

@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

prnc12:04:16

@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

prnc12:04:22

@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...

shan12:04:08

some vim-surround stuff is built into the spacemacs evil mode

shan12:04:22

like cs["

prnc12:04:54

...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

shan10:04:24

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`)

shan10:04:39

(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 😞

prnc09:04:28

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.

prnc12:04:25

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))

prnc12:04:24

small things like that, I was just thinking that maybe there is something better than the SPC k lisp state

shan13:04:48

hopefully some veteran spacemac users can answer some of those.

prnc13:04:37

thanks @shan! I am sure that there some old vim hands around that successfully transitioned to spacemacs 😉

shan13:04:56

I remember SPC k s used to put a space but then in a newer version it stopped. Never did investigate though 😞

andre.stylianos13:04:35

I thought I was imagining things when it stopped doing it