As @Mikhail-V suggests, you could do such a thing if you are willing to install and use the PythonScript plugin. Maybe there are other ways as well, but all would involve installing something extra, so why not the PS plugin? :-)
Here’s some quick sample PS code, modify/experiment/enhance as you like:
search_text = '--' replacement_text = 'en-dash' # <----- this is just placeholder, put what you want here def callback_sci_CHARADDED(args): if chr(args['ch']) == search_text[-1]: cp = editor.getCurrentPos() search_text_length = len(search_text) start_of_search_text_pos = cp - search_text_length if editor.getTextRange(start_of_search_text_pos, cp) == search_text: editor.beginUndoAction() editor.deleteRange(start_of_search_text_pos, search_text_length) editor.insertText(start_of_search_text_pos, replacement_text) editor.endUndoAction() end_of_search_text_pos = start_of_search_text_pos + len(replacement_text) editor.setCurrentPos(end_of_search_text_pos) editor.setSelection(end_of_search_text_pos, end_of_search_text_pos) editor.chooseCaretX() editor.callback(callback_sci_CHARADDED, [SCINTILLANOTIFICATION.CHARADDED])