Replacing text while editing


#1

I want to add keyboard shortcuts to replace ‘\alpha’, ‘\beta’, etc. with ‘α’, 'β, etc. while I type.

I’ve tried adding the following to my keymap.cson, but it doesn’t even insert anything.
‘atom-text-editor’:
‘\alpha’: ‘α’

I probably have to make a larger command to delete the preceding text and insert the character(s)… any help on how to do this?


#2

What you want is a snippet, which will replace the text in the prefix with the body.

"*":
  alpha:
    prefix: '\\al'
    body: 'α'

With that, you can just type \altab.


#3

Thank you!