conjure

:neovim:+:clj: https://github.com/Olical/conjure - If you're enjoying Conjure and want to say thanks: https://github.com/users/Olical/sponsorship :smile: (alt https://conjure.fun/discord)
practicalli-john 2020-08-26T20:40:58.020800Z

I have almost everything working with conjure and neovim. I am stuck on using vim-jack-in from within Neovim. It starts a repl but I am stuck in the REPL log and cannot run any commands. Is this a bug or am I missing something. Running a REPL on the command line and then opening a Clojure file with nvim correctly connects to a running repl, so it only seems vim-jack-in approach is not working for me.

👀 1
Olical 2020-08-28T09:21:03.049900Z

I had a look into the bug you mentioned but it looks like it's a neovim bug! https://github.com/neovim/neovim/issues/11440 You can avoid it by either closing the HUD first or using :tabclose instead. It only happens when closing tabs with floating windows pinned to them. I can't think of a workaround right now 😭 it think it needs to be fixed in nvim.

👍 1
Olical 2020-08-28T09:22:48.050600Z

And a possible fix incoming https://github.com/neovim/neovim/pull/11938 - there's a PR anyway

practicalli-john 2020-08-28T09:25:54.051500Z

I can just move the cursor too 🙂 I was only really experiencing that issue when I didn't have things working and I was restarting neovim all the time. But good to know as I am sure I'll experience it again on occasion. Thank you.

Olical 2020-08-28T09:27:07.052700Z

Yep, that'll do it!

practicalli-john 2020-08-28T09:30:10.052900Z

I'll spend a bit of time over the weekend getting a bit more comfortable using Neovim and absorbing the Conjure commands. I didnt see a way to evaluate an expression and have the result printed as a comment. Is that part of Conjure? I can raise a feature request if not. I use that a lot in my broadcasts 🙂

practicalli-john 2020-08-28T09:31:19.053100Z

I did notice the REPL log used more with Conjure (I usually have that hidden in Spacemacs), so maybe that workflow would work just as well. Will let you know.

Olical 2020-08-28T09:34:29.053300Z

Yeah, the log would be the first place I'd go to. All results are placed in your c register by default (I've configured mine to go to my default register so I can just hit p after an eval to get the result) You can evaluate something then press "cp to paste the result wherever you want. Or even <c-r>c while in insert mode.

Olical 2020-08-28T09:35:04.053500Z

Also <prefix>e! will evaluate the current form and replace it with the result.

practicalli-john 2020-08-28T09:36:12.053700Z

I have all this neovim magic to learn, thanks 🙂

Olical 2020-08-28T09:38:02.053900Z

The only other thing I'd pile on that you may want to check out: * Set an uppercase mark (uppercase go across files and persist between nvim restarts) with mF on some form. * Go to another part of the file or a different file entirely * <prefix>emF - see that marked form get evaluated! Really handy for changing things in one area and repeatedly calling it from elsewhere.

Olical 2020-08-28T09:38:27.054100Z

I think vim-iced adopted this feature too, I don't think any other tooling has yet :thinking_face: I think it's pretty fun and unique!

Olical 2020-08-26T20:49:36.021100Z

That'll probably be because you're in the "terminal" mode, which is different to insert and normal.

Olical 2020-08-26T20:49:51.021300Z

One sec

practicalli-john 2020-08-26T20:50:27.021500Z

Yes, it says Terminal at the bottom

Olical 2020-08-26T20:50:33.021700Z

To map <Esc> to exit terminal-mode: >
    :tnoremap <Esc> <C-\><C-n>

Olical 2020-08-26T20:50:48.021900Z

So terminal mode needs <c-\><c-n> to get out of it

Olical 2020-08-26T20:51:05.022100Z

I map my <esc> as well as my jk (personal preference) mapping to that.

Olical 2020-08-26T20:51:12.022300Z

That way it's more like a regular mode.

Olical 2020-08-26T20:51:27.022700Z

It's a bit jarring at first though if you don't know about terminal mode, I was never a fan of that default 😕

Olical 2020-08-26T20:51:36.022900Z

(it caught me out the first time I saw it too)

practicalli-john 2020-08-26T20:52:26.023300Z

After using Spacemacs I shoud remap Esc to fd - is that in your Github config?

Olical 2020-08-26T20:53:03.023500Z

(noremap :i :jk :&lt;esc&gt;)
(noremap :c :jk :&lt;c-c&gt;)
(noremap :t :jk :&lt;c-\&gt;&lt;c-n&gt;)
it's in fennel but you can translate that to viml easily enough

Olical 2020-08-26T20:53:17.023700Z

inoremap jk &lt;esc&gt;, I think?

Olical 2020-08-26T20:53:40.023900Z

Same for cnoremap and tnoremap

Olical 2020-08-26T20:53:46.024100Z

But yeah, fd works well too!

practicalli-john 2020-08-26T20:59:11.024300Z

I find the localleader key combos quick to timeout, so fail because I am typing to slowly. Is there a way to increase that timeout? Or do I just need to type faster 🙂

Olical 2020-08-26T20:59:29.024600Z

