Fork me on GitHub

Can I use conjure with multiple projects at once? Like connect to one thing in one terminal and another in another? I was trying to connect and it kept talking about the other 🙂


Do you mean in one neovim instance or two?


Because if it's two, of course, open neovim in another project and away you go


If it's one neovim instance you'll need to set the state key as you :cd between projects or maybe even as you open different files. This means you set up an autocmd on directory change or on file open that works out which project you're in and runs :ConjureClientState my-project-name where the project name can be any string really

👍 3

Basically by running :ConjureClientState SOMESTRING you can hop into an alternate reality of Conjure where you're connected to something else


It's up to you to set up autocmds / key mappings to hop between client state strings, so you can tailor it to your needs. It's more of a building block than anything.


You could just have two like "a" and "b" and set up a mapping to hop to a and one to b


I use this at work with nvim-local-fennel

(module redacted
  {require {nvim aniseed.nvim}})

(set nvim.g.conjure#relative_file_root "./")

(nvim.ex.augroup :redacted-lnvim)
(nvim.ex.autocmd :DirChanged :* :execute "'ConjureClientState ' . fnamemodify(getcwd(), ':t')")
(nvim.ex.augroup :END)


so as I :cd module/some-module I get an isolated environment for that separate clojure project.


two neovim makes more sense, but I might've been trying in the same one


Yeah, two neovims in two terminals works great for me


and thanks, I that's very helpful, I think I will try it


No problem! The client state stuff basically lets you simulate two entirely separate conjure instances


But two terminals is simpler to do, :ConjureClientState ... is there for when you want to get creative and have things just connect and do what you want in monorepo style projects


I guess the same applies to two nREPLs (e.g. clj and cljs) in the same project. Either you use something like Piggieback or you wrangle :ConjureClientState. Is that right?


Seems like the problem is going to be something WSL related. I opened a completely new terminal and it still tells me that watch for the build is not running and when I want to connect it mentions the other project's namespace


these are completely separated projects in entirely different directories


both shadow-cljs though


@U0DTSCAUU kinda although CLJS + CLJ in one nREPL actually works well through sessions.


You can use session mappings to hop between your Clojure and ClojureScript sessions.


That sounds like your CWD isn't being updated @U0VQ4N5EE?


I'd check :cwd in both terminals, if they're the same you're in the same project


Also if you have two nREPLs with two ports just using :ConjureConnect ... with just the port number for each nREPL in each terminal.


I think it's that, the port was the same, so it didn't start, had probably nothing to do with conjure, sorry for the bother 😞 But at least I learned about ConjureClientState


Not a problem! And yeah, I'd consider client state extremely useful in some cases with some upfront thinking / autocmds but an advanced feature most don't need.


TIL about ConjureClientState 🙂 I’ve been using the session list functionality


The error printer in Conjure seems rather sparse — no stacktrace, no ex-data… I end up evaluating *e in the editor to figure things out. Is this something pluggable via say an nrepl middleware?


I tend to just use *e too, you could rig up a mapping that evaluated *e with whatever wrapper you're interested in at the time via :ConjureEval .... I would imagine nREPL middleware would give you some good hooks into it too! Although I've never tried that myself


I didn't do anything special with the errors because the default seemed pretty good already and I didn't want to step on the toes of middleware / custom setups / environmental differences (cljs / clj etc).


Good pointers, thanks


BTW one thing that I realised might influence the floating window delay that I’m seeing is wrapping. I usually tend to wrap my logs (set wrap) so floating window might have to do a lot of work to show the wrapped results?


I always kind-of expected that the floating window will only show the last evaluation result, not the whole log. But that’s just me 🙂


Only showing the last thing is definitely something worth considering


The current route just means "there's only ever one buffer and we get a little view of it" which is sometimes bad, sometimes good when you want to see a glimpse into your previous evals as the latest one comes back


I find that pretty helpful with my goldfish memory 😬


It took me a bit to get used to the error reporting in conjure. Now I'm used to the terse default and use ,ve to show the whole stack trace. I think it's a good balance.

💯 3

I didn’t know there was a mapping, I’ll try that tomorrow.


I love this mapping!

❤️ 3

I must be the weird one. I run my repl outside of Conjure and I see everything :)


I rarely run my REPL inside nvim but when I do I use


Most of the time I'm REPLing into docker containers (plural)


What does vim-jack-in do?


I normally have two terms open, one for nvim + conjure, the other running clj


since clj is also running nrepl


I can simply require a namespace and try things out in the term


whilst evaling things in the nvim


Opens a terminal buffer/window/tab in nvim and runs lein/clj etc within it. That's all! It also injects all the magic cider nrepl middleware stuff which can be handy for off the cuff evals


But if you have a working script in another terminal you don't need it


I just use it where my CIDER/Emacs wielding team mates rely on their form of jack in, which usually means the project.clj isn't actually set up properly and they lean on CIDER's jack in


So I do the same but nvim equivalent where it makes sense