Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to expand text or snippet with the help of HammerSpoon?

Can we use HammerSpoon to expand text just like aText or TextExpander ?

There is hs.eventtap.keyStrokes("asdf") but how to detect the keystroke and expand the text?

E.g. One use case is to expand mme -> [email protected].

How to achieve this with HammerSpoon ?

like image 690
arpit Avatar asked Nov 05 '25 06:11

arpit


1 Answers

The very nice, open source Spoon (a HammerSpoon plugin/library) called HammerText is the solution here. However, it's not perfect because the solution randomly stops working after some time and nobody knows why - probably a HammerSpoon bug.

https://gist.github.com/maxandersen/d09ebef333b0c7b7f947420e2a7bbbf5#file-init-lua

For good measure, the example you've given does not require HammerText, aText or TextExpander, just plain Mac System Preferences > Keyboard > Text replacement.

like image 92
ttarchala Avatar answered Nov 07 '25 07:11

ttarchala



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!