Nope, there's an option!

Olical 2020-08-26T20:59:31.024800Z

I'll grab it

Olical 2020-08-26T21:00:28.025Z

I think it's ttimeoutlen

Olical 2020-08-26T21:01:05.025200Z

*'timeoutlen'* *'tm'*
'timeoutlen' 'tm'	number	(default 1000)
			global
	Time in milliseconds to wait for a mapped sequence to complete.

						*'ttimeoutlen'* *'ttm'*
'ttimeoutlen' 'ttm'	number	(default 50)
			global
	Time in milliseconds to wait for a key code sequence to complete. Also
	used for CTRL-\ CTRL-N and CTRL-\ CTRL-G when part of a command has
	been typed.

practicalli-john 2020-08-26T21:11:31.025400Z

I can escape from the terminal, after running :Clj command in neovim (on a Clojure file) and use :first to switch back to the code buffer. However, when evaluating the popup says no connection. Opening the log with`, l v` says no nREPL port file found. Using top in a separate terminal, a java process is started by :Clj in neovim. So seems conjure is not connecting to the repl vim-jack-in starts.

Olical 2020-08-26T21:14:07.025600Z

:thinking_face: if you check your current directory, is there a .nrepl-port file?

Olical 2020-08-26T21:14:31.025800Z

(also I think :Clj opens the terminal in a new tab, you can use gt to cycle those)

practicalli-john 2020-08-26T21:17:53.026Z

gt works, thanks. An .nrepl-port file was created with a timestamp of when I ran the :Clj command.

Olical 2020-08-26T21:18:47.026200Z

Oh, sorry, now hit ,cf to connect to a local port file

Olical 2020-08-26T21:19:09.026400Z

This part will be automatic soon (™️), so when you eval it'll try to find a .nrepl-port file, but I haven't added that just yet I'm afraid.

practicalli-john 2020-08-26T21:20:11.026600Z

Success.. I have a Tonkinese cat 🙂

Olical 2020-08-26T21:20:20.026800Z

Excellent!

Olical 2020-08-26T21:20:33.027Z

Sorry for the confusion around the connection

practicalli-john 2020-08-26T21:20:50.027200Z

Its no different to the early days of Calva and Cider 🙂

Olical 2020-08-26T21:20:51.027400Z

It's automatic as you open your first Clojure file but that's all right now. On eval will be the next step

Olical 2020-08-26T21:21:04.027600Z

Well that's good to hear!

practicalli-john 2020-08-26T21:22:10.027800Z

I sometimes get the error E5601: Cannot close window, only floating window would remain and cant close neovim

Olical 2020-08-26T21:22:31.028Z

Oh that's interesting, I've never seen that one.

Olical 2020-08-26T21:22:54.028200Z

When is that happening?

practicalli-john 2020-08-26T21:23:29.028400Z

gt will get rid of it, so it seems to be that the popup isnt going away by itself when I use :Clj

practicalli-john 2020-08-26T21:24:05.028600Z

Switching tabs is refreshing the source code buffer I assume and forcing the floating window to go

Olical 2020-08-26T21:24:41.028800Z

The Conjure floating window vanishes on cursor move

Olical 2020-08-26T21:24:45.029Z

Which can fire when you change tabs etc

practicalli-john 2020-08-26T21:24:56.029200Z

Yes, just noticed that 🙂

practicalli-john 2020-08-26T21:25:28.029400Z

That makes sense. Works just like cider inline eval results

practicalli-john 2020-08-26T21:27:24.029600Z

Thanks for your help with this, much appreciate.

Olical 2020-08-26T21:28:59.029800Z

Yep, supposed to be an equivalent but with multiline, history, highlighting and editable

Olical 2020-08-26T21:29:23.030Z

And you're more than welcome, I want to give you a decent experience and learn where the pain points are

Olical 2020-08-26T21:29:47.030200Z

I'll make a note to try and get that same error

practicalli-john 2020-08-26T21:30:28.030400Z

:q when the popup is still displayed should give you the error under the neovim status bar

Olical 2020-08-26T21:30:57.030600Z

Yep, I had a feeling it would be that 🙂

Olical 2020-08-26T21:31:02.030800Z

I'm sure I can fix it, thanks for spotting it!!!

practicalli-john 2020-08-26T21:33:09.031Z

I updated my notes on https://gist.github.com/jr0cket/6c475137ee57fbb14f9289bd76889512

Olical 2020-08-26T21:34:48.031200Z

Ooo looks good!

Olical 2020-08-26T21:35:48.031400Z

Thank you so much for writing it!

practicalli-john 2020-08-26T21:42:42.031600Z

I'll add a nicer version of the write-up to http://practicalli.github.io/clojure/clojure-editors/ and as I'll be doing a lot of videos for the next few months, I'll add a walk-through video of Conjure too (using your ascii cinema syntax guide as inspiration)

❤️ 1
🚀 1
practicalli-john 2020-08-26T21:43:21.031800Z

The biggest challenge is yet to come though... deciding on a theme and statusbar theme 🙂

😄 1