parinfer

eraserhd 2018-03-05T15:31:26.000311Z

The reasons are probably not good ones, though. Just my eternal dissatisfaction with my Vim setup for Clojure.

👍 2
eraserhd 2018-03-05T15:32:17.000766Z

I'm maybe 1/5th of the way through the first pass, which is really just a transliteration into Rust, where types permit.

justinlee 2018-03-05T18:25:09.000031Z

wait maybe i’m dense, but how did your dissatisfaction with your vim setup result in your porting parinfer to rust

eraserhd 2018-03-05T18:54:43.000737Z

I have been using the nvim parinfer, and it has been working really well for me, except that I've continually have had to do a six-step manual process to get my plugins to register.

eraserhd 2018-03-05T18:55:29.000107Z

This has worked... it is a work around for the fact that the node host just dies if you have more than one node plugin. It's been an open issue forever.

eraserhd 2018-03-05T18:56:21.000234Z

But last time, I couldn't get it to work at all, even with manual registration. I'm kind of frustrated with that whole hosting thing.

eraserhd 2018-03-05T18:57:10.000217Z

So I kind of just burned it down and went back to plain Vim. They now have a terminal, and Bram is super responsive on fixes and new features now (I don't know if there was a time when he wasn't.)

eraserhd 2018-03-05T18:57:56.000405Z

So then I found oakmac's port of parinfer to VimL and started using that. It's kind of nice, except that I have to wait six or seven seconds on particularly bad files after hitting Esc to get the cursor back.

eraserhd 2018-03-05T18:58:11.000489Z

So... I optimized that down to 3 or four seconds and submitted a pull request.

eraserhd 2018-03-05T18:59:38.000042Z

They were talking about using the Python parinfer port if it's installed, falling back to VimL. But... I have been thinking about Vim 8's job control functions, being able to send JSON messages to an external program and get back JSON messages.

eraserhd 2018-03-05T19:02:33.000470Z

But the kicker was that I once had a nice ruby plugin for C++ that kept my #include and #define's up-to-date, and namespace directives, and managed a library of stored code that it would paste in at the right spot if I called it. I used it when I used to compete at TopCoder to get the first submit on problems that were easy enough that you didn't have to find some kind of "trick".

eraserhd 2018-03-05T19:03:22.000780Z

And I realized that I could add a lot of the IDE-like functionality I've wanted if I had a fast, testable, external process that opines on every edit.

eraserhd 2018-03-05T19:05:09.000719Z

Automatically adding/removing requires, complete with :as, by finding what is required as what elsewhere in the project.

eraserhd 2018-03-05T19:05:21.000572Z

Adding :refer-clojure when you define a name in clojure.core.

eraserhd 2018-03-05T19:06:17.000252Z

etc. whew... that was long winded 😄

eraserhd 2018-03-05T19:11:26.000517Z

(I've since learned about Vim's libcall(), which would allow me to send and receive JSON messages in memory, with no wire overhead.)

snoe 2018-03-05T19:22:39.000404Z

parinfer.js is nice because many things can run js…but rust is maybe nicer with webasm and c targets which might cover everything (maybe even intellij / nightcode with jndi).

eraserhd 2018-03-05T19:25:17.000077Z

Well, I make no claims that Rust is a good idea. I'm using it for a bag of unrelated other reasons. Mostly, I didn't want to use C again, and I've been telling myself that next time I'm tempted to use C, I'd learn Rust.

eraserhd 2018-03-05T19:25:58.000229Z

I've been repeatedly pleasantly surprised at its ergonomics and design choices, though.

eraserhd 2018-03-05T19:27:49.000708Z

I do wonder if there are any editors aside from Vim left that are written in C. I mean, emacs, probably, but it has elisp.

dominicm 2018-03-05T20:03:01.000373Z

@eraserhd this sounds great, want to follow this!

eraserhd 2018-03-05T22:13:49.000532Z

Today's progress: 27 of 73 functions converted.

shaunlebron 2018-03-05T22:23:38.000061Z

@eraserhd 🎉

shaunlebron 2018-03-05T22:24:37.000044Z

i don’t know much about rust and why it is conducive to compiling to wasm, so I wonder if this could help compile to other targets

shaunlebron 2018-03-05T22:25:01.000266Z

do you have a repo we can follow?