Fork me on GitHub
#vim
<
2018-04-04
>
Hukka05:04:05

@dave Still pretty difficult to set them up at all the different files, plus checking them out requires using or switching many namespaces

dominicm06:04:21

Vim sayid is probably better it's a tracing library

Hukka06:04:25

sayid looks quite nice, though with a bit of a learning curve. Like all powerful tools. But... I'd have to give up and take fireplace in 😕

dominicm06:04:28

You can use tools.trace, but it's not as good necessarily.

Hukka07:04:14

I'll go with that and the deflet macro for starters

Hukka07:04:14

If I ever get to the point that I feel it's worth the trouble to switch to fireplace, I hope I'll also have the time and energy to write a short article "This is how far you can go with simple solutions, and here's what you are missing"

dave13:04:01

i'm still not 100% convinced that fireplace is worth abandoning. is there a fundamental problem with the approach that makes it desirable to work on a new solution? i keep wondering if it might be better for us to focus our efforts on improving fireplace

Hukka14:04:26

I haven't abandoned it, I just have never used it. Being a ton of vimscript, I don't think I would ever delve into it to make improvements.

Hukka14:04:42

I like the unix like philosophy of Jeb's approach where I can combine it with different tools (I use screen to connect all the repls into same, and run it on a different screen... errr... monitor, I mean

Hukka14:04:30

Admittedly I haven't checked how that could be done in fireplace, but I'm assuming it's much more strongly coupled and can't be done with just some shell scripting

dave16:04:56

that's a good point. i also appreciate the simplicity of hooking into external tools instead of trying to do everything in vimscript

dave16:04:08

probably easier to get existing functionality that way

dave16:04:12

without rewriting it in vimscript

dave16:04:18

and i'll bet the performance is way better

dave16:04:26

so, yeah, ok, i'm convinced now 🙂

dave16:04:51

just FWIW though, i've had a good experience so far with fireplace

dave16:04:09

my one complaint, in practice, is that it's lagging behind cider in terms of features despite relying on the cider middleware

dominicm06:04:35

Check out vim-replant, it's my attempt at bridging that gap. I'm very annoyed that my simple pprint PR has been left for 8 months or so. So I've decided to strike out.

dave13:04:28

nice. i actually have vim-replant installed -- i did it a while back just for kicks, but i haven't dug into learning how to use it in earnest

dave13:04:59

the idea of rebuilding some of this stuff in a saner way is compelling, i think

dominicm22:04:35

Eventually I hope to replace fireplace. I'm only using it as a connection/session manager.

dominicm22:04:02

The magic refresh is probably the most useful feature. I use it all the time.

dominicm22:04:30

It works on all our projects, which are all setup slightly differently.

jebberjeb18:04:42

welcome, @eraserhd 🙂

eraserhd18:04:13

I've been doing a bunch of Vim plugin work, and forgot this channel was here.

jebberjeb18:04:40

It’s cool that you joined, lots of interesting stuff happening here!

eraserhd18:04:32

So, Vim+Clojure peeps, I've been hacking my setup a great deal lately, so let me dump the neat stuff I've made or am using!

schmee18:04:06

bring it on! 😄 🎉

eraserhd18:04:01

First of is parinfer-rust, a port of parinfer to rust that allows Vim to call it natively with libcall(), so is fast. It works with plain Vim, and does not need Neovim: https://github.com/eraserhd/parinfer-rust

eraserhd18:04:12

(I did this one)

eraserhd18:04:31

It is the only Vim plugin that supports parinfer's smart mode, as far as I can tell, which is really awesome.

eraserhd18:04:52

Next, vim-sexp, vim-sexp-mappings-for-regular-people, vim-fireplace. I think these are the usual suspects.

eraserhd18:04:31

vim-sexp has the insert mappings turned off to not interfere with parinfer-rust.

eraserhd18:04:49

And then I have a bunch of custom stuff that I haven't wrapped into a plugin:

eraserhd18:04:13

,r finds the repl terminal on this tab and focuses it. It opens one if there is none.

eraserhd18:04:22

