Fork me on GitHub
#vim
<
2022-08-12
>
mars0i19:08:08

I've been using vim-iced, but now I just started trying out Conjure. Seems very nice, but I'm still finding my way. Going through the internal docs for conjure and conjure-client-clojure-nrepl, and scrolling through the output for :map, I don't see a mapping or function that means "evaluate the largest sexp containing the cursor that is not (comment ....)", like https://liquidz.github.io/vim-iced/vim-iced.html#%3AIcedEvalOuterTopList. Conjure comes with <leader>er for EvaluateRootForm, but that returns the result of (comment ...) , i.e. nil. Am I missing something? I wouldn't think that I'd have to write a little script myself, since evaluating what's at a "top" level within a comment seems like it would be a common practice.

walterl19:08:48

You can now <LocalLeader>er inside Rich comments with Conjure: https://github.com/walterl/conjure-efroot 😬 neovim

❤️ 1
dharrigan05:08:10

Awesome sauce!

Proctor19:08:08

If you are on a later version of Conjure, you get that out of the box now

walterl19:08:02

If you use tree-sitter, yes. I should probably make that clearer.

walterl19:08:15

Ha! I was just doing a shameless plug. I didn't even realize I was responding to a question asked only minutes ago 😅

walterl19:08:40

You'll be the first user (other than myself), then 🙂

mars0i19:08:28

What great timing!

walterl19:08:23

Let me know if you experience any issues.

mars0i19:08:12

Seems to be working fine. Thanks!

mars0i19:08:41

E5108: Error executing lua [string ":lua"]:1: module 'conjure-efroot' not found:

        no field package.preload['conjure-efroot']
        no file './conjure-efroot.lua'
        no file '/usr/local/Cellar/luajit-openresty/2.1-20220411/share/luajit-2.
1.0-beta3/conjure-efroot.lua'
        no file '/usr/local/share/lua/5.1/conjure-efroot.lua'
        no file '/usr/local/share/lua/5.1/conjure-efroot/init.lua'
        no file '/usr/local/Cellar/luajit-openresty/2.1-20220411/share/lua/5.1/c
onjure-efroot.lua'
        no file '/usr/local/Cellar/luajit-openresty/2.1-20220411/share/lua/5.1/c
onjure-efroot/init.lua'
        no file './conjure-efroot.so'
        no file '/usr/local/lib/lua/5.1/conjure-efroot.so'
        no file '/usr/local/Cellar/luajit-openresty/2.1-20220411/lib/lua/5.1/con
jure-efroot.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        [string ":lua"]:1: in main chunk

👀 1
walterl19:08:33

Fixed. PlugUpdate

mars0i19:08:46

Yes, works. Thanks!

lispyclouds19:08:07

conjure should also be able to do this natively with treesitter too: https://github.com/Olical/conjure/releases/tag/v4.37.0

mars0i19:08:20

That's from ConjureEvalCommentEffectiveRootForm.

mars0i19:08:48

ConjureEvalEffectiveRootForm works fine.

mars0i19:08:24

I have not touched treesitter. I am not even clear on what it is. One thing at a time!

lispyclouds19:08:04

essentially its a way for neovim to understand the syntax of the code and can be used for various things like semantic highlighting, refactoring, etc https://www.reddit.com/r/neovim/comments/jr7gbz/what_is_neovim_tree_sitter/

lispyclouds19:08:41

it tries to understand the code youre writing in a similar way a compiler would do

mars0i19:08:14

I see. I can see how that would be quite useful for certain purposes.

lispyclouds19:08:18

so if you have it enabled, conjure can use the syntax info to do its magic

lispyclouds19:08:41

you can check out https://github.com/lispyclouds/dotfiles if it helps, quite minutely configured and very clojure biased 😄

mars0i19:08:49

From the link you posted, it looks like just installing treesitter will remap <LocalLeader>er to ignore the top-level comment, even if I don't use treesitter in any other way.

lispyclouds19:08:52

