{"id":4752,"date":"2025-06-12T16:05:14","date_gmt":"2025-06-12T16:05:14","guid":{"rendered":"https:\/\/nikola-breznjak.com\/blog\/?p=4752"},"modified":"2025-06-12T16:05:14","modified_gmt":"2025-06-12T16:05:14","slug":"when-espanso-breaks-on-long-replacement-strings-and-how-to-fix-it","status":"publish","type":"post","link":"https:\/\/nikola-breznjak.com\/blog\/quick-tips\/when-espanso-breaks-on-long-replacement-strings-and-how-to-fix-it\/","title":{"rendered":"When espanso Breaks on Long Replacement Strings (and How to Fix It)"},"content":{"rendered":"<h1>When espanso Breaks on Long Replacement Strings (and How to Fix It)<\/h1>\n<p>Hey friends \ud83d\udc4b<\/p>\n<p>Today\u2019s post is a quick one, but it might save you from a few head scratches and keyboard punches if you\u2019re an <code>espanso<\/code> user who\u2019s been wondering why your juicy long replacement snippets randomly just&#8230; don\u2019t show up.<\/p>\n<p><em>If you&#8217;re wondering what Espanso is, check this blog post: <a href=\"https:\/\/nikola-breznjak.com\/blog\/quick-tips\/espanso-because-who-actually-likes-typing-out-their-emails\/\">Espanso: Because Who Actually Likes Typing Out Their Emails?<\/a><\/em><\/p>\n<h2>TL;DR \u2615<\/h2>\n<ul>\n<li>Long replacement strings (&gt;100 chars) can silently break in espanso<\/li>\n<li>This is due to the default <code>clipboard_threshold<\/code> config<\/li>\n<li>You can fix it by setting a higher threshold in <code>default.yml<\/code><\/li>\n<\/ul>\n<h2>!TL;DR \u2615<\/h2>\n<p>If you came for the story, here we go: so, here\u2019s what I ran into&#8230;<\/p>\n<h2>The Problem: Long Replacements Just Break \ud83e\udde8<\/h2>\n<p>I\u2019ve been using <a href=\"https:\/\/espanso.org\">espanso<\/a> for a while now (it\u2019s a neat little open-source text expander that makes typing repetitive stuff a breeze). All was fine and dandy\u2014until I tried adding a longer replacement string, something like:<\/p>\n<pre><code class=\"language-yml\">- trigger: &quot;:some-long-snippet&quot;\n  replace: &quot;Dear passangers, we have good news and bad news. Good news is we are landing. Bad news is we are crash landing!&quot;<\/code><\/pre>\n<p>And <em>poof<\/em>\u2014nothing. The replacement just didn\u2019t happen. What&#8217;s even worse, it would usually trigger the command prompt in editors (similar to pressing <code>CMD + k<\/code> or <code>CMD + p<\/code>).<\/p>\n<p>At first, I thought it was something I\u2019d messed up in the syntax. I double-checked, triple-checked\u2026 nope, looked fine.<\/p>\n<p>Then I started wondering if maybe the issue was platform-specific. I&#8217;m running the newest version on a up2date Mac. Thought it was some weird key combo or something &#8211; but, no.<\/p>\n<p>So yeah, turns out&#8230;<\/p>\n<h2>There\u2019s a Hardcoded Limit (But You Can Fix It!) \ud83d\udee0\ufe0f<\/h2>\n<p>After digging around a bit\u2014and with a helpful tip from a fellow redditor\u2014I discovered that <code>espanso<\/code> has a <code>clipboard_threshold<\/code> setting buried in the <code>default.yml<\/code> config file (located at <code>~\/.config\/espanso\/default.yml<\/code>).<\/p>\n<p>And it looks like this:<\/p>\n<pre><code class=\"language-yml\"># clipboard_threshold: 100<\/code><\/pre>\n<p>Yep, it was commented out by default.<\/p>\n<p>So what&#8217;s this do? If your replacement string is longer than the threshold (default is 100 characters), <code>espanso<\/code> silently fails to insert it. No warning. No logs. Nada.<\/p>\n<hr \/>\n<h2>The Fix: Increase the Clipboard Threshold \ud83d\ude4c<\/h2>\n<p>To fix this, all you need to do is:<\/p>\n<ol>\n<li>Open your <code>~\/.config\/espanso\/default.yml<\/code><\/li>\n<li>Uncomment or add the <code>clipboard_threshold<\/code> setting<\/li>\n<li>Set it to something higher, like 500:<\/li>\n<\/ol>\n<pre><code class=\"language-yml\">clipboard_threshold: 500<\/code><\/pre>\n<ol start=\"4\">\n<li>Save the file and reload espanso (if it doesn&#8217;t reload automatically)<\/li>\n<\/ol>\n<pre><code class=\"language-bash\">espanso restart<\/code><\/pre>\n<p>And voil\u00e0, your long replacements now work like a charm \ud83c\udf89<\/p>\n<h2>Conclusion<\/h2>\n<p>If you\u2019ve hit this issue too, I hope this saves you some time. And if you\u2019re just diving into <code>espanso<\/code>, maybe take this as a reminder to skim the config docs sooner rather than later \ud83d\ude05<\/p>\n<p>Happy expanding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When espanso Breaks on Long Replacement Strings (and How to Fix It) Hey friends \ud83d\udc4b Today\u2019s post is a quick one, but it might save you from a&hellip;<\/p>\n","protected":false},"author":1,"featured_media":4755,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-4752","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-quick-tips"],"_links":{"self":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/4752","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/comments?post=4752"}],"version-history":[{"count":0,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/4752\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media\/4755"}],"wp:attachment":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media?parent=4752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/categories?post=4752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/tags?post=4752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}