Fork me on GitHub

Hey there - I recently switched my entire config over to fennel. I’m using which-key to declare mappings, but I’m running into an issue where I can’t declare mappings over the conjure functions. Normally I’ll use this mapping to evaluate the form at column 3 (2 spaces in):

nmap <localleader>e2 3|<localleader>ee
However if I put this into whichkey as a string it doesn’t do anything for the <localleader>3. If I swap out <lovalleader>ee for :ConjureEvalCurrentForm<cr> it does work - however I have a lot of mappings that use marks and I don’t seem to see a :ConjureEvalMarkedForm that accepts a form as an argument. Does anyone know why these maps may not be executing the conjure mappings when used as mappings?


So EvalMarkedForm will prompt the user for input when executed, so you run the command which then executes the Lua which prompts for the key. That could definitely be done in a more vim friendly way to allow you to map things differently. But generally what you want to do is somehow run ConjureEvalMarkedForm and then send the mark key as input. I don't know if that's possible.


So the thing I'd recommend is executing this lua in your mapping instead require('conjure.eval')['marked-form']('q') for now.

🙌 1

marked-form takes a mark or will prompt the user interactively for it.


Onto the mapping to <localleader>ee, what happens if you substitute <localleader> for the actual character such as ,?


It does, but I just found the issue


Which-key sets noremap as a default, so I had to set that to false

🎉 1

Good to know about the marked-form though, thank you for the info 😄


I've found with Lua (not just fennel, since fennel is just a syntax on top of it, so really most questions in this area are LUA+NVIM questions, not fennel) I struggle to use the <foo> syntaxes to map to keys in some places. I think viml has some special magic that interprets those values in strings for you and translates them into some special thing at the right time. Kinda gross that it's all hidden, magic and implicit which tricks you into thinking "oh I can put these anywhere!", nope, VimL is special in some hard to find way. nvim in it's :h api does list some ways to translate these magic syntaxes of <something> into some other format which may work in more cases. It seems like this isn't your issue this time! But be aware, the escape char + some named character in strings sometimes works differently between lua and viml and it can be tricky to get it right.


And yeah, don't be shy when reaching into Conjure's Lua and calling things directly. Most things will remain stable long into the future, I rarely if ever rename/break/remove stuff once it's in the interface.


hehe well I’ve been using vim for 10 years but never bothered to learn vimscript, skipped lua and went straight to fennel


so there are a couple gaps in my education 😅


question as I’m just finding it and digging for info - I see some new conjureevalcommentcurrentform functons. Are these built in commands to evaluate nested forms inside comments?


Same basically, I wrote Aniseed and then Conjure on top of it because I couldn't stand doing anything complex with VimL, or even Lua really. I like my lisps too much 🙂

🙌 2

yes and thank you for that, being able to run commands with conjure from my editor has made it fun to learn - I’ve learned more about neovim this week than I have in 10 years thanks to your work ❤️

❤️ 1

Oh damn, they're not in the docs, they're called by <prefix>ece etc, so there's comment variants of some eval mappings and commands to match up to them (they're just not listed in the help, oops). But that inserts the result of an eval into a comment, it doesn't evaluate comments.

🙌 1

However, there is a way to get Conjure to treat comments as do blocks

🙌 1

I can't implement "eval up to the root and count comment as a root" until everyone's on tree-sitter though really. So I might add that one day and warn if you try to use it without tree-sitter.

🙌 1

Ah here: let g:conjure#eval#gsubs = {'do-comment': ['^%(comment[%s%c]', '(do ']}

🙌 1

It's in :h g:conjure#eval#gsubs, that allows you to Lua subs all evals as they head out of Conjure. Kinda massively dangerously powerful, but lets you do whatever you want!

🙌 1

Hooray for double edged chainsaws.


Ah great! I’ve been using these mappings, which have gotten me 90% of the way there: I’ll give the new mappings a shot


Is there a way to use cljs.test/run-tests as the test runner?


Just added configuration for this, from :h conjure-client-clojure-nrepl

            Test runner to use for the various test mappings. The following
            are supported:
             * `"clojure"`
             * `"clojurescript" (cljs.test instead of clojure.test)`
             * `"kaocha"`
            More can be added through contributions where required.
            Default: `"clojure"


You can now set that to clojurescript and it'll run the cljs.test functions instead. I thought they were aliased though so clojure.test and cljs.test was ALWAYS the same thing? I always use clojure.test in my clojurescript


Or used to, when I wrote it


This is on the develop branch of Conjure btw


But added that config just in case you can't do that for some reason


Yeah I’ve definitely run them before with Conjure, I’m not sure why they’re failing with that error now. Thanks for adding it 🙂