Anybody using Espanso with Logseq? If so, how do deal with "replace" strings that contain [, (, etc -> which auto-complete the closing corespondent?

Hello,

I just started using Espanso for Text-Expanding and I find it a very capable app but I have found an issue with auto-expanding some strings like the ones that mess the Logseq’s auto-close-brackets features. I don’t know why it does it in Logseq, in VSCodium it doesn’t although the later also has the auto-close-brackets feature and moreover, if I copy/Paste it from clipboard in Logseq it pastes allright.

Here is my test expansion:

- trigger: ":js"
    replace: "[John Snow]([[some-internal-Logseq-Link-format]])"

and here is the result in Logseq:
image

Moreover, if I have some text inside the block, say “SOMETEXT”, the I press the prefix (“:” in my case) and the “js” trigger, it garbles them together awfully:

image

How can I know what is at fault here? I can’t seem to reproduce this behavior in any other text field or editor or whatever.

1 Like

Since Logseq kinda stalls a bit when you type some internal link, you have to configure espanso to type its snippets slower in Logseq. How?

Well, first open your espanso config folder (in on Linux, open ~/.config/espanso/config), and create a file logseq.yml (the name is to inform you, not espanso). In this file you add:

filter_class: Logseq
#disable_x11_fast_inject: true
backend: Auto
inject_delay: 45
key_delay: 10

The delays can be adjusted according to your needs. Since your hardware is most probably different from mine, logseq may run faster or slower there. So, if you notice logseq is still messing with your espanso’s snippets, adjust the delays accordingly.

To learn more on espanso config options, check this page.

Unfortunately this doesn’t fix it for me. Whatever expanding text with brackets or other aut-completion stuff in Logseq gets scrambled badly. I wish I could disable the auto-completion of anything in Logseq :frowning:

1 Like

Tried increasing both delay to 1000ms but it did not fix the issue for me too.

I was able to work around the issue in Logseq by changing espanso’s injection backend to Clipboard.
uncommented backend line in default.yml in espanso’s config folder.

# --- Injection Backend

# Espanso supports multiple ways of injecting text into applications. Each of
# them has its quirks, therefore you may want to change it if you are having problems.
# By default, espanso uses the "Auto" backend which should work well in most cases,
# but you may want to try the "Clipboard" or "Inject" backend in case of issues.
backend: Clipboard
1 Like

I have noticed that option but didn’t try it yet, especially since I started to use Logseq’s “internal text-expander” (Custom Commands in config.edn), which is quite capable and lets me leave the cursor where I want. If Espanso would support that then I’d be even more thrilled to re-try using it, albeit being an expernal/additional tool. I will do some research on this capability of Espanso and thanks for confirming that the Clipboard Mode fixes the garbled text.

1 Like

oh nice, didnt know Logseq has a built-in text expander feature and also with cursor placement too, will have to look into it.

1 Like

Yes, quite nice but maybe not too easy to move out of Logseq if needed (ex: move them to Espanso if I realize that I can do it better with Espanso or that Espanso has more features like adding dates, running scripts to calculate stuff or even go online to fetch some stuff, etc).

In Logseq you search for the:

:commands
[

]

section and you cram in there whatever text (@block-level) expanding you need. I have it setup for many many situations like names ("ex: “I met <djohn today” → “I met [John]([[John Doe]] ‘fellow gym-goer at XYZ Gym in Vancouver’)”), etc.

For example, you could have an Inbox-type of note called “quote”, which would create a Logseq Block that looks like this:

image

, using this definition:

["quote" [[:editor/input "✒️^^Quote^^:  \nsource::    \nmainTag::  \ntangentTags:: \ncontext:: \n> \n> #quote " {:last-pattern "<" :backward-pos 10}]]]

I am not using anything else out of it besides the “backward-pos”, so maybe there are more to it that make it more valuable than using an external text expander.However, I am very interested in doing the same thing with Espanso and will definitely try the Clipboard Backend.

1 Like