,, finds the repl terminal and sends it <Up><Enter> and returns to the previously focused window. This is the dumbest thing, but also the biggest time saver. I use it to run tests or an expression like (tools.namespace/refresh) (clojure.test/run-tests 'my.namespace).

eraserhd18:04:26

And the hack that I'm trying to do right now is: using Vim's terminal emulator support for a weird escape sequence that sends a JSON blob to Vim so that my REPL command which loads code will move the cursor to and highlight a compile error.

eraserhd18:04:23

Although, I guess I could do this with vim server, which would work in Neovim as well.

eraserhd18:04:02

Hmm, I think that might be a better idea.

jebberjeb18:04:04

Oh, neat, @eraserhd. I missed that you’d done parinfer-rust.

eraserhd18:04:23

Yeah. Neovim just ate my plugins one day, so I went back to Vim, but I wanted parinfer, and there's a plain Vim port, but it was a lot slower and I'd already been spoiled.

schmee18:04:59

I’m gonna try out parinfer-rust right now!

aw_yeah 4
eraserhd18:04:01

On my wishlist: integration to post "signs" on all the tests that fail when I run them in the REPL.

dominicm06:04:28

Oh, also stealing this

eraserhd16:04:00

Go for it. Let me know if you get something working, though.

dominicm22:04:17

Tests will be later, this is the "killer feature" I've been waiting for in order to write a better test runner than the one in fireplace

dominicm22:04:38

Going to set this up for stack traces first

schmee19:04:18

I loved vim-parinfer but it’s kinda janky and incomplete, but parinfer-rust is the real deal, holy mackerel

schmee19:04:37

thank you so much, this is going to make Clojure programming even more enjoyable! 😄

monjohn19:04:39

@eraserhd As one who only knows the basics of vim, do you have an example of how you would use it with libcall()?

eraserhd19:04:02

That's an implementation detail that you don't need to use it. Other parinfer's are either in slow native VimL, or send the whole buffer over a socket connection and get a big blob back for every change. This one runs in the Vim process.

eraserhd19:04:46

The installation instructions at the link above should be all you need.

monjohn19:04:56

@eraserhd Got it. Thanks!

defndaines19:04:13

For those with no Rust experience (or installation), what do you recommend for getting cargo available? (I’m macOS, if that matters)

eraserhd19:04:35

If you have homebrew, I think brew install rust does it.

eraserhd19:04:59

Let me know if that works, I'll add a note in the docs.

schmee19:04:33

first time installing on osx, worked super smooth

schmee19:04:45

and building parinfer-rust worked first try

eraserhd19:04:02

Oh, I forgot the other neat program/plugin I've been using that I wrote: git-zeal, git-zeal-vim: https://github.com/eraserhd/git-zeal and https://github.com/eraserhd/git-zeal-vim .

eraserhd19:04:56

This tool zealously stalks your local git repo, running full tests or build on the tip of every branch, bisecting to find an error if a branch is broken.

eraserhd19:04:24

It's nice for when your tests are slower than your commit rate.

eraserhd19:04:35

The plugin is a small window that continually shows the status of your commits.

defndaines19:04:41

Thanks, I went with the homebrew option and gave it a spin. (once I did cd cparinfer) Works as expected so far. I have it installed under .vim/pack/git-plugins/start/, as well, so can confirm that it works via that installation method, as well.

eraserhd19:04:07

What installation method is that?

defndaines19:04:58

Pretty much like Pathogen, but native under Vim 8, I believe.

defndaines19:04:17

I switched over a while back and removed Pathogen, and haven’t noticed any difference yet.

eraserhd19:04:06

I didn't realize this was a thing.

defndaines19:04:38

So, as I read that article, I realize that the git-plugins part of my path is freeform and could be anything.

schmee20:04:21

@eraserhd I’m playing around with parinfer-rust, I have a question/feedback

schmee20:04:07

if I have code like this

(defn up-right [^longs a & is]
  (doseq [i is]
    (aor a i ubyte)))
and delete the line starting with doseq with dd, it ends up like:
(defn up-right [^longs a & is]
    (aor a i ubyte))

schmee20:04:44

is it possible to make it automatically indent the remaining line of code?

eraserhd20:04:37

Not as part of parinfer-rust. A neat thing of parinfer-rust's implementation of smart mode, though, is that you can dedent the resulting form with << no matter how many lines it is.

eraserhd20:04:14

vim-sexp will reindent if you do ds) in the doseq form.

schmee20:04:27

yeah I noticed the << thing! super nice

schmee20:04:39

so running parinfer and sexp together is a good idea?

schmee20:04:48

I’ve stuck to parinfer + surround so far

eraserhd20:04:22

I do it, mostly because I really like vim-sexp's <e and >f, and <I. You have to set a global variable to tell vim-sexp not to make its insert-mode mappings and they won't step on each other.

schmee20:04:02

cool, I’ll be sure to try it out :thumbsup:

eraserhd21:04:42

OK, so I have REPL-in-Vim8-indicating-compile-error-when-reloading-code working. This is a really rough sketch, but it works: https://gist.github.com/eraserhd/04efc2767f6c04aa232f6465c8f3d79d