Fork me on GitHub
#clerk
<
2023-11-09
>
Rojure, Rojure11:11:44

I don't understand how I should use "jack in" in neovim in the clerk-demo. I installed the plugins 'tpope/vim-dispatch', 'clojure-vim/vim-jack-in' and 'radenling/vim-dispatch-neovim' using Lazy plugin manager with a Kickstart-configuration. Then, I open dev/user.clj in neovim, and type ':Clj' and a terminal-like view appears in neovim. How do I proceed from here? Or should I have used some arguments in the ':Clj' command?

teodorlu11:11:31

My 2 cents: 1. Projects don't usually automatically start up clerk. 2. Instead, there's often a clue on how to start clerk in user.clj 3. For clerk-demo, check out https://github.com/nextjournal/clerk-demo/blob/main/dev/user.clj You also have to decide whether you want to setup a keyboard shortcut to view the current namespace in clerk - or if you'd rather use a file watcher, save, and watch things happen. But the file watcher is easier to set up, just start clerk and it watches for saves. I prefer the keyboard shortcut, as it let's me save and work with other files as I want in a REPL without clerk doing anything.

teodorlu11:11:58

Would you like to setup a keyboard shortcut, or use the file watcher? More information about keyboard shortcut vs file watcher here: https://book.clerk.vision/#file-watcher

Rojure, Rojure12:11:51

Hi Teodor, I did open dev/user.clj, but after entering the command :Clj I end up with neovim not showing user.clj anymore, but a clojure REPL, like shown in my screen shot. Do you want me to start another neovim instance and open dev/user.clj? I'll get to setup a keyboard shortcut later, since I have not yet enabled the Conjure plugin right now. So at first I'd choose to use a file watcher. But that's only the step to take after getting this 'jack in' stuff.

jackrusher15:11:07

Have you used Clojure before?

Rojure, Rojure15:11:38

Not much; just a little bit on the command line. And I was able to use Conjure with bb

Rojure, Rojure16:11:00

I was able to start up another instance of neovim, and with Conjure installed, it recognized the .nrepl-port file that got created by the jack-in command

jackrusher16:11:29

The directions for Clerk very much assume that the reader is an experienced Clojure programmer who already has their environment setup, so there’s a bunch of info missing for your situation. Sorry about that!

jackrusher16:11:05

It looks like the Conjure documentation has some good info for you to figure out how to evaluate forms in your projects, &c. https://github.com/Olical/conjure

Rojure, Rojure16:11:27

OK, thanks for the pointer. I was under the impression that vim-jack-in could work without Conjure: that it would start clojure in some way like the clj command mentioned on this page: https://github.com/nextjournal/clerk-demo/, after which I would be able to just edit the files in the notebooks/ directory and automatically see the changes appear on the web page. It is slowly getting clear to me that jack-in is supposed to start up an nrepl-server, and that conjure is needed to act as an nrepl-client. I'll need to read up some more to find out how to make those two work from within the same neovim instance.

jackrusher16:11:16

The automatic reloading in the browser needs to be started via the repl, an nREPL connection, or something. There are some forms in the user.clj that can start the watcher, plus some forms that use show! to direct the system to display a particular document. I’m making a note to add a command line option to the clerk-demo repo for starting everything directly with a single command line invocation.

Rojure, Rojure09:11:18

Turns out that my screen shot showed neovim in 'Terminal' mode. I could leave Terminal mode using CTRL-\,CTRL-n. Then, using CTRL^ (or, typing :first) I got back at the buffer containing /dev/user.clj. With the Conjure plugin installed, I could go ahead and send the forms in user.clj to the nRepl-server that got fired up by the jack-in command :Clj. Finally I also set up the keyboard shortcut <localleader>cs which works great. Thanks for the pointers and explanation!

🖤 1
💯 1
Rojure, Rojure23:11:53

It seems that the clerk-demo's "home page" has a second column with a spurious "notebooks" section. (In the left column all these notebooks are already mentioned, and some more). Is that on purpose? http://localhost:7777/'nextjournal.clerk.home

jackrusher08:11:40

Note that one column is “All notebooks” and the other is “Static Build Index”. The latter shows which notebooks will be included if one generates a “static build” from this source tree, which is an artifact that can be published without Clerk.