if you wanna get into extreme details of treesitter: https://www.youtube.com/watch?v=Jes3bD6P0To From the people who made it (Atom team in GitHub)

mars0i19:08:56

OK, cool. Excellent. So I have two solutions. I might prefer efroot, on the theory that adding more stuff means that there's more to be confused about if something goes wrong. I'll look at your dotfiles, though, and see whether there are other reasons that I'll want to use treesitter. There are a lot of cool editing tools that aren't as useful for me as for other people because I won't use them as often.

mars0i19:08:39

I'll probably just try treesitter anyway to see what happens.

lispyclouds19:08:30

it generally enables a whole new set of things, stuff you thought you didnt need 😛

mars0i19:08:44

Yeah .... I am sure it will. I don't code constantly--it's only part of my work (a fun part)--so sometimes it's easier to use a few more keystrokes so that I don't have to remember a convenient trick that I could use instead. If was coding all the time, I'd use the trick often enough that I'd remember it, and it would be more valuable.

walterl19:08:21

Tree-sitter is definitely the future. The only reason I disabled it again is that it breaks indentation in Clojure.

walterl19:08:42

Specifically, when you have curly braces in strings, it apparently tries to align them as if it's the JavaScript source I'm generating 😛

lispyclouds19:08:52

interesting @clojurians-slack100 i would suspect that to be happening from a structural editing plugin not tree sitter :thinking_face:

walterl19:08:50

It was surprising to me too, but I narrowed it down to disabling nvim-treesitter 🤷

lispyclouds20:08:15

hmm i never seem to have run into that issue, do you have an example maybe and your config?

walterl20:08:34

Try typing this out:

(str/join
  ["const msg = {"
   "  foo: 'bar'"
   "}"])

walterl20:08:43

It would be (more) interesting if it's due to my config (https://github.com/walterl/dotfiles)

lispyclouds20:08:00

seems okay for me, im using rust-parinfer with it

lispyclouds20:08:57

yeah not sure if anything in your vimrc could trip it, will try running it properly in sometime

lispyclouds20:08:03

ah didnt see the _config/nvim, will see that too

lispyclouds20:08:44

theres indentation settings in clojure.vim too, with conjure and tresitter i dont need that anymore. maybe that could be something?

walterl20:08:39

That's what I'm looking at too (I see indentexpr=GetClojureIndent(), which comes from clojure.vim), but for some reason disabling clojure.vim isn't "taking" 😕

walterl20:08:22

Hmmm... know of a way I can figure out where a function is defined in vim?

walterl20:08:56

I confirmed that clojure.vim is not in my runtimepath, but GetClojureIndent still exists

lispyclouds20:08:44

could come from a lot of places, try loading nvim without any config?

lispyclouds20:08:00

i'll try to have a better look later but have a strong feeling its a combination of things that's tripping it, not just treesitter

walterl20:08:24

Probably 🙂

lispyclouds20:08:08

you could try my dotfiles too, quite less elaborate than your setup, see if the issue is still there?

walterl20:08:41

What's your indentexpr?

lispyclouds20:08:22

same as yours GetClojureIndent()

walterl20:08:28

Seems like it's probably coming from my /usr/share/nvim/runtime/indent/clojure.vim

walterl20:08:39

which is part of the neovim-runtime package

lispyclouds20:08:20

yeah i guess its built in

walterl20:08:40

IIRC that was created by :TSInstall clojure

walterl20:08:36

Interesting. TSModuleInfo reports only highlighting is supported:

>> default         highlight  incremental_selection  indent  
astro              ✗          ✗                      ✗       
bash               ✗          ✗                      ✗       
beancount          ✗          ✗                      ✗       
bibtex             ✗          ✗                      ✗       
c                  ✓          ✗                      ✓       
c_sharp            ✗          ✗                      ✗       
clojure            ✓          ✗                      ✗       

lispyclouds20:08:56

yeah thats my expectation too, hence was thinking it could be a structural editing thing issue. clojure ts grammar is quite simple