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?
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
@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 <(
,`<)`,`>(` and >)
{de,in}dent the line/block
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
There's also paredit for vim
And parinfer (passive, indent based, not a massive fan personally)
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 <(
and got * <gv
, would’ve expected something like sexp_……
(only reason I ask is that I more or less copied the blog entry in hopes of everything just working.
My slurp is M-L
where M is meta or alt and barf is M-K
(I'm holding shift too)
Those are the vim-sexp for regular people mappings I think
Also saying that <)
works for me too
<(
is a reverse slurp I think? Like slurp backwards?
So I use alt + shift + h/j/k/l
To do all of my slurping and barfing forwards or backwards.
Then ,o
,O
and ,?
to do things like raising forms or elements and convoluting nested forms.
You remapped slurp/barf? If so, can I find your config somewhere ?
Oh no, that's built in! I'll check where it comes from
(I barely change the defaults in most things)
Oh. Very odd. I think I just tested all combinations mentioned and got nothing going.
So it's just the ones built into vim-sexp
:thinking_face: I'm setting this for sexp (set nvim.g.sexp_filetypes "clojure,scheme,lisp,timl,fennel,janet")
Ignore the fact that I configure neovim with a lisp 😅
Maybe sexp isn't enabled for clojure by default and I missed that?
That'll translate to let g:sexp_filetypes = "..."
Hmm. will check (`:echo g:…..` ) to see what I have there then
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.
Possibly silly question, but do you have a Clojure file open and syntax highlighting enabled?
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.
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 >(
gives:
n >) @<Plug>(sexp_capture_next_element)
v > * >gv
Oh of course!!!
I suspect my issue is that I see multiple entries and that the * >gv
stuff is what’s causing me grief.
That's frustrating but good spot!
Yeah, school + sexp without config is a gotcha I should deal with somehow maybe
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 🙂
But the output I listed just there with two entries for :map >(
actually comes from a clojure file.
Updated 🙂 https://oli.me.uk/getting-started-with-clojure-neovim-and-conjure-in-minutes/
@olical - remember to also update the conjure line in the final example of the complete init.vim file 🙂
Oh! Thanks! Didn't spot that!
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!
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)
on a side note, proto-repl is not maintained afaik, but the good news is @mauricio.szabo has written a nice alternative called chlorine.
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.
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.
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 :)
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.
Definitely a need for more on ramp docs for non vimmers or people who are new to it all.
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!
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.
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.
conjure is definitely worth trying - i am using it a bit for another programming language it supports :)
Also - fwiw with skimming - I think your approach to connecting to a shadow-cljs instance is a little easier. That’s cool 😄
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 😅
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.
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.
Might very well try it. I prefer a separate repl window I can see 😄
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.