Fork me on GitHub
#vim
<
2018-04-23
>
blmstrm13:04:04

Hello! Whenever I try to indent clojure code in vim with =G vim takes a really long time to indent my source code. Has anyone else experienced that? I’m running fireplace, rainbow_parentheses, vim-clojure-static.

dominicm13:04:18

How big is the file?

blmstrm13:04:42

The actual file I tried it on now is around 500 lines.

dave13:04:49

i've also experienced this

dave13:04:59

my setup is very similar to yours

dominicm13:04:22

@blmstrm You might have better performance using gqG which uses clojure to do the formatting

blmstrm13:04:45

@dominicm gqGdoesn’t seem to do anything. Am I supposed to prepend , to it?

dominicm13:04:08

@blmstrm You might need to go to the top of the file (e.g. gggqG)

blmstrm14:04:49

@dominicm no luck. Nothing seems to happen. It’s not even reacting. Can their be some other thing messing this up? I’m using vim 8.0 on osx.

dominicm14:04:31

the newer fireplace has a custom formatter, which uses cljfmt, so I'm surprised :thinking_face: maybe

blmstrm14:04:56

I noticed now that I also have vim-classpath, vim-fugitive and vim-sensible installed.

blmstrm14:04:17

and paredit.vim

blmstrm14:04:20

@dave do we share any of the additional plugins?

dave14:04:52

i'm using neovim, so that's a difference. i have classpath and fugitive, but not sensible

dave14:04:08

i don't have paredit either

dave14:04:12

i use vim-sexp instead

dave14:04:46

interestingly, i have gq remapped to gw ever since i read up on the custom formatter that uses cljfmt, simply because i occasionally want to be able to edit clojure code without being connected to a repl

dave14:04:18

but if the custom formatter is significantly faster than e.g. =G, then i might rethink that

dave14:04:23

@blmstrm silly question: are you connected to a repl via fireplace? if you aren't, i'll bet gq is a no-op

dave14:04:13

...wow. this is way faster! i'm totally going to use the gq mapping now. it is a no-op if you're not connected to a repl, which is maybe not ideal -- i feel like it should show you an error message about not being connected to a repl

blmstrm14:04:59

@dave I think I'm connected to the repl. I always thought running lein repl in the project root in a separate terminal would do it?

blmstrm14:04:20

I'm away from my computer but will check later tonight.

dave14:04:35

my go-to way of checking is to type cqp to open the prompt, then evaluate (+) in the repl. if you get 0, you're connected

dave14:04:21

running lein repl or boot repl in the project root in a separate terminal should absolutely do the trick. doing either of those creates an .nrepl-port file, which fireplace picks up on so it knows what port to connect to

blmstrm14:04:22

@dave yeah, that's what I thought too, but now I'm kinda hoping that I wasn't connected.

dave14:04:41

that would be my hunch

dave14:04:45

given that gq did nothing

dave14:04:58

that's the behavior i saw when i ^C'd my repl

dominicm16:04:49

Do you have cider-nrepl installed @blmstrm that would stop it from working too

blmstrm20:04:11

I’ve made sure I’m connected and I don’t use cider-nrepl. Is there some other command that “should” just work? I know I can use gf, just fine.

dominicm20:04:31

@blmstrm add cider nrepl, I worded my comment hastily.

blmstrm20:04:32

@dominicm @dave That was it! Very nice! Now its really fast! Thank you both for your help!

👍 4