vim

For discussion on all things (neo)vim.
pseud 2020-06-13T08:07:02.188800Z

I’m having trouble connecting to a shadow-cljs app. It works across other editors, but not with vim and vim fireplace. 1. npx shadow-cljs watch app 2. wait for the http and nREPL servers to come up 3. open the http page via the browser 4. In vim :Connect 3333 (nREPL port) 5. In vim: :CljEval (shadow/repl :app) (where :app matches the id of the build I want to listen in on) In the status-line at the bottom, I see To quit, type :cljs/quit[:selected :app] and all of vim freezes until I hit CTRL-c. Yet the shadow cljs user guide section 14.6 leads me to believe I’ve done everything correctly.. ( https://shadow-cljs.github.io/docs/UsersGuide.html#_fireplace_vim_vim_neovim ) Any input?

pseud 2020-06-13T12:04:02.189400Z

Found vim-iced ( https://liquidz.github.io/vim-iced ) instead. Has comprehensive documentation, including a section on connecting to shadow-cljs. Seems to work well

👍 1
pseud 2020-06-14T11:11:14.193700Z

@olical - curious. I am testing the setup you outlined in your blog article. I did, however, change the Conjure plug line to reflect the latest entry in the Github readme file. However, slurp and barf do not work. Curiously I also had trouble with this in my previous setup using vim-iced. Instead, it seems various combinations of &lt;(,`<)`,`>(` and &gt;) {de,in}dent the line/block

Olical 2020-06-14T11:12:21.193900Z

Slurp and barf of forms is provided by another plugin of your choice. The one I use is vim-sexp + https://github.com/tpope/vim-sexp-mappings-for-regular-people

Olical 2020-06-14T11:12:35.194200Z

There's also paredit for vim

Olical 2020-06-14T11:12:48.194400Z

And parinfer (passive, indent based, not a massive fan personally)

pseud 2020-06-14T11:15:34.194600Z

Yea, I ended up largely copying the init.vim suggested in the blog article you linked, only moving ~2 or so tweaks of my own over. All in all: https://pastebin.com/XDUt8SHU I noticed that vim-sexp and vim-sexp-for-regular-people is used and I tried to use the slurp/barf commands they seem to imply (above). Doesn’t work though. Any clue why ? Tried :map &lt;( and got * &lt;gv, would’ve expected something like sexp_……

pseud 2020-06-14T11:15:54.194800Z

(only reason I ask is that I more or less copied the blog entry in hopes of everything just working.

Olical 2020-06-14T11:17:09.195Z

My slurp is M-L where M is meta or alt and barf is M-K (I'm holding shift too)

Olical 2020-06-14T11:17:16.195200Z

Those are the vim-sexp for regular people mappings I think

Olical 2020-06-14T11:17:32.195400Z

Also saying that &lt;) works for me too

Olical 2020-06-14T11:17:48.195600Z

&lt;( is a reverse slurp I think? Like slurp backwards?

Olical 2020-06-14T11:18:19.195800Z

So I use alt + shift + h/j/k/l

Olical 2020-06-14T11:18:28.196Z

To do all of my slurping and barfing forwards or backwards.

Olical 2020-06-14T11:18:55.196200Z

Then ,o ,O and ,? to do things like raising forms or elements and convoluting nested forms.

pseud 2020-06-14T11:19:43.196400Z

You remapped slurp/barf? If so, can I find your config somewhere ?

Olical 2020-06-14T11:20:02.196600Z

Oh no, that's built in! I'll check where it comes from

Olical 2020-06-14T11:20:13.196800Z

(I barely change the defaults in most things)

pseud 2020-06-14T11:20:39.197Z

Oh. Very odd. I think I just tested all combinations mentioned and got nothing going.

Olical 2020-06-14T11:21:48.197200Z

So it's just the ones built into vim-sexp

Olical 2020-06-14T11:23:16.197600Z

:thinking_face: I'm setting this for sexp (set nvim.g.sexp_filetypes "clojure,scheme,lisp,timl,fennel,janet")

Olical 2020-06-14T11:23:27.197800Z

Ignore the fact that I configure neovim with a lisp 😅

Olical 2020-06-14T11:23:43.198Z

Maybe sexp isn't enabled for clojure by default and I missed that?

Olical 2020-06-14T11:24:11.198200Z

That'll translate to let g:sexp_filetypes = "..."

pseud 2020-06-14T11:25:13.198400Z

Hmm. will check (`:echo g:…..` ) to see what I have there then

pseud 2020-06-14T11:27:43.198700Z

Nope. Value matches yours except for the two last entries (fennel and janet) are not there. Also g:sexp_loaded is 1 (found that var by reading vim-sexp’s source code.). Very odd… :S Oh well, thanks 🙂 Will have to figure this out at some point.

Olical 2020-06-14T11:28:24.198900Z

Possibly silly question, but do you have a Clojure file open and syntax highlighting enabled?

Olical 2020-06-14T11:28:48.199100Z

Because I think you need filetype / syntax support for things like this to work, and I just assume it's on by default in nvim.

pseud 2020-06-14T11:30:47.199300Z

Well. I actually had a brain fart and was testing this in CojureSchool which is a fennel file and thus, with my present settings, not covered by vim-sexp. However, with a clojure file :map &gt;( gives:

n  &gt;)           @&lt;Plug&gt;(sexp_capture_next_element)
v  &gt;           * &gt;gv

Olical 2020-06-14T11:31:06.199500Z

Oh of course!!!

pseud 2020-06-14T11:31:08.199700Z

I suspect my issue is that I see multiple entries and that the * &gt;gv stuff is what’s causing me grief.

Olical 2020-06-14T11:31:21.199900Z

That's frustrating but good spot!

Olical 2020-06-14T11:31:36.200100Z

Yeah, school + sexp without config is a gotcha I should deal with somehow maybe

pseud 2020-06-14T11:33:50.200300Z

Well, it was more a weird impulse on my end to test slurp and barf during the school tutorial. But it would be a good thing to fix up in the blog post, nonetheless. To offer a fully-working, ready-to-go setup 🙂

pseud 2020-06-14T11:34:16.200500Z

But the output I listed just there with two entries for :map &gt;( actually comes from a clojure file.

pseud 2020-06-14T15:32:06.202200Z

@olical - remember to also update the conjure line in the final example of the complete init.vim file 🙂

Olical 2020-06-14T22:13:22.202400Z

Oh! Thanks! Didn't spot that!

Olical 2020-06-13T12:11:44.189600Z

Iced is incredible! I built https://github.com/Olical/conjure which is in a similar space but not as many cool features and it's Neovim specific. (shadow-cljs docs https://github.com/Olical/conjure/wiki/Quick-start:-ClojureScript-(shadow-cljs) ) If you had a look and dismissed it I'd love to know why 🙂 (maybe neovim!) Not trying to discourage vim-iced, please do stick with it, it's so well built and documented. Just interested in if you had a look at Conjure and what the main thing that turned you off was. I hope that's okay!

pseud 2020-06-13T12:21:06.189900Z

Hey 🙂 No problem at all..! Complimenting another project really reflects well on you as a person, btw 🙂 Actually. I’m not much of a vim user at all. I’m merely trying to revert to a more KB-centric mode of editing as frequent mouse use is causing me pain. Used to be an emacs guy, in fact (not evil mode, custom setup). Right now I’ve just been evaluating various setups. Cursive (which I like), VsCode+Calva, Atom + plugins (proto-repl, ink, parinfer etc), and Emacs via the Doom Emacs distribution. What I’ve learnt is that a lot of editors have some form of vim emulation mode and it usually works pretty well on the superficial level. However, as in case of vscode+calva, the REPL or terminal is usually where things break. Hence I’ve tried a bit to get vim going. As for vim, I vaguely remembered fireplace from years back when I used to do clojure professionally and where there were 1 vim guy in my team - so it seemed the obvious thing to start with. Also, frankly, followed along on the first blog post I came across. That said, I kept having troubles with fireplace and shadow-cljs so after ~4 hrs of tinkering, I gave up. Came across vim-iced by a random google search. Would probably have discarded using vim or clojure altogether if I kept having issues, TBH. So. Long answer short: I haven’t been thinking too hard on the vim plugin to use as using vim proper was just one of many options I was exploring - so any plugins/decisions made here wasn’t particularly thought out. I might keep this for a little while, as it actually works. But… why have you written a new plugin ? Why should I use it ? Come on, be honest - there’s something you think you’re doing better since you’re still writing the plugin 😄 (I guess my only tip would be, try to see if you can write a getting started with vim and clojure blog article. Or make a YT video - there’s a lack of content which is what lead me to use fireplace in the beginning)

2020-06-13T12:41:05.190100Z

on a side note, proto-repl is not maintained afaik, but the good news is @mauricio.szabo has written a nice alternative called chlorine.

pseud 2020-06-13T12:55:09.190300Z

I just navigate by whatever somewhat recent blog posts. But it’s actually a good point. I just wish there was a site to demonstrate how to get a good clojure environment up and going for each (reasonably popular) editor. In some cases (e.g. IntelliJ) there’s really just one option - but in many cases, it’s about cobbling a bunch of plugins together until you get something good.

Olical 2020-06-13T12:57:43.190500Z

Ah I see! Well I can highly recommend vim + clojure in general, I've spent years in Spacemacs, Fireplace and now Conjure. I think I've tried some things like Cursive too but it never stuck. I think a few years back fireplace was the only option (not a bad one, just the main one that people used) in vim land, it's over the last few years that myself and a few others all realised at the same time that some diversity in this space can only be a positive thing. We're all building on top of nREPL + CIDER so we get to share so much, it's more about a particular UX/feel and feature set, that's where the plugins tend to differ. The fireplace + shadow issues are weird though, AFAIK it should work fine :thinking_face: unless there's something new I'm unaware of. I think iced is the next most popular vim approach after fireplace? And for good reason! And as for why I've done my own (I was mainly interested in if you'd seen it and dismissed it as a sort of ad-hoc survey 😅) I flitted between editors and setups for a few years and none of them quite fit the UX I wanted. I used Spacemacs for a year but I was always a vimmer at heart and I couldn't deal with some of the inconsistencies in evil mappings, plugin management and config style. I just found it a bit too stateful and heavy, I like being able to restart within a second if I break some state etc. I built Conjure with a specific UX in mind: * It should work right out of the box, good defaults. * It should try to remain simple and extensible, so clever interactive debugger tools etc can be an optional extra people add to avoid core project bloat and rot. * It should have LOTs of ways to eval stuff, so like eval current form, root form, selection, form at mark (which vim-iced added since it was so nice in Conjure 😄 so glad to see that idea spread). * All results should be captured in one real and normal vim buffer you can interact with, edit and even send further evals from. Like a CLI REPL but in a buffer. Then in the latest rewrite I expanded Conjure's vision some more. I realised I do a lot of UX and plumbing work to support Clojure, but 80% of that could be shared by other languages (lisps for now, but it'll be non lisps one day). So Conjure supports any language using pluggable clients, right now that's Fennel, Janet and Clojure but I have someone who wants to add Common Lisp support and I have a list of things I want to support including Racket. I want it to be a one stop shop for evaluating things and working with their results in Neovim. So yeah, all the plugins out there just put their own spin on the ideas and solutions. I love that there's so much choice for vimmers now, you can really pick whatever floats your boat.

2020-06-13T12:58:11.190700Z

fwiw, i had heard that some folks use clojure kit or some such for intellij - not to try to dissuade you or anything - cursive's debugger is my favorite :)

Olical 2020-06-13T12:58:19.190900Z

Also about the getting started guide: I do have some for older versions of Conjure which was a little more involved. Now it's easier I could simplify it and write another to be honest.

Olical 2020-06-13T12:58:45.191100Z

Definitely a need for more on ramp docs for non vimmers or people who are new to it all.

Olical 2020-06-13T12:59:23.191300Z

https://oli.me.uk/getting-started-with-clojure-neovim-and-conjure-in-minutes/ this one is a bit out of date with the Conjure install step, but the rest is valid!

pseud 2020-06-13T13:01:17.191600Z

Yea. I’d definitely encourage you to focus on the documentation aspect always. Even to the extent that you consider the surrounding plugins also needed to get a nice experience. When you’re being lazy (me!), you really just go the path of least resistance.

👍 1
pseud 2020-06-13T13:02:06.191900Z

The repl I see in conjure, is it also somewhat available in plugins like vim-iced or fireplace ? I have yet to have popped open a “classic” repl.

2020-06-13T13:02:23.192100Z

conjure is definitely worth trying - i am using it a bit for another programming language it supports :)

pseud 2020-06-13T13:02:31.192300Z

Also - fwiw with skimming - I think your approach to connecting to a shadow-cljs instance is a little easier. That’s cool 😄

Olical 2020-06-13T13:04:12.192500Z

Hmm, honestly not sure about the REPL experience, they may well have something yes. I vaguely recall not liking that fireplace sort of only showed you the last result, maybe they get added to :messages? I think I always ended up being frustrated when I couldn't just get the result into my register or something. I think that frustration was my main driving force for this UX, but it was years ago now 😅

Olical 2020-06-13T13:04:39.192700Z

Fireplace has a very vimmy design, it works well, I just wanted something a little more magical which definitely doesn't suit everyone's tastes.

Olical 2020-06-13T13:05:02.192900Z

Iced is much more in line with how I wanted things at the time, I think. I don't think it existed when I started though.

pseud 2020-06-13T13:05:13.193100Z

Might very well try it. I prefer a separate repl window I can see 😄

Olical 2020-06-13T13:09:02.193300Z

I'm super envious of the iced doc site too, that's so nice. I just keep all mine in vim help files with more install-y information in the repo and wiki.