Fork me on GitHub

Neovim doesn't understand chars like \(, \[, \{ correctly. For example, with code (prn \( ), vim would think the \( and the last ) are a pair, so if you press % on them, you jump to the wrong parens. What controls the matching logic for this? Any good way to fix it?


You may want to look into tree-sitter, that should fully understand it. It's a bit of a hoop-jumping exercise at the moment, UX could definitely improve to be more "just work out of the box" but it's still not too bad with some research.


Although if you're talking about % specifically I think that's the matchpairpos or matchpair functions under the hood. Those will walk outwards from the cursor until they find a matching character... so they're not very smart.


I'm not sure if you could improve this really, maybe you could override % with your own call to matchpair (I think that's the name?) that takes into account \ before the current character and skips it. I can't write all of this out, soryy, it'll take some work and I need to get back to my work. I can tell you that the matching fn takes a "skip" function that is checked on each matching character. So you can add extra skipping logic there involving escapes.


Or maybe there's config I'm not aware of 😅


OK. it seems that the problem is from Treesitter. After disabling TS highlight, the matching works correct.


Ah okay! That's annoying. TS does seem great but I turned it off too due to performance issues and weird edge cases like this. Maybe one day it'll be ready for the prime time on my machine 🙂


this is false with my version of nvim and the clojure syntax file (that is, it understands \( etc. correctly and % does the right thing in your example)


Hi I recently installed vim-fireplace and want to connect to an nrepl-server and evaluate code with ‘cpe’ (current word) Which throws an error

Exception in thread "nREPL-worker-4" java.lang.reflect.InaccessibleObjectException: Unable to make field protected  accessible: module java.base does not "opens " to unnamed module @2eb231a6
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(
	at java.base/java.lang.reflect.Field.setAccessible(
	at nrepl.middleware.interruptible_eval$set_line_BANG_.invoke(interruptible_eval.clj:33)
	at nrepl.middleware.interruptible_eval$source_logging_pushback_reader.invoke(interruptible_eval.clj:50)
	at nrepl.middleware.interruptible_eval$evaluate$fn__742.invoke(interruptible_eval.clj:95)
	at clojure.lang.AFn.applyToHelper(
	at clojure.lang.AFn.applyTo(
	at clojure.core$apply.invokeStatic(core.clj:667)
	at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1977)
	at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1977)
	at clojure.lang.RestFn.invoke(
	at nrepl.middleware.interruptible_eval$evaluate.invoke(interruptible_eval.clj:84)
	at nrepl.middleware.interruptible_eval$interruptible_eval$fn__787$fn__790.invoke(interruptible_eval.clj:220)
	at nrepl.middleware.interruptible_eval$run_next$fn__782.invoke(interruptible_eval.clj:188)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.base/java.util.concurrent.ThreadPoolExecutor$
	at java.base/


Did you load the namespace's require?


and import?


ah sorry, saw that you fixed it yourself


I can do :Eval {some-code} and it works fine


:FireplaceConnect also worked fine.


For example I can :Eval some var-name, but if I put the cursor on the word and ‘cpe’ it fails…