Closed humphreylee closed 1 year ago
In your init.lua
:
snippets.smile = '🙂'
snippets['beta'] = 'β'
There is probably a way to also have a slash or colon in the shortcode but this would be the starting point (I haven't checked how to escape or if it's possible). I also have thought about making a little module which let's you select an emoji from a list with some fuzzy search.
https://orbitalquark.github.io/textadept/api.html#textadept.snippets
Note that emojis might not work on all platforms due to the used font. I use the GTK version on Linux because it had better emoji support.
Thanks for the tips. "Beta" and 😃 are just examples. Is it possible to have a universal plan for cover most of users' need, similar of how Emacs does it?
Sure, you'd loop over a table of mappings with your short keys and symbols. I don't think this would be part of core Textadept but rather would have to be in an external module.
Robert is correct. You'd add this functionality yourself, either via a module, or in your ~/.textadept/init.lua. Tab-completion is tied to snippets, so you would create a map of snippet triggers to emoji. I would not want to maintain such a map in core Textadept. There's also the matter of fonts and encodings. 'β' can be either one byte in certain extended ASCII encodings, or multiple bytes in UTF-8. Keeping encoding-specific maps would be even more difficult.
Thanks for your consideration🙏. Closing the issue.
Would you consider feature request for Emacs like TeX input method for symbol and emoji? For example (e.g. in Juno), special character/ symbol, e.g. beta (β) could be entered into the editor with "\beta", followed by "tab" key. Similarly, an example of emoji "\:smile" turned into 😄. Is this do able in textadept for all supported platforms? Thanks.