I often use the escape key to quickly write mathematical notation in a text cell(e.g. $\pi$ is written when pressing escape+"pi"+escape). I find the escape key annoying to use because it's too far for my fingers to stretch, so I wrote some code to use "/" instead.
The code below replicates the escape key using "/" (to get the alias delimiter). However, for some reason, it does not parse upon the second press of the "/" key. Unfortunately, my solution requires an extra press of any key. For example, to get $\pi$ I have to press "/" then "pi" then "/" and then also the space bar (or any other key). The escape key does not require the extra keypress.
SetOptions[SelectedNotebook[],
NotebookEventActions -> {{"KeyDown", "/"} :>
NotebookWrite[InputNotebook[], "\\[AliasDelimiter]"]}
];
I'm looking for a way to force the parse to happen upon the second press of "/" without the extra keypress so that it truly replicates the escape key. I'm looking for a solution that uses NotebookEventActions. I know there is an alternative way of editing the keyeventtranslations.nb, however, I am looking for a solution that uses NotebookEventActions specifically.
Any ideas?
P.S. I tried programmatically writing in a space and then deleting it, but it still doesn't parse until I physically press a key on my keyboard.